How to Install Foreman on Ubuntu 16.04 LTS

Published on: Fri, May 18, 2018 at 11:02 am EST
DevOps Linux Guides Ubuntu

Foreman is a free and open source tool which helps you with configuration and management of physical and virtual servers. Foreman also helps you to provision and monitor your server.

Prerequisites

Update System

Update your system before installing Foreman.

apt-get update && apt-get upgrade 

Setup a Hostname

You'll have to edit the /etc/hosts file using any text editor.

nano /etc/hosts

Add your server.

198.51.100.0 server.vultr.local server

Save the file and exit from the text editor.

Next, you'll need to setup a hostname. On Ubuntu we can use hostnamectl.

hostnamectl set-hostname server.vultr.local

Note: The above commands are examples. You should change them to your own.

Install Foreman

The Foreman installer is a collection of Puppet modules that installs everything required for a fully working Foreman setup.

Now let's configure the EPEL, Puppet and Foreman repositories.

echo "deb http://deb.theforeman.org/ xenial 1.12" > /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 1.12" >> /etc/apt/sources.list.d/foreman.list
apt-get -y install ca-certificates
wget -q https://deb.theforeman.org/pubkey.gpg -O- | apt-key add -

Install the Foreman installer so that it can install Foreman and all of its required packages.

apt-get update && apt-get -y install foreman-installer

Execute the Foreman installer.

foreman-installer --foreman-admin-password=mysupersecretpassword

You will see Success upon completion of the installation.

Firewall Configuration

Execute following commands one by one.

ufw allow 53/tcp
ufw allow 67-69/udp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 3000/tcp
ufw allow 3306/tcp
ufw allow 5910-5930/tcp
ufw allow 5432/tcp
ufw allow 8140/tcp
ufw allow 8443/tcp

Enable the firewall services.

ufw enable

The firewall will prompt a dialog to accept changes. Press Y

Command may disrupt existing ssh connections. Proceed with operation (y|n)?

Web Interface

Open up your web browser and visit http://YourServerIP or http://FQDN to access the Foreman web interface. You will see a login webpage, so enter your Foreman username and the password we created earlier, mysupersecretpassword, and then click the Login button.

Install NTP Module

NTP module is one of the most important requirements of Puppet for managing the NTP services.

puppet module install -i /etc/puppet/environments/production/modules saz/ntp

In the Foreman web console, go to Configure > Puppet > Classes and click on Import from hostname (server.vultr.local) to read the available Puppet classes from the puppet master and populate Foreman’s database.

Select the NTP module and click on the Update button.

Now you can manage NTP module and Foreman from its dashboard.

Want to contribute ?

You could earn up to $300 by adding new articles