Foreman is a free and open source tool for managing servers lifecycle – provisioning and configuration to orchestration and monitoring. With automation tools available as plugins, such as Ansible, Chef, Salt and Puppet, it becomes so easy to automate repetitive tasks. This is with faster deployment application and ensuring there is proactive change management, both on-premise with VMs and bare-metal or in the cloud.
This article will help you install Foreman 3.x on Ubuntu 20.04 (Focal Fossa). Below is the system architecture of Foreman.
Some of its key features unlocked for you are:
- Discover, provision and upgrade your entire bare-metal infrastructure
- Create and manage instances in virtualization environment and across private and public clouds
- Install operating systems via PXE, local media or from templates or images
- Control and gather reports from your configuration management software
- Group your hosts and manage them in bulk, regardless of location
- Review historical changes for auditing or troubleshooting
- Web user interface, JSON REST API and CLI for Linux
- Extend as needed via a robust plugin architecture
Install Foreman 3.x on Ubuntu 20.04 (Focal Fossa)
Below are the steps you’ll follow to install Foreman 3.x on Ubuntu 20.04 (Focal Fossa).
Step 1: Set System hostname
You need a proper hostname configured for your machine that can be resolved to an IP address.
$ sudo hostnamectl set-hostname foreman.example.com $ sudo vim /etc/hosts 192.168.100.21 foreman.example.com
Replace the hostname and the IP address with your actual values.
Ensure that the command below shows the real IP address, not 127.0.1.1.
$ ping -c 2 $(hostname -f) PING foreman.example.com (192.168.100.21) 56(84) bytes of data. 64 bytes from foreman.example.com (192.168.100.21): icmp_seq=1 ttl=64 time=0.052 ms 64 bytes from foreman.example.com (192.168.100.21): icmp_seq=2 ttl=64 time=0.035 ms --- foreman.example.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1023ms rtt min/avg/max/mdev = 0.035/0.043/0.052/0.010 ms
If it returns 127.0.0.1, Change or remove this entry from /etc/hosts file if present.
Step 2: Update System
Once the hostname is configured correctly, update your system to get the latest packages.
sudo apt update && sudo apt upgrade -y [ -f /var/run/reboot-required ] && sudo reboot -f
Step 3: Add Puppet and Foreman Repositories
Add the Puppet and Foreman repositories required for both dependencies and actual Foreman packages installation.
Add Puppet repository to Ubuntu 20.04:
sudo apt update sudo apt -y install ca-certificates wget wget https://apt.puppet.com/puppet6-release-focal.deb sudo dpkg -i puppet6-release-focal.deb
Add Foreman repository to system.
sudo apt -y install gpg ca-certificates echo "deb http://deb.theforeman.org/ focal nightly" | sudo tee /etc/apt/sources.list.d/foreman.list echo "deb http://deb.theforeman.org/ plugins nightly" | sudo tee -a /etc/apt/sources.list.d/foreman.list wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -
Step 4: Install Foreman Installer
Once the repositories are added, you should be ready to install Foreman on Ubuntu 20.04 (Focal Fossa).
sudo apt update sudo apt install foreman-installer
Hit the y key to accept installation.
Step 5: Run foreman installer on Ubuntu 20.04
When the installation of foreman installer is complete, you need to run it to configure and prepare Foreman components. The Foreman installer is a collection of Puppet modules that installs everything required for a full working Foreman setup on Ubuntu 20.04 LTS.
By default it will configure:
- Apache HTTP with SSL (using a Puppet-signed certificate)
- Foreman running under mod_passenger
- Smart Proxy configured for Puppet, TFTP and SSL
- Puppet master running under mod_passenger
- Puppet agent configured
- TFTP server (under xinetd on Red Hat platforms)
Note that installation of foreman runs is a non-interactive mode by default, but the configuration can be customized by supplying any of the options listed in:
$ sudo foreman-installer --help
To run foreman installation in interactive mode, use:
sudo foreman-installer -i
To run the installation in a non-interactive mode, use:
If Smart Proxy, Puppet master are installed along Foreman, the installer will output details about them after the installation.
Preparing installation Done Success! * Foreman is running at https://foreman.example.com Initial credentials are admin / yafNTaFNNJRUGP84 * Foreman Proxy is running at https://foreman.example.com:8443 The full log is at /var/log/foreman-installer/foreman.log
Use the details given in the output to login to Foreman Dashboard.
The Foreman Administration dashboard have a look like this:
Read more on how to administer Foreman and benefit from from its cool features