Getting ready for Puppet
Although Puppet is inherently cross-platform and works with many different operating systems, for the purposes of this book, I'm going to focus on just one operating system, namely the Ubuntu 16.04 LTS distribution of Linux, and the most recent version of Puppet, Puppet 5. However, all the examples in the book should work on any recent operating system or Puppet version with only minor changes.
You will probably find that the best way to read this book is to follow along with the examples using a Linux machine of your own. It doesn't matter whether this is a physical server, desktop or laptop, cloud instance, or a virtual machine. I'm going to use the popular Vagrant software to run a virtual machine on my own computer, and you can do the same. The public GitHub repository for this book contains a Vagrantfile, which you can use to get up and running with Puppet in just a few steps.
Installing Git and downloading the repo
To get a copy of the repo that accompanies this book, follow these steps:
- Browse to https://git-scm.com/downloads
- Download and install the right version of Git for your operating system.
- Run the following command:
git clone https://github.com/bitfield/puppet-beginners-guide-3.git
Installing VirtualBox and Vagrant
If you already have a Linux machine or cloud server you'd like to use for working through the examples, skip this section and move on to the next chapter. If you'd like to use VirtualBox and Vagrant to run a local virtual machine (VM) on your computer to use with the examples, follow these instructions:
- Browse to https://www.virtualbox.org/
- Download and install the right version of VirtualBox for your operating system
- Browse to https://www.vagrantup.com/downloads.html
- Select the right version of Vagrant for your operating system: OS X, Windows, and so on
- Follow the instructions to install the software
Running your Vagrant VM
Once you have installed Vagrant, you can start the Puppet Beginner's Guide virtual machine:
- Run the following commands:
cd puppet-beginners-guide-3 scripts/start_vagrant.sh
Vagrant will begin downloading the base box. Once that has booted, it will install Puppet. This may take a while, but once the installation is complete, the virtual machine will be ready to use.
- Connect to the VM with the following command:
vagrant ssh
- You now have a command-line shell on the VM. Check that Puppet is installed and working by running the following command (you may get a different version number, which is fine):
puppet --version 5.2.0
Tip
If you're using Windows, you may need to install the PuTTY software to connect to your VM. There is some helpful advice about using Vagrant on Windows at:
http://tech.osteel.me/posts/2015/01/25/how-to-use-vagrant-on-windows.html
Troubleshooting Vagrant
If you have any problems running the VM, look for help on the VirtualBox or Vagrant websites. In particular, if you have an older machine, you may see a message like the following:
VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.
Your computer may have a BIOS setting to enable 64-bit hardware virtualization (depending on the manufacturer, the trade name for this is either VT-x or AMD-V). Enabling this feature may fix the problem. If not, you can try the 32-bit version of the Vagrant box instead. Edit the file named Vagrantfile
in the Git repository, and comment out the following line with a leading #
character:
config.vm.box = "ubuntu/xenial64"
Uncomment the following line by removing the leading #
character:
# config.vm.box = "ubuntu/xenial32"
Now re-run the scripts/start_vagrant.sh
command.