You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Foreman is a free and open source tool for managing servers lifecycle – provisioning and configuration to orchestration and monitoring. With automation tools available as plugins, such as Ansible, Chef, Salt and Puppet, it becomes so easy to automate repetitive tasks. This is with faster deployment application and ensuring there is proactive change management, both on-premise with VMs and bare-metal or in the cloud.

This article will help you install Foreman 2.x on Ubuntu 20.04 (Focal Fossa). Below is the system architecture of Foreman.

Some of its key features unlocked for you are:

  • Discover, provision and upgrade your entire bare-metal infrastructure
  • Create and manage instances in virtualization environment and across private and public clouds
  • Install operating systems via PXE, local media or from templates or images
  • Control and gather reports from your configuration management software
  • Group your hosts and manage them in bulk, regardless of location
  • Review historical changes for auditing or troubleshooting
  • Web user interface, JSON REST API and CLI for Linux
  • Extend as needed via a robust plugin architecture

Install Foreman 2.x on Ubuntu 20.04 (Focal Fossa)

Below are the steps you’ll follow to install Foreman 2.x on Ubuntu 20.04 (Focal Fossa).

Step 1: Set System hostname

You need a proper hostname configured for your machine that can be resolved to an IP address.

sudo hostnamectl set-hostname foreman.example.com
echo "192.168.100.21 foreman.example.com" | sudo tee -a /etc/hosts

Replace the hostname and the IP address with your actual values.

Ensure that the command below shows the real IP address, not 127.0.1.1.

$ ping -c 2 $(hostname -f)
PING foreman.example.com (192.168.100.21) 56(84) bytes of data.
64 bytes from foreman.example.com (192.168.100.21): icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from foreman.example.com (192.168.100.21): icmp_seq=2 ttl=64 time=0.035 ms

--- foreman.example.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1023ms
rtt min/avg/max/mdev = 0.035/0.043/0.052/0.010 ms

If it returns 127.0.0.1, Change or remove this entry from /etc/hosts file if present.

Step 2: Update System

Once the hostname is configured correctly, update your system to get the latest packages.

sudo apt update && sudo apt upgrade
sudo systemctl reboot

Step 3: Add Puppet and Foreman Repositories

Add the Puppet and Foreman repositories required for both dependencies and actual Foreman packages installation.

Add Puppet repository to Ubuntu 20.04:

sudo apt update
sudo apt -y install ca-certificates wget
wget https://apt.puppet.com/puppet6-release-focal.deb
sudo apt install ./puppet6-release-focal.deb

Add Foreman repository to system.

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

Step 4: Install Foreman Installer

Once the repositories are added, you should be ready to install Foreman on Ubuntu 20.04 (Focal Fossa).

sudo apt update
sudo apt install foreman-installer

Hit the y key to accept installation.

The following additional packages will be installed:
  libgdbm-compat4 libruby2.5 puppet-agent rake ruby ruby-ansi ruby-clamp ruby-did-you-mean ruby-hashie ruby-highline ruby-kafo ruby-kafo-parsers
  ruby-kafo-wizards ruby-little-plugger ruby-logging ruby-minitest ruby-multi-json ruby-net-telnet ruby-power-assert ruby-powerbar ruby-test-unit
  ruby2.5 rubygems-integration
Suggested packages:
  ri ruby-dev bundler
Recommended packages:
  zip ruby-oj fonts-lato libjs-jquery
The following NEW packages will be installed:
  foreman-installer libgdbm-compat4 libruby2.5 puppet-agent rake ruby ruby-ansi ruby-clamp ruby-did-you-mean ruby-hashie ruby-highline ruby-kafo
  ruby-kafo-parsers ruby-kafo-wizards ruby-little-plugger ruby-logging ruby-minitest ruby-multi-json ruby-net-telnet ruby-power-assert ruby-powerbar
  ruby-test-unit ruby2.5 rubygems-integration
0 upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 27.4 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Step 5: Run foreman installer on Ubuntu 20.04

When the installation of foreman installer is complete, you need to run it to configure and prepare Foreman components. The Foreman installer is a collection of Puppet modules that installs everything required for a full working Foreman setup on Ubuntu 20.04 LTS.

By default it will configure:

  • Apache HTTP with SSL (using a Puppet-signed certificate)
  • Foreman running under mod_passenger
  • Smart Proxy configured for Puppet, TFTP and SSL
  • Puppet master running under mod_passenger
  • Puppet agent configured
  • TFTP server (under xinetd on Red Hat platforms)

Note that installation of foreman runs is a non-interactive mode by default, but the configuration can be customized by supplying any of the options listed in:

$ foreman-installer --help

To run foreman installation in interactive mode, use:

sudo foreman-installer -i

To run the installation in a non-interactive mode, use:

sudo foreman-installer

If Smart Proxy, Puppet master are installed along Foreman, the installer will output details about them after the installation.

Preparing installation Done                                              
  Success!
  * Foreman is running at https://foreman.example.com
      Initial credentials are admin / yafNTaFNNJRUGP84
  * Foreman Proxy is running at https://foreman.example.com:8443
  The full log is at /var/log/foreman-installer/foreman.log

Use the details given in the output to login to Foreman Dashboard.

The Foreman Administration dashboard have a look like this:

Read more on how to administer Foreman and benefit from from its cool features

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF