Share your love
Install and Run Foreman on AlmaLinux 8 and RHEL 8
In this guide, you will learn to Install and Run Foreman on AlmaLinux 8 and RHEL 8. As described on the Foreman official site, it is an open-source project that helps system administrators manage servers throughout their lifecycle. The supported platform is for RHEL 8. So you can follow the steps below to start your Foreman installation on AlmaLinux 8 and RHEL 8.
How To Install and Run Foreman on AlmaLinux 8 and RHEL 8?
Before you start your Foreman installation, you must have access to your server as a non-root user with sudo privileges and set up a basic firewall. For this purpose, you can visit this guide on Initial Server Setup with AlmaLinux 8.
Then, follow the steps below to complete your Foreman installation.
Step 1 – Configure Hostname on AlmaLinux 8 and RHEL 8
In this step, you must configure your system hostname. You must set a suitable hostname that can be resolved to an IP address. To do this, first, run your system update with the command below:
sudo dnf update -y
Then, set your hostname with the following command:
sudo hostnamectl set-hostname foreman.example.com
Next, you must edit the /etc/hosts file and specify your IP address and DNS name in the file. Open the file with your favorite text editor, here we use the vi editor:
sudo vi /etc/hosts
Your file should look like this after your editing:
your-ip-address foreman.example.com
Make sure to delete the 127.0.1.1 entry from the file. When you are done, save and close the file.
Verify your hostname IP address with the command below:
ping -c 2 $(hostname -f)
In your output, you should see that you have received a ping from your DNS and IP address.
Step 2 – Configure Time Synchronization on AlmaLinux 8 and RHEL 8
At this point, you need to configure your time and date on your server. First, install Chrony with the command below on AlmaLinux 8:
sudo dnf install chrony -y
This is an alternative to the NTP package for RHEL. Start and enable Chrony with the following command:
sudo systemctl enable --now chronyd
Then, sync your time by using the following command:
sudo chronyc sources
Finally, verify your time settings with the command below:
sudo timedatectl
Output
Local time: Mon 2023-08-21 03:23:28 EDT
Universal time: Mon 2023-08-21 07:23:28 UTC
RTC time: Mon 2023-08-21 07:23:28
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Step 3 – Add Foreman and Puppet Repositories on AlmaLinux 8 and RHEL 8
At this point, you must add the Puppet and Foreman repositories to your server. Puppet helps you perform administrative tasks and manage servers remotely.
To add the Puppet repo in the latest version on AlmaLinux 9 and RHEL 9, run the following command:
sudo dnf -y install https://yum.puppet.com/puppet7-release-el-8.noarch.rpm
Then, add the latest Foreman repository to your server with the following command:
sudo dnf -y install https://yum.theforeman.org/releases/latest/el8/x86_64/foreman-release.rpm
Next, enable the Foreman modules with the following command:
sudo dnf module enable foreman:el8 -y
Note: You may get the Could not resolve host error when you want to execute the commands. You can resolve the issue by editing the /etc/resolv.conf file and add the name server of Google to it.
vi /etc/resolv.conf
# Generated by NetworkManager
search foreman.example.com
nameserver 8.8.8.8
Step 4 – Install and Run Foreman Installer on AlmaLinux 8
At this point, you can install the Foreman installer on your server with the following command:
sudo dnf install foreman-installer -y
Next, you can run your Foreman installer on AlmaLinux 8 with the following command:
sudo foreman-installer
Wait until your process is completed, then, you will get the following output:
Ouput
Executing: foreman-rake upgrade:run
Success!
* Foreman is running at https://foreman.example.com
Initial credentials are admin / 4YrehmVsYNeq6ZEc
* Foreman Proxy is running at https://foreman.example.com:8443
The full log is at /var/log/foreman-installer/foreman.log
Step 5 – Configure Firewall For Foreman on AlmaLinux 8 and RHEL 8
If you have a running firewalld on your server, you must open the following ports through your 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
Then, reload the firewall to apply the new rules:
sudo firewall-cmd --reload
Step 6 – Access Foreman Dashboard via Web Interface
At this point, you can access your Foreman dashboard n AlmaLinux 8 by the given URL from the Foreman installer.
https://foreman.example.com
You will see the Foreman login page. Enter the credentials information you have got from the Foreman installer and click Log in.
Then, you will see your Foreman dashboard in your web browser.
From there, you can manage and monitor your servers.
To get more information about Foreman, you can visit the Foreman Introduction page.
Conclusion
At this point, you have learned to Install and Run Foreman Management Tool on AlmaLinux 8 and RHEL 8. Also, you have learned to Access the Foreman dashboard via the Web interface. Hope you enjoy using it.
You may be interested in these articles:
Install bmon Real-Time Bandwidth Monitor on AlmaLinux 9