How To Install Foreman on Ubuntu 18.04 / Ubuntu 16.04 & Debian 9

0

Foreman is an open-source lifecycle management tool that helps you to provision, configure, manage and monitor the physical and virtual servers.

With the integration of configuration management tools such as Puppet, Chef, Salt, and Foreman’s smart proxy architecture, you can easily automate repetitive tasks, deploy applications, and manage change to deployed servers.

Foreman offers comprehensive, interaction facilities including a web frontend, CLI and RESTful API which lets you do above tasks on VMs, bare-metal servers, and cloud.

Features

  • Discover, provision and upgrade your bare-metal infrastructure
  • Create and manage instances across public and private clouds
  • Manage host groups in bulk, regardless of location
  • Assess historical changes for auditing or troubleshooting
  • Automatically build images per system definition

Foreman can be installed on following OSs,

It can provision systems on bare-metal (physical) as well as the following cloud providers,

  • Amazon EC2
  • Google Compute Engine
  • VMware
  • Rackspace
  • OpenStack
  • Libvirt
  • oVirt and RHEV

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

Prerequisites

Before installing Foreman, make sure you have set up an FQDN for your server.

vi /etc/hosts

Make an entry, like this.

192.168.1.10 server.itzgeek.local server

Also, set up the valid hostname for the above host entry.

sudo hostnamectl set-hostname server.itzgeek.local

Ensure that ping $(hostname -f) shows the real IP address, not 127.0.1.1. If require, change or remove this entry from /etc/hosts.

Output:

PING server.itzgeek.local (192.168.1.10) 56(84) bytes of data.
64 bytes from server.itzgeek.local (192.168.1.10): icmp_seq=1 ttl=64 time=0.013 ms
64 bytes from server.itzgeek.local (192.168.1.10): icmp_seq=2 ttl=64 time=0.033 ms
64 bytes from server.itzgeek.local (192.168.1.10): icmp_seq=3 ttl=64 time=0.031 ms
--- server.itzgeek.local ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2036ms
rtt min/avg/max/mdev = 0.013/0.025/0.033/0.010 ms

Install Foreman on Ubuntu 18.04 / Ubuntu 16.04 & Debian 9

Foreman can be installed in different methods. The recommended way is with the puppet-based Foreman Installer, but you may also use your distribution’s package manager or install directly from the source.

The Foreman installer (a collection of Puppet modules) installs everything required for Foreman, and it uses native OS packaging (e.g.,  .deb packages) and adds necessary configuration for full installation.

The Foreman installer will install all the necessary components such as the Foreman web UI, Smart Proxy,  and Passenger (for the puppet master and Foreman itself). Also, installs DNS, DHCP, and TFTP servers.

Configure the puppet repository.

### Ubuntu 18.04 ###

sudo apt update
sudo apt install -y ca-certificates wget
wget https://apt.puppetlabs.com/puppet5-release-bionic.deb
sudo dpkg -i puppet5-release-bionic.deb

### Ubuntu 16.04 ###

sudo apt-get update
sudo apt-get install -y ca-certificates wget
wget https://apt.puppetlabs.com/puppet5-release-xenial.deb
sudo dpkg -i puppet5-release-xenial.deb

### Debian 9 ###

sudo apt-get update
sudo apt-get install -y ca-certificates wget
wget https://apt.puppetlabs.com/puppet5-release-stretch.deb
sudo dpkg -i puppet5-release-stretch.deb

Enable the Foreman repo.

### Ubuntu 18.04 ###

echo "deb http://deb.theforeman.org/ bionic 1.20" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.20" | sudo tee -a /etc/apt/sources.list.d/foreman.list
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -

### Ubuntu 16.04 ###

echo "deb http://deb.theforeman.org/ xenial 1.20" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.20" | sudo tee -a /etc/apt/sources.list.d/foreman.list
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -

### Debian 9 ###

echo "deb http://deb.theforeman.org/ stretch 1.20" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.20" | sudo tee -a /etc/apt/sources.list.d/foreman.list
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -

Update the repository index.

sudo apt-get update

Install the Foreman installer.

sudo apt-get -y install foreman-installer

Run the Foreman installer.

sudo foreman-installer

You will see an output like below upon completion of installation.

Installing             Done                                               [100%] [.........]
  Success!
  * Foreman is running at https://server.itzgeek.local
      Initial credentials are admin / 25244wXGKByWd89z
  * Foreman Proxy is running at https://server.itzgeek.local:8443
  * Puppetmaster is running at port 8140
  The full log is at /var/log/foreman-installer/foreman.log
Install Foreman on Ubuntu 18.04 - Foreman Installation Successfull
Install Foreman on Ubuntu 18.04 – Foreman Installation Successful

Note down initial username and password, and you need this for accessing Foreman’s dashboard.

Firewall Configuration

The components of Foreman use the following ports and should be allowed in firewall. Few additional network ports can be opened as per environmental requirement.

Port Protocol Purpose
69 UDP * TFTP Server
80, 443 TCP * HTTP & HTTPS – Foreman web UI – using Apache + Passenger
8140 TCP * Puppet Master

Access Foreman Web Console

Open a web browser and hit it to,

https://your.ip.add.ress

OR

https://FQDN

You should now get the login page. Enter your Foreman credentials to access the Foreman dashboard.

Install Foreman on Ubuntu 18.04 - Foreman Login Screen
Install Foreman on Ubuntu 18.04 – Foreman Login Screen

Upon successful login, you will get an overview page.

Install Foreman on Ubuntu 18.04 - Foreman Dashboard
Install Foreman on Ubuntu 18.04 – Foreman Dashboard

On the first login, it is recommended to change the password of Foreman Admin user for security reasons. To do that, click UserName (Top right) >> My Account, you would end up with an option to change a password.

Install Foreman on Ubuntu 18.04 - Change Foreman Password
Install Foreman on Ubuntu 18.04 – Change Foreman Password

To list down the available hosts, go to Hosts >> All Hosts from Menu.

Install Foreman on Ubuntu 18.04 - No Hosts
Install Foreman on Ubuntu 18.04 – No Hosts

Configure Foreman (Optional)

If your Foreman host is not visible over in Hosts >> All Hosts tab, run the below command which will send the first Puppet agent report to Foreman, automatically creating the host in Foreman’s database.

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

Output:

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for server.itzgeek.local
Info: Applying configuration version '1537850559'
Notice: Applied catalog in 0.16 seconds

Since we do not have any clients added to Foreman, All Hosts tab would only list the Foreman host with an O status and green tick. This status indicates that the host status is OK, with no changes made in the last Puppet run.

Install Foreman on Ubuntu 18.04 - Hosts List
Install Foreman on Ubuntu 18.04 – Hosts List

Further Reading

You might also like

How To Install Foreman on Ubuntu 18.04 / Ubuntu 16.04 & Debian 9

0