Manual Infrastructure management is now a thing of the past. It is hard to scale, troubleshoot and perform deep integration with existing enterprise Infrastructure. Foreman is an open source tool created to help System Administrators automate provisioning, configuration of IT systems. With Foreman you can actually automate complete System’s Lifecycle. This guide will walk you through the steps to install and configure Foreman 2.x on Debian 10 (Buster) Linux.

With Chef, Puppet, Salt, Ansible and Foreman’s smart proxy architecture, Foreman can easily automate repetitive tasks, quickly deploy applications, and proactively manage change, both on-premise with VMs and bare-metal or in the cloud.

For Ubuntu: Install Foreman on Ubuntu Linux

Foreman Architecture:

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

With Foreman you can:

  • 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

Foreman, provides comprehensive, interaction facilities including a web frontend, CLI and RESTful API which enables you to build higher level business logic on top of a solid foundation. It is deployed in many organizations, managing from 10s to 10,000s of servers. Several commercial products are based on Foreman.

Install Foreman on Debian 10 (Buster)

We’ll use Foreman installer which is a collection of Puppet modules that installs everything required for a full working Foreman setup. This installer uses native OS packaging, both for Debian based and Red Hat based systems.

Step 1: Update System

We always start our installation by ensuring the system is updated.

sudo apt update
sudo apt get -y upgrade
sudo reboot

After the system is rebooted, you can continue to step 2.

Step 2: Add Puppet and Foreman Repositories

Next we need to add all the repositories that will be required for both dependencies and actual Foreman package installation.

Add Puppet repository:

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

Add Foreman repository to Debian 10 (Buster) system.

sudo apt -y install gpg ca-certificates
echo "deb http://deb.theforeman.org/ buster 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 3: Download Foreman Installer

Downloading the installer with the command below.

sudo apt update
sudo apt -y install foreman-installer

Before using the installer to get the latest release of Foreman running on Debian 10 (Buster) machine, remove the entry on /etc/hosts for localhost.

$ sudo vim /etc/hosts
10.10.1.108 deb10.novalocal deb10

Test to confirm hostname doesn’t return the localhost address.

$ ping $(hostname -f)
PING deb10.novalocal (10.10.1.108) 56(84) bytes of data.
64 bytes from deb10.novalocal (10.10.1.108): icmp_seq=1 ttl=64 time=0.024 ms
64 bytes from deb10.novalocal (10.10.1.108): icmp_seq=2 ttl=64 time=0.019 ms
^C
--- deb10.novalocal ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 4ms
rtt min/avg/max/mdev = 0.019/0.021/0.024/0.005 ms

Step 4: Install Foreman on Debian 10 (Buster)

By default the installation will run is non-interactive mode, but the configuration can be customized by supplying any of the options listed in:

$ foreman-installer --help

For interactive mode, run:

$ foreman-installer -i

More examples are given in the Installation Options section. Adding -v will disable the progress bar and display all changes.

I’ll start the Foreman installer by executing the command:

$ 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://deb10.novalocal
      Initial credentials are admin / yafNTaFNNJRUGP84
  * Foreman Proxy is running at https://deb10.novalocal:8443
  The full log is at /var/log/foreman-installer/foreman.log

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

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/04/echo/Install-foreman-debian-10-linux-01-1024×610.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

You should see a dashboard which looks similar to below.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/04/echo/Install-foreman-debian-10-linux-02-1024×501.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

You’re now on the right path to defining Infrastructure automation with Foreman.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/04/echo/install-foreman-ubuntu-18.04-02-min.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

Reference and more reading: