How Do You Install Foreman on a RHEL Server?

Problem scenario
You want to install Foreman on a RHEL server.  What should you do?

Solution
Warning
If you install this on a server that is already a Puppet master server, your site.pp file will be overwritten.

Procedures
Tips:  With EC-2 instances, you can usually skip to step #3.

1.  Modify /etc/hostname to be the FQDN of your server (the result of a hostname -f command).

(A Google Cloud Platform virtual server will usually need step #2 to be performed.  But an EC-2 server will likely not need this to be done; if you do not need to do this step, skip to step #3.)

2.  Update /etc/hostname.  This file should have the FQDN of the server (not merely the short hostname).  Run this command if you needed to modify the /etc/hostname file:
sudo hostname --file /etc/hostname
# The above command will make the changes take effect.

3.  What you do for this step depends on whether or you not you are using GCP or AWS.  If you are using a GCP server, run these commands:
sudo yum -y install yum-utils 

sudo yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms

If you are using an EC-2 (AWS) server, run this command:

sudo yum-config-manager --enable rhui-REGION-rhel-server-rhscl

4.  Run these commands:

sudo rpm -ivh http://yum.theforeman.org/releases/latest/el7/x86_64/foreman-release.rpm

sudo rpm -ivh https://yum.puppetlabs.com/puppet5/puppet5-nightly/puppet5-nightly-release-el-7.noarch.rpm

sudo yum -y install foreman foreman-installer


5.  Run this command:

sudo find / -name foreman-installer -type f

Based on the results above, run this:
sudo /path/to/foreman-installer --foreman-version

# Replace "path/to" with the results of the first command (e.g., /usr/sbin/").

Now you should have a web UI to log into.  From a web browser, you may be able to go to the external IP address (over port 80) provided that there are no firewall restrictions (e.g., no Security Groups blocking your workstation's IP address).  (You may have to confirm a security exception because of the site's certificate.  This is acceptable if it is a proof-of-concept and you are setting it up for the first time or you are in a very secure environment.  Otherwise you will want to secure your Foreman instance.

Leave a comment

Your email address will not be published.