This guide has been written to help you install Foreman on Ubuntu 18.04 LTS server. Foreman is an open source tool for managing servers lifecycle, from provisioning and configuration to orchestration and monitoring. By using Chef, Puppet, Salt, Ansible and Foreman’s smart proxy architecture, you can easily automate repetitive tasks, quickly deploy applications, and proactively manage change, both on-premise with VMs and bare-metal or in the cloud.
For Debian: Install and Configure Foreman on Debian
For Ubuntu 20.04: Install Foreman on Ubuntu 20.04
With Foreman you can:
- Discover, provision and upgrade your entire bare-metal infrastructure
- Create and manage instances across private and public clouds
- Group your hosts and manage them in bulk, regardless of location
- Review historical changes for auditing or troubleshooting
- Extend as needed via a robust plugin architecture
- Automatically build images (on each platform) per system definition to optimize deployment
Foreman also provides a RESTful API, CLI, web frontend, which enables you to build higher-level business logic and to interact with the software.
Install Foreman on Ubuntu 18.04 LTS
Foreman has an automated installer which installs and configures Foreman, a Puppet master, and the Smart Proxy for you. It’s not advisable to run foreman installer on an existing system with other services since it will affect the configuration of several components.
As a pre-requisite, make sure you have a valid hostname with A record on file
sudo hostnamectl set-hostname foreman.example.com
Update DNS name and IP on
$ sudo vim /etc/hosts 192.168.10.61 foreman.example.com
Step 1: Add Puppet Repository
The first step in the installation of Foreman on Ubuntu 18.04 is the setup of repositories required.
Start by adding the Puppet Labs repository that will be used to install Puppet 5.x with Puppet Agent and Puppet Server:
sudo apt -y update sudo apt -y install ca-certificates wget wget https://apt.puppet.com/puppet6-release-bionic.deb sudo dpkg -i ./puppet6-release-bionic.deb
Step 2: Install Foreman installer on Ubuntu 18.04 LTS
Once this has been installed, proceed to enable Foreman repository for Ubuntu 18.04.
echo "deb http://deb.theforeman.org/ bionic 3.0" | sudo tee /etc/apt/sources.list.d/foreman.list echo "deb http://deb.theforeman.org/ plugins 3.0" | sudo tee -a /etc/apt/sources.list.d/foreman.list
Import GPG key for the repository:
sudo apt -y install ca-certificates wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -
Now download the foreman installer:
sudo apt update sudo apt -y install foreman-installer
Step 3: Running foreman installer on Ubuntu 18.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 18.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:
$ 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:
More examples are given in the Installation Options section. Adding option
-v will disable the progress bar and display all changes.
After it completes the installation, some details about Foreman, Smart Proxy and Puppet Master will be printed on the screen. The output should be similar to this:
.......... Success! * Foreman is running at https://foreman.computingforgeeks.com Initial credentials are admin / znp2cEU93suAt7EA * Foreman Proxy is running at https://foreman.computingforgeeks.com:8443 * Puppetmaster is running at port 8140 The full log is at /var/log/foreman-installer/foreman.log
Test installation by running puppet agent
# puppet agent --test Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Retrieving locales Info: Caching catalog for foreman.example.com Info: Applying configuration version '1571335132' Notice: Applied catalog in 0.09 seconds
Step 4: Access Foreman Web UI on Ubuntu 18.04
Now that the installation was successful, login to Foreman web admin interface to start administering it. In my case, the URL is
https://foreman.computingpost.com. Accept Invalid certificate warning when prompted.
Login with the username admin and the password shown on the screen after the installation. You should get to Foreman admin interface.
Refer to https://www.theforeman.org/documentation.html for how to guides. We will be adding more guides on configuring Foreman.
Reference and more reading: