19 C
Texas

How To Install Foreman 2.x on Ubuntu 20.04

In this tutorial you will learn that how to install Foreman 2.x on Ubuntu 20.04. Before going to the installation procedure let’s have a short introduction about Foreman.

Introduction:

Foreman is an open-source tool used for the management of server life-cycle monitoring and configuration to orchestration. With the help of different automation tools like Ansible, Chef, Salt, Puppet, you can easily control the repetitive tasks and automate them to save time. So, it helps you to save your time as well as perform tasks fast and smooth. Here we’ll see some important features of Foreman.

Some features:

  • 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

Now, we are going to install Foreman 2.x on Ubuntu 20.04.

Step 1: Update Your System

Before going to install any new package, update your system to have the latest packages install. To update simply run the following command in your terminal.

- Advertisement -
sudo apt update

Step 2: Set Up Hostname

After the update is finished, set up a proper hostname as it will be resolved to an IP address. Hit the below command to set the hostname.

sudo hostnamectl set-hostname foreman.example.com
echo "192.168.135.142 foreman.exmaple.com" | sudo tee -a /etc/hosts

Make sure to replace the hostname & the IP address with your actual values. Hit the below command to confirm. Also make sure that the command show the real IP address instead of localhost address.

ping -c 2 $(hostname -f)

Output:

sabir@foreman:~$ ping -c 2 $(hostname -f)
PING foreman.example.com (192.168.135.142) 56(84) bytes of data.
64 bytes from foreman.example.com (192.168.135.142): icmp_seq=1 ttl=64 time=0.024 ms
64 bytes from foreman.example.com (192.168.135.142): icmp_seq=2 ttl=64 time=0.071 ms
--- foreman.example.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.024/0.047/0.071/0.023 ms

Step 3: Reboot Your System

After making the above changes, update and reboot your system to take the effect of applied changes.

sudo apt update && sudo apt upgrade
sudo systemctl reboot

Step 4: Add Puppet & Foreman Repository

As Puppet & Foreman repository are needed for the installation of Foreman package so we’ve to first add them before initializing the installation. Hit the given command to add the puppet repository on Ubuntu 20.04.

sudo apt update
sudo apt -y install ca-certificates wget
wget https://apt.puppet.com/puppet6-release-focal.deb
sudo apt install ./puppet6-release-focal.deb

After it add the Foreman repo with the help of below command.

sudo apt -y install gpg ca-certificates
echo "deb http://deb.theforeman.org/ bionic 2.0" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 2.0" | sudo tee -a /etc/apt/sources.list.d/foreman.list
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -

Step 5: Install Foreman Installer

As we’ve completed the above requirements so now we’ll install the Foreman installer on Ubuntu 20.04. Simply type the following command in your terminal.

sudo apt update
sudo apt install foreman-installer

Allow the installation by typing “Y“.

The following additional packages will be installed:
libgdbm-compat4 libruby2.5 puppet-agent rake ruby ruby-ansi ruby-clamp ruby-did-you-mean ruby-hashie ruby-highline ruby-kafo ruby-kafo-parsers
ruby-kafo-wizards ruby-little-plugger ruby-logging ruby-minitest ruby-multi-json ruby-net-telnet ruby-power-assert ruby-powerbar ruby-test-unit
ruby2.5 rubygems-integration
Suggested packages:
ri ruby-dev bundler
Recommended packages:
zip ruby-oj fonts-lato libjs-jquery
The following NEW packages will be installed:
foreman-installer libgdbm-compat4 libruby2.5 puppet-agent rake ruby ruby-ansi ruby-clamp ruby-did-you-mean ruby-hashie ruby-highline ruby-kafo
ruby-kafo-parsers ruby-kafo-wizards ruby-little-plugger ruby-logging ruby-minitest ruby-multi-json ruby-net-telnet ruby-power-assert ruby-powerbar
ruby-test-unit ruby2.5 rubygems-integration
0 upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 27.4 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Step 6: Configure Foreman Installer

Once the installation finished, configure the Foreman installer. Here we’ll introduce some commands to use Foreman on Ubuntu 20.04.

To seek for help it’s good idea to read the manual by hitting the below command.

foreman-installer --help

Foreman comes with the non-interactive mode installation, if you want to run it in interactive mode, hit

sudo foreman-installer -i

For non-interactive mode, type

sudo foreman-installer

Installer will print the information of Smart Proxy and the Puppet master if they are installed while installing the Foreman package like this

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

Make sure to save these credentials to log in to the Foreman Dashboard.

How To Install Foreman 2.x on Ubuntu 20.04

You’ll be directed to the dashboard.

How To Install Foreman 2.x on Ubuntu 20.04

So, this is how you can install Foreman on Ubuntu 20.04.

Please share this post and join our Telegram Channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article