Install and Run Foreman on AlmaLinux 8 and RHEL 8 with Easy Steps

Posted on

Install and Run Foreman on AlmaLinux 8 and RHEL 8 with Easy Steps

Install and Run Foreman on AlmaLinux 8 and RHEL 8 with Easy Steps

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 on the Orcacore website to start your Install and Run Foreman on AlmaLinux 8 and RHEL 8.

Before you start to Install and Run Foreman on AlmaLinux 8 and RHEL 8, 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 Install and Run Foreman on AlmaLinux 8 and RHEL 8.

Step 1 – Configure Hostname on AlmaLinux 8 and RHEL 8

To Install and Run Foreman on AlmaLinux 8 and RHEL 8, 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 <mark>foreman.example.com</mark>

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

To Install and Run Foreman on AlmaLinux 8 and RHEL 8, 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
<strong><mark>Output</mark></strong>
               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:

<mark><strong>Ouput</strong></mark>
Executing: foreman-rake upgrade:run
  Success!
  * Foreman is running at <strong>https://foreman.example.com</strong>
      <strong>Initial credentials are admin / 4YrehmVsYNeq6ZEc</strong>
  * Foreman Proxy is running at <strong>https://foreman.example.com:8443</strong>

  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 in 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.

Foreman login screen
Install and Run Foreman on AlmaLinux 8 and RHEL 8

Then, you will see your Foreman dashboard in your web browser.

Foreman dashboard
Install and Run Foreman on AlmaLinux 8 and RHEL 8

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 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 also be interested in these articles:

Install bmon Real-Time Bandwidth Monitor on AlmaLinux 9

Quick Setup For Flatpak on AlmaLinux 9 and RHEL 9

Install and Use Monit on AlmaLinux 8

Alternative Solutions for Server Management

While Foreman provides a comprehensive solution for server lifecycle management, alternative tools and approaches can achieve similar goals, often with different trade-offs in complexity, cost, and feature sets. Here are two alternative solutions:

1. Ansible Automation Platform

Ansible is an open-source automation tool that can be used for configuration management, application deployment, and task automation. Unlike Foreman, Ansible uses an agentless architecture, communicating with managed nodes over SSH. This can simplify initial setup and reduce resource consumption on managed servers. It is another way to Install and Run Foreman on AlmaLinux 8 and RHEL 8.

Explanation:

Ansible uses playbooks written in YAML to define the desired state of the systems. These playbooks are executed against target servers, ensuring they conform to the specified configuration. Ansible’s simplicity and agentless nature make it a popular choice for organizations that need to manage a diverse infrastructure with minimal overhead.

Code Example (Ansible Playbook to install and configure NTP):

---
- hosts: all
  become: true
  tasks:
    - name: Install NTP package
      dnf:
        name: chrony
        state: present

    - name: Ensure chronyd is running and enabled
      systemd:
        name: chronyd
        state: started
        enabled: true

    - name: Configure NTP servers
      copy:
        dest: /etc/chrony.conf
        content: |
          server 0.pool.ntp.org iburst
          server 1.pool.ntp.org iburst
          server 2.pool.ntp.org iburst

    - name: Restart chronyd
      systemd:
        name: chronyd
        state: restarted

This playbook installs the Chrony NTP client, configures it with public NTP servers, and ensures the service is running. This approach allows for centralized management of configurations, providing an alternative solution to Install and Run Foreman on AlmaLinux 8 and RHEL 8.

2. Webmin/Virtualmin

Webmin is a web-based system administration tool for Unix-like systems. Virtualmin is a Webmin module that provides a comprehensive interface for managing virtual hosts on a web server. While not a direct replacement for Foreman’s entire feature set, Webmin/Virtualmin offers a user-friendly way to manage server configurations, user accounts, and web hosting environments. It is another way to Install and Run Foreman on AlmaLinux 8 and RHEL 8.

Explanation:

Webmin provides a graphical interface for managing various system services, including Apache, DNS, file sharing, and more. Virtualmin builds upon Webmin to provide a virtual hosting platform, allowing administrators to easily create and manage multiple websites on a single server. This is particularly useful for shared hosting environments or smaller organizations that need a simple and intuitive management interface.

Code Example (Installing Webmin on AlmaLinux 8):

First, add the Webmin repository:

sudo tee /etc/yum.repos.d/webmin.repo <<EOL
[Webmin]
name=Webmin Distribution Neutral
#baseurl=https://download.webmin.com/download/yum
mirrorlist=https://download.webmin.com/download/yum/mirrorlist
enabled=1
EOL

Then, import the GPG key:

wget https://download.webmin.com/jcameron-key.asc
sudo rpm --import jcameron-key.asc

Finally, install Webmin:

sudo dnf update
sudo dnf install webmin -y

After installation, you can access Webmin via a web browser using the server’s IP address and port 10000 (e.g., https://your_server_ip:10000).

While these alternative solutions might not offer the same level of sophisticated lifecycle management as Foreman, they provide viable options for different use cases and organizational needs. Selecting the right tool depends on the specific requirements, resources, and technical expertise available.

Leave a Reply

Your email address will not be published. Required fields are marked *