
Helpdice Team
How to install puppet architecture on Linux
Installing Puppet Server
Puppet Server is the software that pushes configuration from the Puppet master to the other servers. It runs only on the Puppet master; the other hosts will run the Puppet Agent.
Step 1: Get the puppet installation package from its repository using wget command.
command: wget https://apt.puppetlabs.com/puppet-release-bionic.deb
Step 2: Make the package ready for installation using dpkg command.
command: sudo dpkg -i puppet-release-bionic.deb
Step 3: To ensure every dependicies are installed and updated.
command: sudo apt-get update
Step 4: Install the puppet master
command: sudo apt-get install puppetmaster
Step 5: To check puppet master is running .
command: sudo systemctl status puppet-master.service
Step 5: Configure memory allocation
By default, Puppet Server is configured to use 2 GB of RAM. You can customize this setting based on how much free memory the master server has and how many agent nodes it will manage.
To customize it, open /etc/default/puppetmaster
:
command: sudo vim /etc/default/puppetmaster
Then find the JAVA_ARGS
line, and use the -Xms
and -Xmx
parameters to set the memory allocation. We’ll increase ours to 3 gigabytes:
Write JAVA_ARGS="-Xms3g -Xmx3g -XX:MaxPermSize=512m" , Save and Exit the file.
Step 6: Restart puppet master service.
command: sudo systemctl restart puppet-master.service
Step 7: Allow port 8140/tcp from firewall.
command: sudo ufw allow 8140/tcp
Step 8: Enable puppet master to run in background.
command: sudo systemctl enable puppetserver
Now, Install Puppet Agent
The Puppet agent software must be installed on any server that the Puppet master will manage. In most cases, this will include every server in your infrastructure.
Step 1: To ensure every dependicies are installed and updated.
command: sudo apt-get update
Step 2: Get the puppet installation package from its repository using wget command.
command: wget https://apt.puppetlabs.com/puppet-release-bionic.deb
Step 3: Make the package ready for installation using dpkg command.
command: sudo dpkg -i puppet-release-bionic.deb
Step 4: Install the Puppet agent package.
command: sudo apt-get install puppet
Step 5: Start the agent and enable it to start on boot.
command: sudo systemctl start puppet
command: sudo systemctl enable puppet
Step 6: Edit hosts file in puppet Agent machine.
command: sudo nano /etc/hosts
Step 7: Edit hosts file in puppet master machine
command: sudo nano /etc/hosts
Configure puppet master
Step 1: we will sign the certificates on the Puppet master .
To show all available certificate to sign for connection
command: sudo puppet cert list
Step 2: To sign all the certificate sent to puppet master
command: sudo puppet cert sign –all
Create a Manifests on Puppet Server or Master
Step 1: Create a directory for manifests files.
command: sudo nano /etc/puppet/code/environments/production/manifests/site.pp
Step 2: Open site.pp with vim or nano editor. Add below code to site.pp
# execute 'apt-get update'
exec
{
'apt-update':
# exec resource named 'apt-update'
command
=>
'/usr/bin/apt-get update'
# command this resource will run
}
# install apache2 package
package
{
'apache2':
require
=>
Exec['apt-update'],
# require 'apt-update' before installing
ensure
=> installed
,
}
# ensure apache2 service is running
service
{
'apache2':
ensure
=> running
,
}
# install mysql-server package
package
{
'mysql-server':
require
=>
Exec['apt-update'],
# require 'apt-update' before installing
ensure
=> installed
,
}
# ensure mysql service is running
service
{
'mysql':
ensure
=> running
,
}
Step 3: Restart puppet-master service.
command: sudo systemctl restart puppet-master
On puppet agent machine
Step 1: Do an agent run.
command: sudo puppet agent –test
Step 2: Confirm installation of apache2
command: sudo service apache2 status