Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Puppet 3 Cookbook

You're reading from   Puppet 3 Cookbook An essential book if you have responsibility for servers. Real-world examples and code will give you Puppet expertise, allowing more control over servers, cloud computing, and desktops. A time-saving, career-enhancing tutorial

Arrow left icon
Product type Paperback
Published in Aug 2013
Publisher Packt
ISBN-13 9781782169765
Length 274 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
John Arundel John Arundel
Author Profile Icon John Arundel
John Arundel
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Puppet 3 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Puppet Infrastructure 2. Puppet Language and Style FREE CHAPTER 3. Writing Better Manifests 4. Working with Files and Packages 5. Users and Virtual Resources 6. Applications 7. Servers and Cloud Infrastructure 8. External Tools and the Puppet Ecosystem 9. Monitoring, Reporting, and Troubleshooting Index

Installing Puppet


If you already have a working Puppet installation, you can skip this section. If not, or if you want to upgrade or re-install Puppet, we'll go through the installation process step by step.

I'm using an Amazon EC2 cloud instance to demonstrate setting up Puppet, though you may prefer to use a physical server, a Linux workstation, or a virtual machine such as Vagrant, VMWare, or VirtualBox (with Internet access). I'll log in as the ubuntu user and use sudo to run commands that need root privileges (the default setup on Ubuntu).

Note

On EC2 Ubuntu images, the ubuntu user is already set up with the sudo permissions to run any commands as root. If you're using a different Linux distribution or you're not on EC2, you'll need to configure this yourself in the /etc/sudoers file.

Getting ready...

To prepare the machine for Puppet, we need to set its hostname.

  1. Set a suitable hostname for your server (ignore any warning from sudo):

    ubuntu@domU-12-31-39-09-51-23:~$ sudo hostname cookbook
    ubuntu@domU-12-31-39-09-51-23:~$ sudo su -c 'echo cookbook
      >/etc/hostname'
    sudo: unable to resolve host cookbook
    
  2. Log out and log back in to check the hostname is now correctly set:

    ubuntu@cookbook:~$
    
  3. Find out the local IP address of the server:

    ubuntu@cookbook:~$ ip addr show |grep eth0
        inet 10.96.247.132/23 brd 10.96.247.255 scope global eth0 
    
  4. Copy the IP address of your server (here it's 10.96.247.132) and add this to the /etc/hosts file so that it looks something like this (use your own hostname and domain):

    10.96.247.132 cookbook cookbook.example.com
    

How to do it...

Puppet packages for most Linux distributions, including Ubuntu, are available from Puppet Labs. Here's how to install the version for Ubuntu 12.04 Precise:

  1. Download the Puppet Labs repo package:

    ubuntu@cookbook:~$ wget http://apt.puppetlabs.com/puppetlabs-
      release-precise.deb
    
  2. Install the repo package:

    ubuntu@cookbook:~$ sudo dpkg -i puppetlabs-release-precise.deb
    Selecting previously unselected package puppetlabs-release.
    (Reading database ... 33975 files and directories currently 
      installed.)
    Unpacking puppetlabs-release (from puppetlabs-release-
        precise.deb)
    Setting up puppetlabs-release (1.0-5)
    
  3. Update your APT configuration:

    ubuntu@cookbook:~$ sudo apt-get update
    

    Note

    If you're not using Ubuntu 12.04 Precise, you can find out how to add the Puppet Labs repos package to your system here:

    http://docs.puppetlabs.com/guides/puppetlabs_package_repositories.html

  4. Install Puppet:

    ubuntu@cookbook:~$ sudo apt-get -y install puppet
    

    Note

    If you're on Mac, you can download and install suitable DMG images from Puppet Labs available at:

    https://downloads.puppetlabs.com/mac/

    If you're using Windows, you can download MSI packages from the Puppet Labs website available at:

    https://downloads.puppetlabs.com/windows/

  5. Run the following command to check that Puppet is properly installed:

    ubuntu@cookbook:~$ puppet --version
    3.2.2
    

If the version of Puppet you've installed is not exactly the same, it doesn't matter; you'll get whatever is the latest version made available by Puppet Labs. So long as your version is at least 3.0, you should have no trouble running the examples in this book.

If you have an older version of Puppet, you may find that some things don't work or work differently to the way you'd expect. I recommend that you upgrade to Puppet 3.x or later if at all possible.

Now that Puppet is set up, you can use it to make some configuration changes by creating a manifest. We'll see how to do this in the next section.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime