How to Install Foreman on CentOS 8

Install Foreman on CentOS 8

In this article, we will have explained the necessary steps to install and configure Foreman on CentOS 8. 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 CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Configure hostname.

Make sure you have set up a proper FQDN for your server:

sudo hostnamectl set-hostname foreman.linuxtips.us

Step 3. Configure NTP time synchronization.

Now we set the correct timezone using chrony package:

sudo dnf install chrony

Next, set for your machine when you run synchronization command:

sudo timedatectl set-timezone Jakarta/Bangkok

Start and enable chronyd service using systemctl command:

sudo systemctl enable --now chronyd

Step 4. Install Foreman on CentOS system.

Foreman can be installed in different methods. The recommended way is with the puppet-based Foreman Installer, but you may also use your distribution’s package manager or install directly from the source:

sudo dnf install https://yum.puppet.com/puppet6-release-el-8.noarch.rpm
sudo dnf install https://yum.theforeman.org/releases/2.1/el8/x86_64/foreman-release.rpm

After that, run the following command to download Foreman installer:

sudo dnf install foreman-installer

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

sudo foreman-installer -i

Step 5. Configure firewall.

Before Accessing the dashboard, it is recommended to open the required ports in the OS firewall:

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

Step 6. Accessing Foreman.

Open up your favourite web browser, navigate to:

https://your-ip-address

Congratulation, you have learned how to install and configure Foreman on CentOS 8. If you have any questions, please leave a comment below.