Created
March 29, 2014 14:19
-
-
Save Justasic/9855295 to your computer and use it in GitHub Desktop.
This was a simple shell script I made to install EPEL and REMI yum repos. I have installed so many CentOS machines that I get tired of running the same commands over and over so I made this a script. Run `curl https://gist.githubusercontent.com/Justasic/9855295/raw/install.sh | sh` to install.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install yum priorities to make sure we aren't going to try and install fedora on centos :s | |
yum install yum-priorities -y | |
# Import the GPG keys for package verification signatures | |
rpm --import https://fedoraproject.org/static/0608B895.txt | |
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi | |
# Install epel and remi repos | |
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm | |
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm | |
# Add priority=10 to epel and remi | |
sed -e '/\[epel\]/{:a;n;/^$/!ba;i\priority=10' -e '}' /etc/yum.repos.d/epel.repo > /etc/yum.repos.d/epel.repo.tmp | |
sed -e '/\[remi\]/{:a;n;/^$/!ba;i\priority=10' -e '}' /etc/yum.repos.d/remi.repo > /etc/yum.repos.d/remi.repo.tmp | |
# Move the temp files over the old ones | |
mv /etc/yum.repos.d/remi.repo.tmp /etc/yum.repos.d/remi.repo | |
mv /etc/yum.repos.d/epel.repo.tmp /etc/yum.repos.d/epel.repo | |
# Enable REMI repo for use | |
# NOTE: this really needs to not depend on line numbers!!! | |
sed -e '/\[remi\]/{n;n;n;n;s/enabled\=0/enabled\=1/' -e '}' /etc/yum.repos.d/remi.repo > /etc/yum.repos.d/remi.repo.tmp | |
# move again | |
mv /etc/yum.repos.d/remi.repo.tmp /etc/yum.repos.d/remi.repo | |
# Update yum | |
yum update -y | |
#finished | |
echo "EPEL and REMI Repositories installed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment