Skip to content

Instantly share code, notes, and snippets.

@gregburek
Created January 12, 2012 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregburek/1603445 to your computer and use it in GitHub Desktop.
Save gregburek/1603445 to your computer and use it in GitHub Desktop.
CentOS Box for Vagrant

Installing CentOS

Notes

These instructions install ruby and rubygems from source, not from RPMs. For instructions on installing from RPMs, look at something like http://wiki.opscode.com/display/chef/Installation+on+RHEL+and+CentOS+5+with+RPMs or http://mykestubbs.com/blog/2010/03/chef-installation-on-centos-54.html

Create a new VirtualBox machine

  • Name: vagrant-centos
  • Operating System: Linux
  • Version: Red Hat
  • Base Memory Size: 360 MB
  • Create new hard disk
  • Dynamically expanding storage
  • 40 GB
  • Disable Audio
  • Disable USB
  • Make sure network is set to NAT
  • Attach the net install ISO to the CDROM
  • Run it

Run through install procedure

  • (mode: linux text)
  • Installation Method: HTTP
  • Disable IPv6, leave IPv4 enabled with DHCP
  • HTTP Setup:
    • Web site name: mirrors.kernel.org
    • CentOS directory: /centos/5.4/os/i386
  • Use text mode
  • Initialize drive and erase data: yes
  • Configure network: yes
    • Set hostname to vagrant-centos
  • Root password: vagrant
  • Customize software installation:
    • Unselect:
      • Dial-up networking
      • Editors
      • Text-based internet
      • Base
  • Remove CDRom media
  • Reboot
  • Disable firewall
  • Run Services:
    • Disable cups

Add stuff

yum install curl ftp rsync sudo time wget which

yum install gcc bzip2 make kernel-devel-`uname -r`

yum install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel

Remove stuff

yum erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts

VirtualBox Additions

  • Devices -> Install Guest Additions…
  • sudo mount -o ro -t iso9660 /dev/cdrom /mnt
  • sudo sh /mnt/VBoxLinuxAdditions.run
  • Error about Xwindows install - should be okay (?)

vagrant user

groupadd admin useradd -G admin vagrant passwd vagrant

visudo

echo ‘export PATH=$PATH:/usr/sbin:/sbin’ >> ~vagrant/.bashrc

Log out as root, log in as vagrant

Add yum sources for most recent released version of chef and ruby available through elff the

and epel repos rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm rpm -Uvh http://download.elff.bravenet.com/5/i386/elff-release-5-3.noarch.rpm

Install chef

yum –enablerepo=elff-testing install chef

Add Vagrant’s “insecure” public key

mkdir .ssh chmod 755 .ssh curl http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub > .ssh/authorized_keys chmod 644 .ssh/authorized_keys

Fiddle with MAC addres

  • sudo /sbin/ifconfig
  • write down MAC address of eth0 (eg. 08:00:27:60:AE:41)

sudo yum clean headers packages dbcache expire-cache

  • shut down vm

Export and package

Follow instructions on http://vagrantup.com/docs/base_boxes.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment