Skip to content

Instantly share code, notes, and snippets.

@akiatoji
Created June 6, 2012 17:45
Show Gist options
  • Save akiatoji/2883519 to your computer and use it in GitHub Desktop.
Save akiatoji/2883519 to your computer and use it in GitHub Desktop.
CentOS 6.2 Box for Vagrant

Installing CentOS

Download net install iso: CentOS-6.2-x86_64-netinstall.iso

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: URL
  • Disable IPv6, leave IPv4 enabled with DHCP
  • URL Setup:
  • Use text mode
  • Re-initialize all drives
  • Root password: vagrant
  • Partitioning Type: Use entire drive
  • Configure network: yes
    • Set hostname to vagrant-centos
  • 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 openssh-clients

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

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

yum install perl Xorg

Disabled SELinux and firewall

  • In /etc/selinux/config, set SELINUX=disabled
  • chkconfig iptables off

Remove stuff

VirtualBox Additions

  • export KERN_DIR=/usr/src/kernels/2.6.32-220.17.1.el6.x86_64
  • Devices -> Install Guest Additions…
  • sudo mount -o ro -t iso9660 /dev/cdrom /mnt
  • sudo sh /mnt/VBoxLinuxAdditions.run
  • reboot

vagrant user

groupadd admin useradd -G admin vagrant passwd vagrant

visudo

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

Install rvm then ruby

curl -L get.rvm.io | sudo bash -s stable logout login as root rvm install 1.9.2

Install Puppet by adding puppet repo

rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-1.noarch.rpm yum install puppet

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

Back on host

  • vagrant package –base vbox_vm_name
  • vagrant box add centos62 package.box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment