Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save danidiaz/5b87e8402c2ce1ad5629 to your computer and use it in GitHub Desktop.

Select an option

Save danidiaz/5b87e8402c2ce1ad5629 to your computer and use it in GitHub Desktop.
#! /bin/bash
# http://linuxcommand.org/wss0150.php
function error_exit
{
echo "$1" 1>&2
exit 1
}
if [ `whoami` = root ]; then
echo `ip addr show eth0 | grep 'inet ' | awk '{ print $2 }' | cut -d/ -f1` `hostname` >> /etc/hosts
# Necessary to allow X11 forwarding in Docker containers
echo 'X11UseLocalhost no' >> /etc/ssh/sshd_config
yum update -y
yum update -y kernel
# http://wiki.centos.org/Manuals/ReleaseNotes/CentOSMinimalCD6.5
# http://serverfault.com/questions/349993/virtualbox-centos-no-eth0
# https://www.virtualbox.org/manual/ch04.html
# http://wiki.centos.org/HowTos/Virtualization/VirtualBox/CentOSguest
# http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
curl -L -O http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
yum install -y dkms
yum install -y gcc make kernel-devel
yum groupinstall -y "Development Tools" \
--exclude=alsa-lib \
--exclude=libgcj \
--exclude=gettext \
--exclude=gettext-devel \
--exclude=intltool \
--exclude=gcc-gfortran \
--exclude=libgfortran \
--exclude=cvs \
--exclude=git \
--exclude=subversion || error_exit "ERROR: Devel-tools"
# *after installing guest additions*
# https://www.centos.org/forums/viewtopic.php?t=8026
mkdir --parents /media/cdrom
mount -t iso9660 /dev/cdrom /media/cdrom/ || error_exit "ERROR: GA"
cd /media/cdrom/
./VBoxLinuxAdditions.run
cd $HOME
umount /dev/cdrom || error_exit "ERROR: GA"
modinfo vboxguest vboxsf vboxvideo || error_exit "ERROR: GA"
cat /var/log/vboxadd-install.log
# https://www.virtualbox.org/manual/ch04.html#sf_mount_manual
# Needed to allow X11 forwarding
yum -y install xorg-x11-xauth xeyes
# docker
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm || error_exit "ERROR: EPEL"
yum -y install docker-io
service docker start
chkconfig docker on
# docker pull centos:latest
elif [ `whoami` = paquito ]; then
echo "empty for now"
else
echo "Should not be here!!!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment