Skip to content

Instantly share code, notes, and snippets.

@larkmullins
Last active August 29, 2015 14:10
Show Gist options
  • Save larkmullins/38adba04fb8fbdb08db9 to your computer and use it in GitHub Desktop.
Save larkmullins/38adba04fb8fbdb08db9 to your computer and use it in GitHub Desktop.
ARTICLE[12-03-2014]: Build a CentOS 7 Vagrant Base Box

Building a Vagrant base box can be time consuming and at times maddening when trying to get everything to work. If you stick with it though you can tailor your development box exactly like your production systems.

Create new VM in Virtualbox
Create the VM with the following settings:

  • Disable USB
  • Disable Audio
  • Network Adaptor - NAT
    • Port Forwarding: SSH Host Port: 2222 Guest Port: 22

Install CentOS 7

  • Set root user password to: vagrant
  • Create Vagrant user: vagrant/vagrant

Install Guest Additions

rpm -Uvh http://ftp.linux.ncsu.edu/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
yum install -y gcc kernel-devel kernel-headers dkms make bzip2 perl
shutdown -r now
mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
cd /media/VirtualBoxGuestAdditions
./VBoxLinuxAdditions

Install needed packages for vagrant

  • yum install -y openssh-clients wget curl ntp

Turn on SSHD and NTPD

  • systemctl enable sshd.service
  • systemctl enable ntpd.service

Turn off iptables

  • systemctl disable iptables.service
  • systemctl disable ip6tables.service

Comment out Defaults requiretty in /etc/sudoers

Add vagrant to /etc/sudoers file

  • vagrant ALL=(ALL) NOPASSWD: ALL

Set selinux to permissive Download vagrant public key

Shutdown VM

  • shutdown -h now

Package vagrant box

  • vagrant package --output centos7.box --base vagrant-centos7

Sources
http://www.hostedcgi.com/how-to-create-a-centos-7-0-vagrant-base-box/
http://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/

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