How To Install Foreman on Ubuntu 18.04

Foreman is a special tool to help you configure virtual and dedicated servers. This tool is free and it has an open source code. He is also ready to help you configure and control the server. It is a kind of a complete lifecycle management tool for physical and virtual servers.

System update

To get started, you need to upgrade your system before you install Foreman

apt-get update && apt-get upgrade 

Hostname setting

At this point, you need to edit the \etc\hosts file. You can edit from any text editor.

nano /etc/hosts

Add your server

Your IP address vps.hostry.com

Then, save your file and exit the text editor. After that, you need to configure the host name. On Ubuntu, you can use hostnamectl

hostnamectl set-hostname vps.hostry.com

Install Foreman

The Foreman Installer is a set of Puppet modules that installs everything you need for a fully functional Foreman installation. Now let’s set up 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 the necessary packages.

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

Execute the Foreman installer.

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

After you have completed, and if you have completed the correct steps, you will see “SUCCESS

Firewall configuration

You need to execute the following commands, one at a time

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

Then enable the firewall service

ufw enable

Next, you will be presented with a window for accepting changes, press Y

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

Web Interface

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

Install NTP Module

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

In the Foreman web console, go to Configure> Puppet> Classes and click Import from hostname (server.vultr.local) to read the available Puppet classes from the Puppet wizard and populate the Foreman database. Select the NTP module and click on the Update button.

Done! From now on, you can control the NTP module and Foreman from its control panel.

Was this article helpful?

Related Articles

Leave A Comment?