# -*- coding: utf-8 -*- Download net install iso. Find a mirror close to you at http://isoredirect.centos.org/centos/6/isos/x86_64/ h2. Create a new VirtualBox machine - Name: vagrant-centos - Operating System: Linux - Version: Red Hat 64bit - Base Memory Size: 768 Mb - Dynamically expanding hard disk: 40Gb - Disable Audio - Disable USB - Make sure network is set to NAT - Attach the net install ISO to the CDROM so it can boot h2. Run through install procedure - Install system - Skip verification - Installation Method: HTTP - Disable IPv6, leave IPv4 enabled with DHCP - HTTP Setup: - URL: http://mirror.centos.org/centos/6/os/x86_64/ - Initialize drive and erase data: yes - Configure network: yes - Set hostname to vagrant-centos - Root password: vagrant - Select minimal setup (click continue, this will take a while) - Remove CDRom media - Reboot - Disable firewall h2. Dependencies h3. Basic - yum install curl ftp rsync sudo time wget which git-core h3. VirtualBox additions - yum install gcc bzip2 make kernel-devel-`uname -r` - From the menu: Devices -> Install Guest Additions... - sudo mount -o ro -t iso9660 /dev/cdrom /mnt - sudo sh /mnt/VBoxLinuxAdditions.run - Will complain about X related drivers we didn't install. Should be fine. - If you need to recompile, run this within the VM /etc/init.d/vboxadd setup and then vagrant reload h3. NFS - yum install nfs-utils - chkconfig rpcbind on - chkconfig nfslock on h3. Ruby - yum install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel h2. Users h3. Add vagrant - groupadd admin - useradd -G admin vagrant - passwd vagrant # choose "vagrant" as the password h3. visudo - Add the following lines at the bottom: # Vagrant user should be able to sudo %admin ALL=NOPASSWD: ALL - Comment out the following line: # Defaults requiretty # (otherwise ssh <command> doesn't work) # Add the variable "PATH" to the "Defaults env_keep" list, otherwise sudo cleans the path, and loses ruby, which ohai needs # Add the /usr/sbin and /sbin to the path echo 'export PATH=$PATH:/usr/sbin:/sbin' >> ~vagrant/.bashrc h2. Enable NFS support ... h2. Install RVM, Ruby 1.9.2-p290 and Chef - bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) - source .bash_profile - rvm install 1.9.2-p290 - rvm default 1.9.2 - rvm use 1.9.2 - gem install chef --no-ri --no-doc h2. Add Vagrant's "insecure" public key h2. As user vagrant mkdir .ssh chmod 755 .ssh curl https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub > .ssh/authorized_keys chmod 644 .ssh/authorized_keys h2. Clean up - sudo yum clean headers packages dbcache expire-cache - halt h2. Export and package Follow instructions on http://vagrantup.com/docs/base_boxes.html