How To Install Foreman With Puppet In CentOS And Ubuntu

About Foreman

Foreman is an open source application that can be used to manage, provision, configure, and monitor a single or group of servers. Foreman smart proxy architecture allows you to automate repetitive tasks, quickly deploy applications, proactively manage change using configuration management systems such as Puppet, Chef and Salt. Foreman has an interactive and robust web front-end, API, CLI to manage, provision servers in private or public clouds.

Using Foreman, we can:

  • Discover, provision and upgrade your IT infrastructure
  • Create and manage instances both in private and public clouds
  • Group your hosts and manage them in bulk, regardless of location
  • Review historical changes for auditing or troubleshooting
  • Extend as needed via a robust plugin architecture
  • Automatically build images (on each platform) per system definition to optimize deployment

Foreman will run on almost all modern Linux operating systems, such as:

  • RHEL / CentOS / Fedora / Oracle Enterprise Linux / Scientific Linux
  • SUSE/openSUSE
  • Debian/Ubuntu
  • CoreOS
  • JunOS

And, It can provision on physical as well as the following cloud providers, such as:

  • VMWare
  • Amazon EC2
  • Libvirt
  • OpenStack
  • oVirt and RHEV
  • Rackspace
  • Google Compute engine

Using Foreman, we can manage 10s to 10,000s of physical or virtual servers via a web browser.

About Puppet

Puppet is an open source configure management tool developed by Puppet Labs, founded by Luke Kanies in 2005. It is written in Ruby and released as free software under the GNU General Public License (GPL) until version 2.7.0 and the Apache License 2.0 after that. The main goal of Puppet is to simplify a system administrator’s work who manages a large scale IT infrastructure. Puppet can be used to manage the configuration of physical or virtual servers. With Puppet, you define the state of your IT infrastructure, and Puppet automatically enforces the desired state. Puppet automates every step of the software delivery process, from provisioning of physical and virtual machines to orchestration and reporting; from early-stage code development through testing, production release and updates.

Puppet comes as two flavors:

  1. Puppet Open Source Edition
  2. Puppet Community Edition

Puppet open source edition is free to use, and it helps system administrators to automate repetitive tasks easily. Enterprise edition has all the features of open source edition plus Puppet Apps, commercial-only enhancements, supported modules and integrations etc. Puppet will run almost all Unix-like systems, Microsoft Windows, and Solaris.

Well, I hope you have a basic knowledge of Fireman and Puppet utilities. Now, let us see how to install Foreman with Puppet in CentOS and Ubuntu.


I tested this tutorial in CentOS 7 and Ubuntu 14.04 systems, however these steps would be same to other distributions too. In case these steps didn’t work for you, I suggest you to refer the official Quickstart guide which I mentioned at the end of this tutorial.


Before installing Foreman, we need to do some important prerequisites which will help you to setup a proper Foreman. These steps needs to be run on both CentOS and Ubuntu.

First of all, make sure you have setup a proper FQDN for your server.

To do that, edit /etc/hosts:

Enter your FQDN as shown below.

Save and close the file. Like wise edit /etc/hostname and setup valid FQDN.

Save and close the file.

Install Foreman In CentOS 7

There are several different methods of installing Foreman. The recommended way is with the puppet based Foreman Installer but you may also use your distribution’s package manager or install directly from source. Let us proceed with Foreman installer.

The Foreman installer is a collection of Puppet modules that installs everything required for a full working Foreman setup. It uses native OS packaging (e.g. RPM and .deb packages) and adds necessary configuration for the complete installation.

The Foreman installer will install the following necessary components:

  • Foreman web UI
  • Smart Proxy
  • Passenger (for the puppet master and Foreman itself)
  • TFTP
  • DNS
  • DHCP

Add the Foreman, Puppet and EPEL repositories.

Next, run the following command to download Foreman installer:

Then, run the Foreman installer to start installing Foreman:

The installation run is non-interactive. But you can run “foreman-installer -i” without quotes for interactive mode. For more details run: foreman-installer –help.

The Foreman-installer command will start to download and install all necessary softwares to setup a working Foreman environment. After few minutes, you will see a output something like below.

Note down the initial credentials which are shown in bold. We need them later to access the Foreman’s dashboard.

Next, you need to allow the following ports through your FirewallD/Router.

Port Protocol Required For
53 TCP & UDP DNS Server
67, 68 UDP DHCP Server
69 UDP * TFTP Server
80, 443 TCP * HTTP & HTTPS access to Foreman web UI – using Apache + Passenger
3000 TCP HTTP access to Foreman web UI – using standalone WEBrick service
3306 TCP Separate MySQL database
5910 – 5930 TCP Server VNC Consoles
5432 TCP Separate PostgreSQL database
8140 TCP * Puppet Master
8443 TCP Smart Proxy, open only to Foreman

Restart Firewall to take effect the changes.

Install Foreman In Ubuntu 14.04

Make sure you have completed the prerequisites steps as shown above.
Now we will install Foreman in Ubuntu 14.04 LTS server.
The following commands needs to be run as root user.
To switch to root user run:


Enable Puppet labs and Foreman repositories:

Update the source lists using command:

Download the Foreman-installer script.

Finally, run Foreman-installer using command:

After a few minutes, you’ll see an output something like below.

Note down the initial credentials which are shown in bold. We need them later to access the Foreman’s dashboard.

Configure Foreman

First of all, we need to enable “diffs”, which will help you to see configuration file changes from within Foreman’s Reports view.

To do that, edit /etc/puppet/puppet.conf file:

Find the following line and change its value to true.

Save and close the file.

Next, we’ll need to add Foreman host to Foreman’s database. To do that, run:

Sample output:

Note: Puppet 3+ versions will show a warning message the first time that the node can’t be found. Just ignore the warning and continue.

Access Foreman Web console

Open up your web browser and navigate to: https://IP-address/ or https://FQDN/.

The following screen should appear.

Enter your Foreman credentials.


Here it is what my Foreman’s web console looks. Here you can see the Overview of your Puppet environment.


This Overview section will display the list of Puppet agent nodes and their configuration statuses. Now, we only have the Foreman host itself, so It shows the total hosts as 1.

To view the list of available hosts, go to Hosts > All hosts from the Menu bar.

Change Admin user’s default password

After logging in to the Dashboard, the very first step is to change the admin user’s default password. To do that, click on the Admin user’s drop down box and select My account on the top-right corner.


Enter a strong password of your choice twice and click Submit.


That’s it. Log out and log in back to your Foreman’s web console using the new password.

This entry was posted in Application, CentOS, Linux Post, Ubuntu. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">