Skip to content

Instantly share code, notes, and snippets.

@nemonik
Created December 8, 2011 20:59
Show Gist options
  • Save nemonik/1448556 to your computer and use it in GitHub Desktop.
Save nemonik/1448556 to your computer and use it in GitHub Desktop.
My CentOS-5.7-x86_64 Basebox Template
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '384',
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :ioapic => 'on', :pae => 'on',
:os_type_id => 'RedHat_64',
:iso_file => "CentOS-5.7-x86_64-bin-DVD-1of2.iso",
:iso_src => "http://mirror.steadfast.net/centos/5.7/isos/x86_64/CentOS-5.7-x86_64-bin-DVD-1of2.iso",
:iso_md5 => "55eadec0a6e87c5f2883f734d43fdb58",
: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
})
# Kickstart file automatically generated by anaconda.
install
cdrom
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 --utc America/New_York
bootloader --location=mbr --driveorder=sda
# 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 --initlabel --drives=sda
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=512 --grow --maxsize=1024
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
reboot
%packages
#@admin-tools
#@authoring-and-publishing
#@base
#@cluster-storage
#@clustering
@core
#@dns-server
#@development-libs
#@development-tools
#@dialup
#@editors
#@emacs
#@engineering-and-scientific
#@ftp-server
#@java
#@java-development
#@legacy-network-server
#@legacy-software-development
#@legacy-software-support
#@mail-server
#@mysql
#@network-server
#@news-server
#@office
#@openfabrics-enterprise-distribution
#@sql-server
#@printing
#@ruby
#@server-cfg
#@sound-and-video
#@system-tools
#@text-internet
#@xen
#@web-server
#@smb-server
#@x-software-development
#@base-x
#keyutils
#kexec-tools
#iscsi-initiator-utils
#trousers
#bridge-utils
#fipscheck
#device-mapper-multipath
#kmod-gnbd-xen
#kmod-gfs-xen
#python-suds
#perl-XML-SAX
#perl-Convert-ASN1
#perl-XML-NamespaceSupport
#python-imaging
#imake
#pexpect
#java-1.6.0-openjdk
#emacs
#vnc-server
#audit
#mesa-libGLU-devel
#xorg-x11-server-Xnest
#xorg-x11-server-Xvfb
date > /etc/vagrant_box_build_time
fail()
{
echo "FATAL: $*"
exit 1
}
# add EPEL software repository for CentOS 5
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# add RPMforge software repository for CentOS 5
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
cd /tmp
wget http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
rm rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
#cat > /etc/yum.repos.d/srpm.repo <<DELIM
#[centos-src]
#name=CentOS $releasever - $basearch - Source
#baseurl=http://vault.centos.org/5.7/os/SRPMS/
#gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#DELIM
# add packages needed to build the base
echo "Installing needed packages..."
yum -y install gcc gcc-c++ patch libffi libffi-devel libyaml libyaml-devel intltool readline readline-devel zlib zlib-devel openssl-devel make bzip2 autoconf automake libtool bison kernel-devel-`uname -r` sqlite-devel git-all
#Install my prefered editor
yum -y joe
#Install NFS client
yum install nfs-utils nfs-utils-lib
#yum -y remove wireless-tools
yum -y remove gtk2 libX11 hicolor-icon-theme freetype bitstream-vera-fonts
echo "Removing obsolete packages..."
yum -y upgrade
echo "Cleaning yum cache directory..."
yum -y clean metadata
yum -y clean all
# Setup sudo to allow no-password sudo for "vagrant"
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
sed -i "s/^\(.*env_keep = \"\)/\1PATH /" /etc/sudoers
#Install rvm, and latest ruby
echo "Installing rvm, and latest ruby..."
cd /tmp
curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer -o rvm-installer
chmod +x rvm-installer
./rvm-installer --version latest
#source /etc/profile.d/rvm.sh
rm -f rvm-installer
/usr/sbin/usermod -G rvm vagrant
su --login - vagrant -c 'rvm --default install 1.8.7'
#Install chef & Puppet
echo "Installing chef and puppet..."
/usr/sbin/useradd puppet
su --login - vagrant -c 'gem install chef --no-ri --no-rdoc' || fail "Could not install chef"
su --login - vagrant -c 'gem install puppet --no-ri --no-rdoc' || fail "Could not install puppet"
#Install vagrant keys
echo "Installing vagrant keys..."
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
#Install the virtualbox guest additions
echo "Installing 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
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
#poweroff -h
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment