Created
March 29, 2011 22:55
-
-
Save mhorbul/893526 to your computer and use it in GitHub Desktop.
postinstall.sh script for building CentOS 5.5 vagrant box with RVM
This file contains 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
rpm -Uvh --force --nosignature --nodigest http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm | |
rpm -Uvh --force --nosignature --nodigest http://download.elff.bravenet.com/5/i386/elff-release-5-3.noarch.rpm | |
yum install -y curl ftp rsync sudo time wget which git-core | |
yum install -y gcc bzip2 make kernel-devel-`uname -r` | |
yum install -y gcc-c++ zlib-devel openssl-devel readline-devel | |
yum erase -y wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts | |
service vboxadd status 2>&1 >> /dev/null | |
if [ $? -eq 1 ]; then | |
mount -o ro -t iso9660 /dev/cdrom /mnt | |
sh /mnt/VBoxLinuxAdditions.run | |
umount /dev/cdrom | |
fi | |
groupadd admin | |
useradd -p vagrant vagrant | |
usermod -G admin vagrant | |
grep '%admin' /etc/sudoers | |
if [ $? -eq 1 ]; then | |
cat >>/etc/sudoers <<\EOF | |
%admin ALL=(ALL) NOPASSWD:ALL | |
EOF | |
fi | |
cat >> /home/vagrant/.bashrc <<\EOF | |
export PATH=$PATH:/usr/sbin:/sbin | |
EOF | |
cd /home/vagrant | |
mkdir -p .ssh | |
chmod 700 .ssh | |
curl -L http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub > .ssh/authorized_keys | |
chmod 400 .ssh/authorized_keys | |
chown vagrant -R .ssh | |
cd | |
# We are going to install chef via RVM running Ruby | |
#yum –enablerepo=elff-testing install chef | |
[[ -s '/usr/local/lib/rvm' ]] || bash <( curl -L https://github.com/wayneeseguin/rvm/raw/1.3.0/contrib/install-system-wide ) --version '1.3.0' | |
cat > /etc/profile.d/rvm.sh <<\EOF | |
[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm' | |
EOF | |
source '/usr/local/lib/rvm' | |
rvm use 1.9.2 --install --default | |
rvm default exec gem install chef --no-ri --no-rdoc | |
usermod -G admin,rvm vagrant | |
yum clean headers packages dbcache expire-cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment