Foreman is a free and open source tool for automating provisioning and configuration of Linux systems. Foreman can be integrated with configuration management tools such as Ansible, Chef, Salt and Puppet, available as plugins to deliver a complete Infrastructure lifecycle management. Foreman support various Virtualization and Cloud environments. In this blog post I’ll explain the steps that are used to install Foreman on CentOS 8 | RHEL 8 Linux system.

Foreman System Architecture is as in this diagram.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/foreman_architecture-1024×618.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

Install Foreman on CentOS 8 | RHEL 8

The standard features of Foreman 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

Follow the next steps to install and configure Foreman on CentOS 8 | RHEL 8 server.

Step 1: Configure 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

Set IP address and DNS name in your /etc/hosts file.

$ sudo vi /etc/hosts
192.168.100.21 foreman.example.com

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: Install and Configure NTP time synchronization

Install chrony package.

sudo dnf -y install chrony

Set correct timezone.

sudo timedatectl set-timezone Africa/Nairobi

Start and enable chronyd service.

sudo systemctl enable --now chronyd

Sync time.

$ sudo chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^- static.102.162.46.78.cli>     2   7   377    14  -3496us[-3496us]  /-   52ms
^- node2.eriomem.net             2   7   377   145  -5807us[-5831us]  /-   45ms
^* time.cloudflare.com           3   7   377    16    -27us[  -52us]  /-   15ms
^- ntp1.squareflow.net           2   7   377    15  -8346us[-8346us]  /-   61ms

Confirm current time settings.

$ timedatectl
               Local time: Mon 2020-07-20 01:48:53 EAT
           Universal time: Sun 2020-07-19 22:48:53 UTC
                 RTC time: Sun 2020-07-19 22:48:53
                Time zone: Africa/Nairobi (EAT,  0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Step 3: Add Puppet and Foreman Repositories

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

sudo dnf -y install https://yum.puppet.com/puppet6-release-el-8.noarch.rpm

Add Foreman repository:

sudo dnf -y install https://yum.theforeman.org/releases/2.1/el8/x86_64/foreman-release.rpm

Step 4: Install Foreman Installer

With the two repositories added, install foreman installer in your CentOS 8 | RHEL 8 system.

sudo dnf -y install foreman-installer

Step 5: Run foreman installer on CentOS 8 | RHEL 8

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 CentOS 8 | RHEL 8.

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
Executing: foreman-rake upgrade:run
foreman-rake upgrade:run finished successfully!
  Success!
  * Foreman is running at https://foreman.example.com
      Initial credentials are admin / QAefJcYDnxQy2yEL
  * Foreman Proxy is running at https://foreman.example.com:8443
  The full log is at /var/log/foreman-installer/foreman.log

Open all required ports if you have an active firewalld service.

sudo firewall-cmd --add-port={22,53,80,443,3000,8140,3306,5432,8443,5910-5930}/tcp --permanent
sudo firewall-cmd --add-port=67-69/udp --permanent
sudo firewall-cmd --reload

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

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/install-foreman-centos-8-01-1024×697.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

Refer to the official Foreman and Katello documentation to get more useful information on administration.

Linux Learning courses:


<img alt="Linux Mastery: Master the Linux Command Line in 11.5 Hours" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/1320362_1b73_6.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>

<img data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/icon_udemy-com.png5f159363550b4.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>Udemy.com


<img alt="Complete Linux Training Course to Get Your Dream IT Job 2020" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/1523066_334c_13.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>

<img data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/icon_udemy-com.png5f159363550b4.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>Udemy.com


<img alt="Linux Administration Bootcamp: Go from Beginner to Advanced" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/924090_507a_3.jpg5f159363c30d5.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>

<img data-ezsrc="https://kirelos.com/wp-content/uploads/2020/07/echo/icon_udemy-com.png5f159363550b4.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>Udemy.com

Some of the focus areas for new installations are:

Fore Debian checkout our guide: Install Foreman on Debian 10 Linux