Debug School

Cover image for Install Foreman Server
Suyash Sambhare
Suyash Sambhare

Posted on

Install Foreman Server

A Foreman system contains a central Foreman instance that is in charge of providing the Web-based GUI, node configurations, initial host configuration files, etc. However, other operations need to be performed to fully automate this process. The Smart Proxy manages remote services and is generally installed with all Foreman installations to manage TFTP, DHCP, DNS, Puppet, Puppet CA, Ansible, and Salt. The Puppet modules can be read or run in “no-op” mode to see what changes it will make.

Prerequisites

  • Ubuntu Server 22.04
  • RAM Memory 4GB

Karakoram

Setup FQDN

Set the hostname
hostnamectl set-hostname foreman.noise.com

Now edit the '/etc/hosts' file using vim editor.
vi /etc/hosts
192.168.1.129 foreman.noise.com foreman

Fetch the IP address of the server FQDN.
ping $(hostname -f) -c 3

Add Puppet Repository

Add the Puppet source to install the Puppet package to the Ubuntu system. This is needed to install the Foreman unattended using the puppet module installer script that's given by the Foreman. Install the ca-certificate package and get the Puppet repository package.
sudo apt install ca-certificates -y
wget https://apt.puppetlabs.com/puppet5-release-bionic.deb

Now add the puppet repository.
sudo dpkg -i /tmp/puppet5-release-bionic.deb

Install Foreman

Add the foreman repository.
echo "deb http://deb.theforeman.org/ focal 3.7" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 3.7" | sudo tee -a /etc/apt/sources.list.d/foreman.list

Add the Foreman key.
wget https://deb.theforeman.org/foreman.asc -O /etc/apt/trusted.gpg.d/foreman.asc

The key fingerprint is:
5B7C 3E5A 735B CB4D 6158 29DC 0BDD A991 FD7A AC8A
Foreman Automatic Signing Key (2021) <packages@theforeman.org>

Update Ubuntu repositories and install the 'foreman-installer' package
sudo apt update
sudo apt install foreman-installer -y

Run the installer.

sudo foreman-installer
 * Foreman is running at https://foreman.noise.com
 Initial credentials are admin / ************
 * Foreman Proxy is running at https://foreman.noise.com:8443
 The full log is at /var/log/foreman-installer/foreman-installer.log
Enter fullscreen mode Exit fullscreen mode

Configure UFW Firewall

Open some ports that are necessary for Foreman.

ufw allow http
ufw allow https
ufw allow ssh
ufw allow 69/udp
ufw allow 8140/tcp
Enter fullscreen mode Exit fullscreen mode

Start and enable the ufw firewall service.
ufw enable

Open the Foreman Dashboard
Now open your Firefox browser and type the foreman server IP or domain name in the Omnibox
https://foreman.noise.com

Run the Puppet Agent
Log in to the Foreman server and run the following puppet command.
sudo /opt/puppetlabs/bin/puppet agent --test

The server will automatically install and configure the NTP service using custom configuration.
After it's complete, check the '/etc/ntp.conf' configuration file.
cat /etc/ntp.conf

Ref: https://theforeman.org/manuals/

Top comments (0)