Permalink
Browse files

Created CentOS 5.8 64-bit vagrant box similar to the Centos 5.6 64-bi…

…t netinstall one
  • Loading branch information...
1 parent f49d2b3 commit 9396f667ca34180dbe7424ee43fcd1aa34fe2cad jed committed Jun 5, 2012
@@ -0,0 +1,16 @@
+Veewee::Session.declare({
+ :cpu_count => '2', :memory_size=> '512',
+ :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :ioapic => 'on', :pae => 'on',
+ :os_type_id => 'RedHat_64',
+ :iso_file => "CentOS-5.8-x86_64-netinstall.iso",
+ :iso_src => "http://mirror.atlanticmetro.net/centos/5.8/isos/x86_64/CentOS-5.8-x86_64-netinstall.iso",
+ :iso_md5 => "6425035e9adee4b8653a85f59877ac5b",
+ :iso_download_timeout => 1000,
+ :boot_wait => "10", :boot_cmd_sequence => [ 'linux text ks=http://%IP%:%PORT%/ks.cfg<Enter>' ],
+ :kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
+ :ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
+ :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
+ :shutdown_cmd => "/sbin/halt -h -p",
+ :postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
+})
@@ -0,0 +1,71 @@
+# Kickstart file automatically generated by anaconda.
+
+install
+url --url=http://mirror.atlanticmetro.net/centos/5.8/os/x86_64
+lang en_US.UTF-8
+langsupport --default=en_US.UTF-8 en_US.UTF-8
+keyboard us
+xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
+network --device eth0 --bootproto dhcp
+rootpw --iscrypted $1$vSG8FjAu$ekQ0grf16hS4G93HTPcco/
+firewall --enabled --trust eth0 --ssh
+selinux --enforcing
+authconfig --enableshadow --enablemd5
+timezone America/New_York
+bootloader --location=mbr
+# The following is the partition information you requested
+# Note that any partitions you deleted are not expressed
+# here so unless you clear all partitions first, this is
+# not guaranteed to work
+clearpart --all --drives=sda --initlabel
+part /boot --fstype ext3 --size=100 --ondisk=sda
+part pv.2 --size=0 --grow --ondisk=sda
+volgroup VolGroup00 --pesize=32768 pv.2
+logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=528 --grow --maxsize=1056
+logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
+reboot
+
+%packages --nobase --excludedocs
+coreutils
+findutils
+sudo
+sed
+yum
+rpm
+which
+e2fsprogs
+lvm2
+grub
+sysstat
+ntp
+curl
+wget
+patch
+openssh-server
+openssh-clients
+xorg-x11-xauth
+gcc
+bzip2
+make
+gcc-c++
+zlib-devel
+openssl-devel
+readline-devel
+patch
+man
+-dhcpv6-client
+-iptables-ipv6
+-rhpl
+nfs-utils
+nfs-utils-lib
+libevent
+libgssapi
+portmap
+
+%post
+# The installer apparently does not respect 'selinux' in a kickstart. Instead, we sed that shit.
+/bin/sed -i -e 's/\(^SELINUX=\)enforcing$/\1disabled/' /etc/selinux/config
+/usr/sbin/groupadd vagrant
+/usr/sbin/useradd vagrant -g vagrant -G wheel
+echo "vagrant"|passwd --stdin vagrant
+echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
@@ -0,0 +1,55 @@
+#http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
+
+date > /etc/vagrant_box_build_time
+
+fail() {
+ echo "FATAL: $*"
+ exit 1
+}
+
+# kernel source is needed for vbox additions
+yum -y install kernel-devel-`uname -r`
+yum -y clean all
+
+# Install ruby
+wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
+tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
+./ruby-enterprise-1.8.7-2010.02/installer -a /opt/ruby --no-dev-docs --dont-install-useful-gems
+echo 'PATH=$PATH:/opt/ruby/bin'> /etc/profile.d/rubyenterprise.sh
+
+# Install chef & Puppet
+echo " Install chef and puppet"
+/opt/ruby/bin/gem install chef --no-ri --no-rdoc || fail "Could not install chef"
+/opt/ruby/bin/gem install puppet --no-ri --no-rdoc || fail "Could not install puppet"
+
+# Install vagrant keys
+mkdir /home/vagrant/.ssh
+chmod 700 /home/vagrant/.ssh
+cd /home/vagrant/.ssh
+wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
+chown -R vagrant /home/vagrant/.ssh
+
+# Install the virtualbox guest additions
+VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
+cd /tmp
+wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
+mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
+sh /mnt/VBoxLinuxAdditions.run
+umount /mnt
+
+rm VBoxGuestAdditions_$VBOX_VERSION.iso
+
+# On startup, remove HWADDR from the eth0 interface.
+cp -f /etc/sysconfig/network-scripts/ifcfg-eth0 /tmp/eth0
+sed "/^HWADDR/d" /tmp/eth0 > /etc/sysconfig/network-scripts/ifcfg-eth0
+sed -e "s/dhcp/none/;s/eth0/eth1/" /etc/sysconfig/network-scripts/ifcfg-eth0 > /etc/sysconfig/network-scripts/ifcfg-eth1
+
+# Add kernel parameters to prevent excessive CPU stealing under virtualization.
+sed -e's/\tkernel .*/& notsc divider=10/' /boot/grub/grub.conf > /tmp/grub.conf
+mv /tmp/grub.conf /boot/grub/grub.conf
+
+sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
+sed -i "s/^\(.*env_keep = \"\)/\1PATH /" /etc/sudoers
+
+exit
+

0 comments on commit 9396f66

Please sign in to comment.