Tutorials  /  Linux Basics

Install SaltStack on CentOS 7: Master and Minion Setup

Ccentron Redaktion · July 2025 ·6 min read ·Linux Basics, Tutorial

SaltStack, commonly referred to as Salt, is an open-source platform used for managing configurations, executing remote commands, deploying code, and more. With its intuitive interface, excellent scalability, and powerful capabilities, Salt can manage vast server infrastructures simultaneously. Its efficiency and ease of deployment have made it a favored tool for infrastructure automation worldwide.

This guide will walk you through the installation of Salt on two CentOS 7 servers using the agent-master model. In this setup, one server acts as the master while the other serves as the agent (minion). Additional minions can be added later as needed.

Prerequisites

Before starting, ensure the following conditions are met:

  • Two CentOS 7 servers are deployed in the same data center.
  • Private networking is configured on both machines. Refer to the article Configuring Private Network.
  • Each machine has a non-root user with sudo privileges.

Here is a summary of the server details:

Salt Master Server

  • Operating System: CentOS 7
  • Hostname: master
  • Private IP: 10.99.0.10

Salt Agent Server 1

  • Operating System: CentOS 7
  • Hostname: minion1
  • Private IP: 10.99.0.11
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 1: Tasks on the Salt Master Server

1.1 Perform a System Update

Log in to the Salt master server using the sudo-enabled user and update the system:

Console
sudo yum update -y && sudo reboot

After the system reboots, log back in with the same user.

1.2 Install and Set Up the salt-master Service

Install the latest version of salt-master using the official YUM repository:

Console
sudo yum install https://repo.saltstack.com/yum/redhat/salt-repo-2015.8-2.el7.noarch.rpm
sudo yum clean expire-cache
sudo yum install salt-master

Next, edit the configuration file:

Console
sudo vi /etc/salt/master

Locate the following line:

Code
#interface: 0.0.0.0

And replace it with:

Code
interface: 10.99.0.10

Then find this line:

Code
#hash_type: md5

And change it to:

Code
hash_type: sha256

Save and exit the editor:

Code
:wq

Now start and enable the Salt master service:

Console
sudo systemctl start salt-master.service
sudo systemctl enable salt-master.service

1.3 Adjust Firewall Settings

The master server uses TCP ports 4505 and 4506 to communicate with minions. These ports need to be opened in the firewall.

First, determine the zone of the eth1 interface:

Console
sudo firewall-cmd --get-active-zones

You'll find that eth1 belongs to the "public" zone. Allow the necessary traffic in that zone:

Console
sudo firewall-cmd --permanent --zone=public --add-port=4505-4506/tcp
sudo firewall-cmd --reload

At this point, the master server is fully prepared. The next step is to set up the Salt agent server.

Step 2: Tasks on the Salt Agent Server

2.1 Perform a System Update

Log into the Salt agent server using the sudo-enabled user and update the system:

Console
sudo yum update -y && sudo reboot

Once the reboot is complete, log in again using the same sudo user.

2.2 Install and Configure the salt-minion Service

Install the salt-minion package using the SaltStack repository:

Console
sudo yum install https://repo.saltstack.com/yum/redhat/salt-repo-2015.8-2.el7.noarch.rpm
sudo yum clean expire-cache
sudo yum install salt-minion

Once installed, edit the minion configuration file:

Console
sudo vi /etc/salt/minion

Search for this line:

Code
#master: salt

Replace it with the following:

Code
master: 10.99.0.10

Next, find:

Code
#hash_type: sha256

And replace it with:

Code
hash_type: sha256

Save and exit:

Code
:wq

Now start and enable the Salt minion service:

Console
sudo systemctl start salt-minion.service
sudo systemctl enable salt-minion.service

Once the minion starts, it will try to connect to the Salt master server.

If you plan to add more minion servers, simply repeat the same setup procedure for each.

Step 3: Verify the Configuration from the Master Server

Return to the SSH session on the Salt master server and list all detected minions:

Console
sudo salt-key -L

If the minion was configured correctly, you will see the following:

Accepted Keys:
Denied Keys:
Unaccepted Keys:
minion1
Rejected Keys:

To authorize the minion:

Console
sudo salt-key --accept=minion1

Or to approve all waiting minions at once:

Console
sudo salt-key -A

Now test the communication with the minion.

Example 1: Ping the Minion

Console
sudo salt minion1 test.ping

The result should look like:

minion1:
    True

Example 2: Run a Command Remotely

Console
sudo salt minion1 cmd.run pwd

The expected output:

minion1:
    /root

Conclusion

By following this guide, you have successfully configured a Salt master and a minion server on CentOS 7. The agent-master model is now operational, allowing you to remotely execute commands, automate configurations, and expand your infrastructure as needed. SaltStack provides a robust and scalable solution to streamline system administration tasks across multiple machines efficiently.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Unser Team hilft Ihnen bei Ihrem konkreten Setup weiter – von Menschen, die die Plattform selbst betreiben.

War dieses Tutorial hilfreich?

Ihre Antwort wird anonym gespeichert und hilft uns, die Tutorials zu verbessern.

Kommentare

Noch keine Kommentare – stellen Sie die erste Frage zu diesem Tutorial.

Zum Kommentieren anmelden

Kommentare stehen centron-Kunden offen. Melden Sie sich in Ihrem Konto an, um eine Frage zu diesem Tutorial zu stellen.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren