Vagrant is an incredibly useful way to manage and control development setups, it allows you to define a base box and install extras in a repeatable manor.
With this as a starting point, you may find you want to configure your own base box and export it ready for Vagrant. To do this, a few steps need to be performed to the machine before it can be used.
Set up the Vagrant User
Install sudo, add the user and set the password to vagrant.
yum install -y sudo
useradd -m -G wheel vagrant
Next we are allowing the vagrant user passwordless sudo access.
echo "vagrant ALL=(ALL) ALL" >> /etc/sudoers
echo "%wheel ALL=NOPASSWD: ALL" >> /etc/sudoers
echo 'Defaults env_keep="SSH_AUTH_SOCK"' >> /etc/sudoers
Finally comment out the line “Defaults requiretty” in /etc/sudoers
Include the Vagrant SSH Key
curl -L https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub > ~vagrant/.ssh/authorized_keys
chown -R vagrant:wheel ~vagrant/.ssh
chmod 0700 ~vagrant/.ssh
chmod 0600 ~vagrant/.ssh/authorized_keys
Export the Box
yum clean all
cat /dev/null > ~/.bash_history
Shutdown the box, then we’ll export externally
shutdown -h now
vagrant package --base "My Dev Box"