How to Install Foreman Server Management Tool on Ubuntu 18.04 LTS

The Foreman is an open source software for managing the lifecycle of physical and virtual servers. It's a server management solution that helps system administrators to perform server provisioning and configuration to the orchestration and monitoring. Foreman offers support for provisioning tools such as Puppet, Chef, Salt Stack, Ansible etc.

In this guide, we're going to show you the installation and configuration of the Foreman on Ubuntu server 18.04. We're going to install the Foreman using the Puppet Foreman installer on Ubuntu Server 18.04.


  • Ubuntu Server 18.04
  • RAM Memory 4/2GB

What we will do?

  1. Setup FQDN
  2. Install Puppet 5
  3. Install Foreman
  4. Setup UFW Firewall
  5. Access Foreman Dashboard
  6. Add NTP Module to Foreman
  7. Run the Puppet Agent

Step 1 - Setup FQDN

Firstly, we need to configure FQDN (Fully Qualified Domain Name) of the Foreman server by changing the hostname and edit the '/etc/hosts' file.

Change the hostname of the system using the following command and change the domain name with your own.

hostnamectl set-hostname

Now edit the '/etc/hosts' file using vim editor.

vim /etc/hosts

Change the IP Address and the domain name with your own and paste into it.   server

Save and close the file.

Now run the following command and make sure you get the IP address of the server FQDN.

ping $(hostname -f) -c 3

Step 2 - Add Puppet Repository

For this guide, we need to add the puppet repository to install the Puppet package to the Ubuntu system. Because we want to install the Foreman automatically using the puppet module installer script that's provided by the Foreman.

Install the ca-certificate package and download the Puppet repository package.

sudo apt install ca-certificates -y
cd /tmp && wget

Now add the puppet repository using the following command.

sudo dpkg -i /tmp/puppet5-release-bionic.deb

Add puppet Repository

Step 3 - Install Foreman

In order to install the Foreman to the system, we must add the foreman repository.

Add the Foreman repository by running the following command.

echo "deb bionic 1.20" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb plugins 1.20" | sudo tee -a /etc/apt/sources.list.d/foreman.list

Now add the Foreman key.

wget -q -O- | sudo apt-key add -

After that, update ubuntu repositories and install the 'foreman-installer' package using the following commands.

sudo apt update
sudo apt install foreman-installer -y

Install Foremen

Now the foreman-installer package has been installed, run the installer command below.

sudo foreman-installer

When the installation is complete, you will get the admin user and password of the Foreman dashboard as below.

Run Foremen installer with sudo

Step 4 - Configure UFW Firewall

After the foreman installation, we need to open some ports that are needed by the Foreman.

Run all ufw following command below.

ufw allow http
ufw allow https
ufw allow ssh

ufw allow 69/udp
ufw allow 8140/tcp

After that, start and enable the ufw firewall service.

ufw enable

Configure UFW Firewall

Step 5 - Access the Foreman Dashboard

Now open your web browser and type the foreman server IP or domain name on the address bar, in my case ''.

Foremen Login

And you will get the Foreman Login Page.

Log in with the user 'admin' and the password given on the top, and you will get the Foreman Dashboard.

Foremen Dashboard

Step 6 - Add NTP Module to Foreman

The NTP module was needed by the puppet master to keep the time accurate. And we will be using the Foreman to manage the NTP service on the Foreman host (which also as the puppet master).

- Install Puppet Module for managing the NTP

Install the puppet module for managing the NTP service to the foreman host using the following command.

sudo /opt/puppetlabs/bin/puppet module install puppetlabs/ntp

And you will get the result as below.

Add NTP Module to Foreman

- Enable and Configure NTP Puppet Module

After the puppet module installation, we need to enable and configure the NTP module through the Foreman dashboard.

Log in to the Foreman dashboard, click the menu on the left.

Configure - Puppet - Classes.

Enable and Configure NTP Puppet Module

Click the 'Import Environment from' button.

Enable the NTP puppet module by ticking the checkbox and then click the Update button.

Enable the NTP puppet module

The puppet module for managing the NTP service has been enabled.

After that, we will override the default of NTP server configuration using our own custom server.

On the 'Puppet Classes' page, click the NTP module.

Puppet Classes page

Now click the 'Smart Class Parameters' tab, then click the 'Server' parameter on the left side.

Smart Class Parameters

Tick the 'Override' checkbox, change the key type to 'array', and then input the default value with the custom NTP server pool.


Click the 'Submit' button at the bottom and the NTP puppet module configuration has been completed.

- Configure Host to use the Puppet Module

Show all available hosts on the Foreman by choosing the 'Host' menu on the left side, then click 'All Hosts'.

Configure Host to use the Puppet Module

After that, choose the host that you want to apply the NTP puppet module and click the 'Edit' button.

Click on the Puppet Classes tab and you will get all available puppet module on the Foreman. Under the Available Classes, expand the NTP class module and click the plus sign next to "ntp".

Available Puppet Modules

Now click the 'Submit' button and the puppet module for managing the NTP server has been added to the Foreman Puppet Master server.

Step 7 - Run the Puppet Agent

Log in to the Foreman server and run the following puppet command below.

sudo /opt/puppetlabs/bin/puppet agent --test

And you will get the result as below.

Run Puppet Agent

The server will automatically installed and configured the NTP service using our custom configuration.

After it's complete, check the '/etc/ntp.conf' configuration file.

cat /etc/ntp.conf

Ensure you get the NTP configuration managed by puppet using the custom server pool that's already defined on the Foreman dashboard.

ntp.conf file


Share this page:

3 Comment(s)