Bobcares

Steps to install Puppet on CentOS 7

by | Oct 27, 2020

Willing to install puppet on CentOS 7? Here are the steps for it.

Here at Bobcares, we have seen several such CentOS related queries as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to install puppet on CentOS 7.

 

A few facts about Puppet

Puppet is open-source task-controlling software that manages Linux and Windows server functions from a central master server. It uses a master/client set up to communicate between the master and client servers.

Moreover, it reduces the time spent repeating the basic tasks.

This way, it ensures that the configurations are consistent and accurate across your infrastructure.

 

How to install Puppet on CentOS 7

Now let’s see how our Support Engineers install the Puppet.

 

1. Puppet Pre-Installation

As a first step, we shall make some installation and configuration on both the servers puppet master and puppet agent.

 

Configure hosts

Now connect to the puppet master and agent using your root user via SSH.

Then edit the hosts using vim editor.

# vim /etc/hosts

At the end of the line, add the below configuration.

10.0.15.10 master.bob.com
10.0.15.11 agent.bob.com

Save the file and exit.

Then test it by running the ping command.

ping master.bob.com
ping agent.bob.com

As a result, of the above command, you must get the server IP address 10.0.15.10 and 10.0.15.11.

 

Configure NTP Server

The time between the master and agent server must be kept in synchronization.

Now install the NTP packages on both servers by running the below command.

# yum -y install ntp ntpdate

Once the installation completes, choose the NTP pool as you want by running the command as below.

$ sudo ntpdate 0.centos.pool.ntp.org

Then start the NTP service and enable it to launch every time at system boot.

$ sudo systemctl start ntpd
$ sudo systemctl enable ntpd

This completes the NTP installation and configuration.

 

Disable SELinux

Use any editor to edit the SELinux configuration file.

# vim /etc/sysconfig/selinux

Then change the SELINUX value to ‘disabled’.

SELINUX=disabled

Now save the file and exit.

 

Add Puppet Repository

In order to add the puppet repository to the system, run the below rpm command.

# rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm

Once it completes, reboot both the servers.

# reboot

 

2. Install and Configure Puppetserver

Now we shall install and configure Puppetserver on the master.bob.com server. Run the below yum command to install it.

$ sudo yum -y install puppetserver

Once the installation completes, we need to configure the memory allocation for puppetserver. Now we shall set the max memory allocation for puppetserver to 1GB. For that, edit the ‘puppetserver’ configuration.

# vim /etc/sysconfig/puppetserver

Change the line as below.

JAVA_ARGS=”-Xms1g -Xmx1g ….”

Save the file and exit.

After that, go to the puppet configuration directory and edit the ‘puppet.conf’ file.

# cd /etc/puppetlabs/puppet
# vim puppet.conf

Add the following configuration.

[master]
dns_alt_names=master.bob.com,puppet

[main]
certname = master.bob.com
server = master.bob.com
environment = production
runinterval = 1h

Then save the file and exit.

Now start the puppetserver and enable it to launch everytime at startup.

# systemctl start puppetserver
# systemctl enable puppetserver

This completes the Puppetserver installation and configuration.

In case, if you are using the firewalld on your system, add the puppetserver port to the list using the firewall-cmd command below.

firewall-cmd –add-port=8140/tcp –permanent
firewall-cmd –reload

 

3. Install and Configure Puppet Agent

Now we will install the puppet agent on the ‘agent.bob.com’ server. For doing that, run the below command to install the puppet agent.

# yum install -y puppet-agent

Once the installation completes, access the puppet configuration directory and edit the puppet.conf file.

# cd /etc/puppetlabs/puppet
# vim puppet.conf

Then paste the below configuration.

[main]
certname = agent.bob.com
server = master.bob.com
environment = production
runinterval = 1h

Save and exit the file.

Now we shall register the puppet agent to the puppet master. So execute the below command on the puppet agent shell.

# /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true

The puppet agent is now running on the server, and it is attempting to register itself to the puppet master.

Go back to the puppet master shell and run the below command.

# /opt/puppetlabs/bin/puppet cert list

Then you will get the pending Certificate Signing Request (CSR) from the puppet agent server ‘agent.bob.com’.

Next, run the below command to sign the certificate.

# /opt/puppetlabs/bin/puppet cert sign agent.bob.com

So now the puppet agent is running on the system, and the certificate for the agent has been signed by the puppet master.

 

4. Verify the Puppet Agent Configuration

Once the puppet master signed the certificate file for the agent, run the below command on the puppet agent to verify the configuration.

# /opt/puppetlabs/bin/puppet agent –test

You must see a result as below.

The Puppet agent pulled the configuration from the puppet master and applied it to the server without any error.

 

5. Create First Manifest

Now we shall create a simple manifest for testing.

Go to the ‘/etc/puppetlabs/code/’ directory and create the new manifest file ‘site.pp’ on the puppet master server.

# cd /etc/puppetlabs/code/
# cd environments/production/manifests

Then create new manifest file.

# vim site.pp

After that, paste the below configuration.

node ‘agent.bob.com’ {
package { ‘httpd’:
ensure => “installed”,
}
service { ‘httpd’:
ensure => running,
enable => true
}
}

Save the file and exit.

Next, run the below command to open the puppet agent server shell.

# /opt/puppetlabs/bin/puppet agent –test

This command retrieves a new manifest configuration file from the puppet master and then applies it to the agent server.

Now access the web browser and type the IP address of the puppet agent.

http://10.0.15.11/

You will get a default HTTP page.

Now, the httpd web server has been installed using the puppet manifest.

Finally, the installation and configuration of Puppet Master and Puppet Agent on CentOS 7 has been completed successfully.

[Need any further assistance with CentOS queries? – We are here to help you.]

 

Conclusion

In today’s writeup, we saw how our Support Engineers install Puppet on CentOS 7.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF