(Last Updated On: August 14, 2018)

This guide has been written to help you install foreman on Ubuntu 18.04 LTS server. Foreman is an open source tool for managing servers lifecycle, from provisioning and configuration to orchestration and monitoring. By using Chef, Puppet, Salt, Ansible and Foreman’s smart proxy architecture, you can easily automate repetitive tasks, quickly deploy applications, and proactively manage change, both on-premise with VMs and bare-metal or in the cloud.

With Foreman you can:

  • Discover, provision and upgrade your entire bare-metal infrastructure
  • Create and manage instances across private and public clouds
  • Group your hosts and manage them in bulk, regardless of location
  • Review historical changes for auditing or troubleshooting
  • Extend as needed via a robust plugin architecture
  • Automatically build images (on each platform) per system definition to optimize deployment

Foreman also provides a RESTful API, CLI, web frontend, which enables you to build higher-level business logic and to interact with the software.

How to Install Foreman on Ubuntu 18.04

Foreman has an automated installer which installs and configures Foreman, a Puppet master, and the Smart Proxy for you. It’s not advisable to run foreman installer on an existing system with other services since it will affect the configuration of several components.

As a pre-requisite, make sure you have a valid hostname with A record on file/etc/hosts.

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

Setup Repositories

The first step in the installation of Foreman on Ubuntu 18.04 is the setup of repositories required.

Start by adding the Puppet Labs repository that will be used to  install Puppet 5.x with Puppet Agent and Puppet Server:

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

Installing Foreman Installer on Ubuntu 18.04

Once this has been installed, proceed to enable Foreman repository for Ubuntu 18.04. As of this writing, the available version of foreman on the repository is 1.19, check the latest version before adding the repo.

echo "deb http://deb.theforeman.org/ bionic 1.19" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.19" | sudo tee -a /etc/apt/sources.list.d/foreman.list

Import GPG key for the repository:

sudo apt-get -y install ca-certificates
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -

Now download the foreman installer:

sudo apt-get update
sudo apt-get install foreman-installer

Running foreman installer

When the installation of foreman installer is complete, you need to run it to configure and prepare Foreman components.

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

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

After it completes the installation, some details about Foreman, Smart Proxy and Puppet Master will be printed on the screen. The output should be similar to this:

.......... 
Success!
* Foreman is running at https://foreman.computingforgeeks.com
Initial credentials are admin / znp2cEU93suAt7EA
* Foreman Proxy is running at https://foreman.computingforgeeks.com:8443
* Puppetmaster is running at port 8140
The full log is at /var/log/foreman-installer/foreman.log

Accessing Foreman Web UI on Ubuntu 18.04

Now that the installation was successful, login to Foreman web admin interface to start administering it. In my case, the URL is https://foreman.computingforgeeks.com. Accept Invalid certificate warning when prompted.

Login with the username admin and the password shown on the screen after the installation. You should get to Foreman admin interface.

Refer to https://www.theforeman.org/documentation.html for how to guides.