⚙️ Installing and Configuring Foreman 3.12 with Puppet 8 on Ubuntu 22.04

Foreman, combined with Puppet, provides a powerful platform for automated infrastructure management.
In this guide, you’ll learn how to install Foreman 3.12 with Puppet 8 Server on Ubuntu 22.04, configure them to work together, and set up agents for remote node management.


🖥 Step 1 – System Preparation

First, update your system and install essential dependencies:

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git gnupg2 dnsutils net-tools

🌐 Step 2 – Configure Hostname and FQDN

Foreman requires a properly set Fully Qualified Domain Name (FQDN).
Set your hostname:

sudo hostnamectl set-hostname foreman.example.com

Edit /etc/hosts and add:

10.10.0.135 foreman.example.com foreman

Verify:

hostname -f
nslookup 10.10.0.135
dig -x 10.10.0.135 +short

🗄 Step 3 – Install and Configure PostgreSQL

Foreman uses PostgreSQL as its database.

sudo apt install -y postgresql postgresql-contrib
sudo systemctl enable --now postgresql

Create the Foreman database and user:

CREATE DATABASE foreman;
CREATE USER foreman WITH PASSWORD 'foreman';
ALTER DATABASE foreman OWNER TO foreman;
GRANT ALL PRIVILEGES ON DATABASE foreman TO foreman;
\q

Create the Foreman system user:

sudo useradd -r -s /bin/bash -d /usr/share/foreman -c "Foreman system user" foreman

Test connection:

sudo -u foreman psql -d foreman -c "SELECT 1;"

🐾 Step 4 – Install Puppet 8 Server

Add the Puppet repository and install the server:

wget https://apt.puppet.com/puppet8-release-jammy.deb
sudo dpkg -i puppet8-release-jammy.deb
sudo apt update
sudo apt install -y puppetserver

(Optional) Adjust memory settings in /etc/default/puppetserver:

JAVA_ARGS="-Xms512m -Xmx1024m"

Enable and start the service:

sudo systemctl enable --now puppetserver

📦 Step 5 – Install Foreman

Add Foreman Repositories

echo "deb http://deb.theforeman.org/ jammy 3.12" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 3.12" | sudo tee -a /etc/apt/sources.list.d/foreman.list
wget -qO /etc/apt/trusted.gpg.d/foreman.asc https://deb.theforeman.org/foreman.asc
sudo apt update

Install and Run Foreman Installer

sudo apt install -y foreman-installer
sudo foreman-installer --enable-foreman --enable-foreman-cli \
  --enable-foreman-proxy --enable-puppet --enable-foreman-plugin-puppet

🔒 Step 6 – HTTPS Configuration

Check if port 443 is active:

sudo netstat -tulnp | grep 443

If needed, restart Apache:

sudo systemctl restart apache2

If no SSL certificate is available, you can temporarily disable HTTPS:

sudo foreman-installer --foreman-server-ssl false
sudo systemctl restart foreman foreman-proxy apache2

🖧 Step 7 – Firewall Rules

Ensure ports are open:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

🐶 Step 8 – Adding Puppet Agents

On each client machine:

wget https://apt.puppet.com/puppet8-release-jammy.deb
sudo dpkg -i puppet8-release-jammy.deb
sudo apt update
sudo apt install -y puppet-agent

Edit /etc/puppetlabs/puppet/puppet.conf:

[main]
server = foreman.example.com
certname = client.example.com
environment = production

Run the agent and wait for the certificate request:

sudo puppet agent --test --waitforcert 60

On the server, sign the certificate:

sudo /opt/puppetlabs/bin/puppetserver ca sign --certname client.example.com

Re-run the agent:

sudo puppet agent --test

🔄 Step 9 – Restart All Services

sudo systemctl restart foreman foreman-proxy apache2 postgresql puppetserver

✅ Conclusion

Your Foreman 3.12 + Puppet 8 setup is now ready.
From the Foreman web interface, you can:

  • Manage and monitor all connected nodes
  • Deploy Puppet configurations
  • Automate infrastructure provisioning

With this setup, you gain a centralized control panel for infrastructure automation, making server management more efficient and reliable.

🚀 Explore more guides on our blog 👉 blog.1it.pro
📧 Contact us: admin@1it.pro for expert IT guidance.
🌐 Explore more: Visit 1it.pro for top-tier IT solutions.

UA EN RU

Зв'язатися з нами

Telegram Email