How to Install Foreman on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Foreman on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Foreman is a free and open-source configuration management and provisioning tool for physical and virtual servers. Foreman can be integrated with configuration management tools such as puppet, chef, and ansible. This apps provides comprehensive, interaction facilities including a web frontend, CLI, and RESTful API which enables you to do the above tasks, supports both on-premise with VMs and bare-metal or in the cloud.

Install Foreman on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade
sudo apt install ca-certificates wget

Step 2. Setup FQDN.

Before installing Foreman, make sure you have set up an FQDN for your server:

sudo hostnamectl set-hostname
echo "" | sudo tee -a /etc/hosts

Step 3. Install Foreman on Ubuntu system.

Now add Puppet repositories:

sudo apt install ./puppet6-release-focal.deb

Next, add the Foreman repository to the system:

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

Once done, run the following command to download Foreman installer:

sudo apt update
sudo apt install foreman-installer

Once the installation finished, configure the Foreman installer. Here we’ll introduce some commands to use Foreman on Ubuntu 20.04.

To seek help it’s a good idea to read the manual by hitting the below command:

foreman-installer --help

Foreman comes with the non-interactive mode installation, if you want to run it in interactive mode, hit

sudo foreman-installer -i

For non-interactive mode, type:

sudo foreman-installer

Step 4. Configure firewall.

After the foreman installation, we need to open some ports that are needed by the Foreman:

ufw allow http
ufw allow https
ufw allow ssh
ufw enable

Step 5. Accessing Foreman.

Open up your favorite web browser, navigate to:

Install Foreman on Ubuntu 20.04

That’s all you need to do to install Foreman on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on the Foreman, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.