How To Install Foreman 3.x on Ubuntu 20.04

Posted on 97 views

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 3.x on Ubuntu 20.04 (Focal Fossa). Below is the system architecture of Foreman.

foreman_architecture

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 3.x on Ubuntu 20.04 (Focal Fossa)

Below are the steps you’ll follow to install Foreman 3.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
$ sudo vim /etc/hosts
192.168.100.21 foreman.example.com

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 -y
[ -f /var/run/reboot-required ] && sudo reboot -f

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 dpkg -i puppet6-release-focal.deb

Add Foreman repository to system.

sudo apt -y install gpg ca-certificates
echo "deb http://deb.theforeman.org/ focal nightly" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins nightly" | 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 key to accept installation.

The following additional packages will be installed:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  fonts-lato javascript-common libjs-jquery libruby2.7 puppet-agent rake ruby ruby-ansi ruby-clamp 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-oj ruby-power-assert ruby-powerbar ruby-test-unit ruby-xmlrpc ruby2.7 rubygems-integration unzip zip
Suggested packages:
  apache2 | lighttpd | httpd ri ruby-dev ruby-activesupport bundler
The following NEW packages will be installed:
  fonts-lato foreman-installer javascript-common libjs-jquery libruby2.7 puppet-agent rake ruby ruby-ansi ruby-clamp 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-oj ruby-power-assert ruby-powerbar ruby-test-unit ruby-xmlrpc ruby2.7 rubygems-integration unzip zip
0 upgraded, 29 newly installed, 0 to remove and 43 not upgraded.
Need to get 31.0 MB of archives.
After this operation, 186 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:

$ sudo 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.

Install-foreman-debian-10-linux-01-1024x610

The Foreman Administration dashboard have a look like this:

Install-foreman-debian-10-linux-02-1024x501

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

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.