Installing a Vagrant BaseBox of CentOS

  • Install a minimal system of CentOS in VirtualBox
  • Activate networking on boot by enabling eth0 in
    .
    .
    .
    ONBOOT=yes
    .
    .
    .
    
  • Add a vagrant user and assign the password vagrant to it
  • Give sudo rights to that user by adding vagrant ALL=(ALL) NOPASSWD: ALL with visudo
  • Disable requirement of having a TTY by commenting out the following settings with visudo:
    #Defaults    requiretty
    #Defaults   !visiblepw
  • Add insecure Vagrant public key from https://github.com/mitchellh/vagrant/blob/master/keys/vagrant.pub to vagrant’s authorized_keys
  • Add development tools for building the guest addons with
    yum --disablerepo=\* --enablerepo=c6-media install kernel-devel gcc make dkms perl

    The repo options are useful if you want to install from local installation media (ISOs) instead of fetching all from the net.

  • Install guest addons with
    ./VBoxLinuxAdditions.run --nox11
  • halt the machine
  • Remove all hardware that is not necessary from the base machine or else it will be available on the machines set up with Vagrant later!
  • Package Box with
    vagrant package --base Name-Of-Machine-In-VirtualBox

Done!

Should Vagrant be unable to connect to your boxes derived from that base box, you might have a problem with SELinux, see here how this can be fixed!