I recently needed to create a new CentOS 7 base box for Vagrant using VirtualBox. Since I ran into some road bumps, here is a short list of them and how I managed to overcome them:
It is recommended to install dkms before installing the VB GuestAdditions to avoid having to recompile after a kernel update. dkms is not in the centos repos, but can be found in the rpmforge repositories. However there is no rpmforge for CentOS7. I used EPEL instead, which has a repo for CentOS7 and also contains dkms.
I use Linux Mint 17 as the Host, which currently has VirtualBox version 4.3.12 in the repo. I create a fresh machine and installed CentoOS 7 from the Minimal ISO. When I tried to install the Virtualbox Guest additions (which are required for Vagrant) I got the following error:
./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.3.12 Guest Additions for Linux............ VirtualBox Guest Additions installer Copying additional installer modules ... Installing additional modules ... Removing existing VirtualBox DKMS kernel modules [ OK ] Removing existing VirtualBox non-DKMS kernel modules [ OK ] Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module [FAILED] (Look at /var/log/vboxadd-install.log to find out what went wrong) Doing non-kernel setup of the Guest Additions [ OK ] Installing the Window System drivers Could not find the X.Org or XFree86 Window System, skipping.
When starting the box in Vagrant I got :
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p /vagrant Stdout from the command: Stderr from the command: sudo: sorry, you must have a tty to run sudo
Turns out I had to comment out
!visiblepw in the
file. (See this issue for details)