IMPORTANT: CentOS 7.5 is the final version that I will be building of this AMI. Moving forward, my VM-building efforts will be going primarily into Amazon Linux 2.
Building Vagrant images based on CentOS 7.5 (minimal install). All instructions were tested against macOS 10.13 “High Sierra”, VMware Fusion 10, VirtualBox 5.1, and Parallels Desktop 11.
If your intention is only to use one of these CentOS 7.5 images, you can open your Vagrantfile and set:
config.vm.box = "skyzyx/centos7"CentOS is a very good, very stable, very reliable server OS. It is essentially an all-open-source version of Red Hat Enterprise Linux.
The flip side is that sometimes we can end up with an older set of packages than we might prefer, which is why I maintain this particular Vagrant box.
By leveraging centos7-repos, we can maintain modern software — securely — on a more conservative OS.
These images are based on a minimal install of CentOS 7.5. On top of that base installation, we install the following:
- We write the image's build time to
/etc/vagrant_box_build_time. - Disable SELinux.
- Configure
ntpto speak totime.nist.gov, and set the timezone to UTC. - Make SSH more secure by forcing Protocol 2 and disabling
rootlogin. - Disable all default
yumupdates. - Remove ancient PHP and Maria DB libs.
- Add
/usr/local/binto the$PATHby default. - Enable all
yumrepositories from centos7-repos. - Install the Development Tools
yumgroup. - Install modern cURL, which can speak HTTP/2, TLS 1.1, and TLS 1.2.
- Install updates to OpenSSL, strace, htop, nano, vi, and a number of other core packages.
- Install modern VMware Tools and/or VirtualBox tools.
- Allow user Vagrant to use
sudowithout entering a password.
- Packer 1.1.2 or newer.
- VirtualBox, for building the VirtualBox Vagrant box.
- vagrant-vbguest plug-in to keep VirtualBox tools up-to-date.
- VMware Fusion, for building the VMware Vagrant box.
- Vagrant Provider for VMware plug-in to enable Vagrant to use VMware as a provider.
- Parallels Desktop, for building the Parallels Vagrant box.
- Parallels Virtualization SDK for Mac so that your Mac can talk to Parallels through Vagrant.
- vagrant-parallels plug-in to enable Vagrant to use Parallels as a provider.
- vagrant-cachier plug-in to enable caching of
yumpackages. - vagrant-hostsupdater plug-in to automatically updated your hosts file.
This is simply a good thing to do from time to time.
vagrant plugin updateI'm going to assume that you have already:
- Installed Vagrant and its dependencies.
- Installed (and paid for) the virtualization software of your choice.
You have two choices for installing Packer.
-
If you already have the Homebrew package manager installed, you can simply do:
brew install packer
-
Otherwise, you can manually install it from https://www.packer.io/downloads.html.
See “Install Packer” for more information.
This template has built-in support for VirtualBox, VMware, and Parallels Desktop. You can build everything at the same time (assuming you have the relevant prerequisites installed) with:
packer build template.jsonIf you only want to build one particular Vagrant box, you can use the --only flag.
# VMware
packer build --only=vmware-iso template.json
# VirtualBox
packer build --only=virtualbox-iso template.json
# Parallels
packer build --only=parallels-iso template.json