How to Install Foreman on CentOS 7
Using a Different System?
Prerequisites
- CentOS 7 server.
- Root user access.
Update System
Update your system before installing Foreman.
yum -y update
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
Next, you’ll need to setup a hostname.
nano /etc/hostname
Enter your hostname, be sure to change it to your own hostname.
server.vultr.local
Save the file and exit from the text editor.
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 full working Foreman setup.
Now let’s configure the EPEL, Puppet and Foreman repositories.
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
rpm -ivh http://yum.theforeman.org/releases/1.9/el7/x86_64/foreman-release.rpm
Install the Foreman installer so that it can install Foreman and all of its required packages.
yum -y install foreman-installer
Execute the Foreman installer. It’ll take some.
foreman-installer
You’ll see Success
as output on completion of installation.
Firewall Configuration
Execute following commands one by one.
firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --permanent --add-port=67-69/udp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --permanent --add-port=3000/tcp
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --permanent --add-port=5910-5930/tcp
firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=8140/tcp
firewall-cmd --permanent --add-port=8443/tcp
Reload firewall services.
firewall-cmd --reload
Web Interface
Open up your web browser and visit http://YourServerIP
or http://FQDN
to access Foreman web interface. You’ll see a login webpage, so enter your Foreman username
and password
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.