Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Puppet for Windows Server

You're reading from   Learning Puppet for Windows Server Organize your Windows environment using Puppet tools to unload administrative burdens in a short time!

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher Packt
ISBN-13 9781785281877
Length 234 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Fuat Ulugay Fuat Ulugay
Author Profile Icon Fuat Ulugay
Fuat Ulugay
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Installing Puppet Server and Foreman FREE CHAPTER 2. Installing Puppet Agents 3. Your First Modules 4. Puppet Forge Modules for Windows 5. Puppet Facts, Functions, and Templates 6. Using Puppet for Windows Security 7. Reporting and Monitoring 8. Installing Software and Updates Index

Installing Puppet Server

We will start with the installation of the operating system of the Puppet Server. From now on, the Puppet Server will be called Puppet Master. We will use the Ubuntu server 14.04 LTS. Some users may prefer Enterprise Linux such as Red Hat or CentOS. If you prefer another flavor of Linux, this is also fine. Following are the server requirements. The requirements are fine for 500 to 1000 nodes. These requirements will change according to the number of your nodes:

  • Ubuntu Server 14.04 LTS
  • At least 4 GB RAM
  • At least 2 Core CPU
  • At least 40 GB of hard disk space

You can download the Ubuntu Server 14.04 LTS ISO from http://www.ubuntu.com/download/server. Using Long Term Support (LTS) versions, ensure that you do not have to upgrade your server for a long time and that there will be few issues about upgrading the distribution. If you want to test it first locally on your computer, you can also download and install VirtualBox from https://www.virtualbox.org/wiki/Downloads. All the examples in this book have been created in VirtualBox.

You should have a new installation with the OpenSSH server. We will use SSH to connect to the server.

Connecting your server with SSH

We will use SSH to connect to our server. The installation is very easy. You can use the following command to install:

$ sudo apt-get install ssh -y
  • sudo: This enables you to run a command with root privileges.
  • apt-get: The APT package handling utility is used to install and uninstall software.
  • install: This option is used with apt-get to install a package.
  • ssh: This is the ssh server package name that will be installed.
  • -y: The apt-get installation asks, "Do you want to continue [Y/n]?". This flag gives the answer as yes and the command runs without interruption.

If you use Windows as your operating system, you can connect using PuTTY. Download this from the link http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.

If you use Linux, you can connect from the terminal by the ssh command. For example,

$ sshusername@serverip

From now on, we will use ssh to connect to our server.

Installing Puppet

Puppet installation usually follows the following steps:

  • Set the hostname
  • Set FQDN
  • Set the static IP, gateway and DNS
  • Add the Puppet repositories
  • Install Puppet

Let's have a look at each of them.

Setting the hostname

I will use puppetmaster as the hostname. You can use either vim or nano for text editing. If you have never used vim before, it will be easier for you to use nano.

$ sudonano /etc/hostname
  • sudo: For configuration changes, we will need the root privileges. If we do not run the command with sudo, we cannot save our changes to the configuration file.
  • nano: This is the command to run the nano text editor.
  • /etc/hostname: This is the filename for the hostname configuration.
    Setting the hostname

Use CTRL + X and Y to save.

Setting FQDN

I will use puppetmaster.example.com.. Use the following command to edit the /etc/hosts file:

 $ sudonano /etc/hosts

Change the contents as follows. Use your own IP according to your network.

127.0.0.1       localhost
127.0.1.1       puppetmaster.example.com
10.10.10.10      puppetmaster.example.com puppetmaster

To verify that the changes are effective, use the hostname and hostname -f commands.

Setting FQDN

Note

You also need to add the IP and fully qualified domain name (FQDN) to your company DNS, so that the other computers can find your server. I assume that, as a Windows system administrator, you already know how to do this. The IPs used here may not suit your network and IP ranges, so please change all the IP details throughout the book according to your needs.

Setting static IP, gateway, and DNS

For your server, give a static IP and define your gateway and nameserver IPs.

First, define your IP gateway and subnet mask. For this, we will edit the /etc/network/interfaces file. Following is the sample detail I have added for my Puppet Master:

$ sudonano /etc/network/interfaces
Setting static IP, gateway, and DNS

As you can see, the details are self-explanatory:

  • eth0: This is the network interface name
  • address: This is your server's IP
  • netmask: This is the subnetmask
  • broadcast: This is the broadcast IP
  • gateway: This is the gateway IP

Now, let's set the nameserver IPs. To set NS records, we need to edit /etc/resolvconf/resolv.conf.d/base, as follows:

$ nano /etc/resolvconf/resolv.conf.d/base

The sample contents of this file are shown in the following screenshot. In our example, we are using the Google DNS IPs. Here, you can use your company's DNS IPs.

Setting static IP, gateway, and DNS

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

After saving the file, reboot the server. After rebooting, you can check using the following command whether you have the correct IP, netmask, and broadcast:

$ ifconfig
  • ifconfig: This command is used to get info and make the changes in the network interfaces
  • eth0: This is the network interface name
  • inet addr:10.10.10.10: This is the IP address of our server
  • Bcast:10.10.10.255: This is the broadcast IP
  • Mask:255.255.255.0: This is the netmask IP
Setting static IP, gateway, and DNS

Check whether the gateway is correct using the following command:

$ route -n
  • route: This command shows and manipulates the IP routing table
  • -n: This flag is to show the address details in numeric format instead of hostnames
    Setting static IP, gateway, and DNS

Lastly, check whether nameserver works correctly. Run the nslookup command and enter any address, as follows:

$ nslookup
  • nslookup: This is the command to interactively query the Internet names servers. If no nameserver is provided, this will use the default one.
  • google.com: When we enter any hostname, this will provide the details about it
  • exit: This command ends nslookup
    Setting static IP, gateway, and DNS

As you can see in the preceding screenshot, it checks from 8.8.8.8. Now we can say that our network settings are correct. To exit nslookup, you can use the exit command.

Adding the Puppet repositories

We will first add the Puppet repositories for installation. Secondly, we will update the repositories. Lastly, we will update our server before installing Puppet.

Here are the details to add the Puppet repositories:

$ sudowget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
$ sudodpkg -ipuppetlabs-release-trusty.deb
  • wget: This is a utility for non-interactive downloads of files from the Web. We use this here to download the puppetlabs-release-trusty.deb file.
  • dpkg: This is the package manager for Linux Debian. The option -i is used for installation.

Now, update the repository info, as follows:

$ sudo apt-get update

Lastly, install the updates, as follows:

$ sudo apt-get upgrade -y
  • update: This option is used to resynchronize the package index files from their resources
  • upgrade: This option is used to upgrade to the newest version of the already installed software

Installing Puppet

Now, it is time to install Puppet Master and its agent on your server. We will also do some configurations. The command to install Puppet is as follows:

$ sudo apt-get install -y puppetmaster puppet

Now, let's make sure that Puppet Master starts automatically. For this purpose, we need to edit /etc/default/puppetmaster. You need to change the START=no value to START=yes. If it is already yes, you can leave this as it is and continue. You also need to enable puppet agent on the server. We will edit the /etc/default/puppet file. Again, we need to make sure that START=yes exists. We also need to change the server details for the puppet agent. Change the /etc/puppet/puppet.conf file and enter the server details. Just after [main], add the line server=puppetmaster.example.com.

Installing Puppet

After making the changes, we will restart the services as shown here:

$ sudo service puppetmaster restart
$ sudo service puppet restart

Check whether they are running using the following commands:

$ sudo service puppetmaster status
$ sudo service puppet status
Installing Puppet

As you can see in the preceding screenshot, the services are running without any problem. So we completed the installation of Puppet Master and Puppet agent on our server.

You have been reading a chapter from
Learning Puppet for Windows Server
Published in: Aug 2015
Publisher: Packt
ISBN-13: 9781785281877
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 $19.99/month. Cancel anytime
Banner background image