How to Install SaltStack IT Automation Framework on Debian 12 (2024)

This tutorial exists for these OS versions

  • Debian 12 (Bookworm)
  • Debian 11 (Bullseye)

On this page

  1. Prerequisites
  2. Setup /etc/hosts file
  3. Adding SaltStack repository
  4. Setting up UFW
  5. Installing Salt Master
  6. Installing Salt Minion
  7. Adding Salt Minion to Salt Master
  8. Running arbitrary command via SaltStack
  9. Creating Salt State for LAMP Stack installation
  10. Conclusion

Salt or Saltstack is an open-source IT automation framework written in Python. It allows administrators to execute commands remotely to multiple machines directly.

Salt is designed with Master and Minion architecture. Salt master is the central controller of Salt configuration management, and Minions are servers managed by Salt master, or you named minions as target servers.

This guide'll show you how to install SaltStack on Debian 12 servers. We'll show you how to install Salt Master and Minion, how to run arbitrary commands via Salt, and then create the first Salt state for installing LAMP Stack.

Prerequisites

Before you start, make sure you have the following:

  • Two or three Debian 12 servers - In this example, we'll be using master server on 192.168.5.15 and the minion1 server on 192.168.5.21.
  • A non-root user with administrator privileges.

Setup /etc/hosts file

In this section, you will set up the /etc/hosts file so each server can connect via hostname, which is easier than using an IP address.

Open the /etc/hosts file using the following nano editor.

sudo nano /etc/hosts

Insert details host and IP address into the file. Make sure to change the IP addresses and hostnames with your information.

192.168.5.15 master
192.168.5.21 minion1

Save and exit the file when done.

Adding SaltStack repository

After setting up the/etc/hosts file, you must add the SaltStack repository to all of your Debian servers. The SaltStack provides an official repository for most Linux distributions, including the latest Debian 12.

First, create a new directory /etc/apt/keyrings using the command below.

mkdir /etc/apt/keyrings

Download the GPG key for the SaltStack repository with the command below.

sudo curl -fsSL -o /etc/apt/keyrings/salt-archive-keyring-2023.gpg https://repo.saltproject.io/salt/py3/debian/12/amd64/SALT-PROJECT-GPG-PUBKEY-2023.gpg

Once the GPG key is downloaded, add the SaltStack repository using the following command.

echo "deb [signed-by=/etc/apt/keyrings/salt-archive-keyring-2023.gpg arch=amd64] https://repo.saltproject.io/salt/py3/debian/12/amd64/latest bookworm main" | sudo tee /etc/apt/sources.list.d/salt.list

Now update and refresh your Debian package index.

sudo apt update

You can see below the SaltStack repository added to Debian servers.

Setting up UFW

In this example, you will set up and enable UFW (Uncomplicated Firewall) across your Debian servers. So you'll install UFW, open the SSH port, then start and enable UFW.

Install UFW on your Debian system using the command below.

sudo apt install ufw -y

Once UFW is installed, execute the following command to enable the OpenSSH application profile. You will see output Rules added.

sudo ufw allow OpenSSH

Now enable UFW using the command below. Enter y to confirm, start, and enable UFW.

sudo ufw enable

You will get an output 'Firewall is active ...' once UFW is started and enabled.

Installing Salt Master

After you have completed tasks on top, you're ready to install SaltStack. You will install and configure the Salt Master on the master server.

On the master server, run the command below to install the salt-master package. Input Y to confirm with the installation.

sudo apt install salt-master

After installation is finished, open the default Salt Master configuration /etc/salt/master using the nano editor command below.

sudo nano /etc/salt/master

Change the default interface with your local IP address. In this example, the master server IP address at 192.168.5.15.

interface: 192.168.5.15

Save the file and exit when finished.

Now run the command below to restart the salt-master service and apply your changes.

sudo systemctl restart salt-master

Then verify the salt-master service to ensure that the service is running.

sudo systemctl status salt-master

If running, you will see an output such as active (running).

Next, run the command below to open TCP ports 4505 and 4506 which Salt Master will use.

sudo ufw allow 4505,4506/tcp

Lastly, check the list of ports in your master server using the command below. Make sure access to ports 4505 and 4506 is allowed.

sudo ufw status

Installing Salt Minion

Now that you have configured Salt Master move on to configure Salt Manion on the minion1 server. You will install salt-minion and then configure it to connect to the Salt Master server.

Install the salt-minion package to the minion1 server using the command below. Input Y to confirm the installation.

sudo apt install salt-minion

Once the installation is finished, open the Salt Minion configuration /etc/salt/minion using the nano editor command.

sudo nano /etc/salt/minion

Input your Salt Master IP address to the master parameter like the following:

master: 192.168.5.15

save the file and exit the editor.

Next, run the command below to restart the salt-minion service and apply your changes.

sudo systemctl restart salt-minion

Lastly, verify the salt-minion service to ensure that the service is running. The Salt Minion will automatically register to the Salt Master server.

sudo systemctl status salt-minion

Make sure the salt-minion service is running like the following:

Adding Salt Minion to Salt Master

After configuring Salt Minion, you still need to accept the registration key from the Minion servers.

First, run the command below to verify the list key on the master server.

salt-key --finger-all

If everything goes well, you can see the key for the minion1 server or Salt Minion servers.

Now run the command below to accept the key for the minion1 server. Input Y to confirm and accept the key.

salt-key -a minion1

Next, verify again the list key on the minion1 server. You will see the key for the minion1 server listed in the Accepted Keys section.

salt-key --finger-all

Now you can test the connection to the Salt Minion server using the command. you can specify the target server with the hostname, or you can use the '*' character to target all available Salt Minion servers.

salt minion1 test.ping
salt * test.ping

If the connection to Salt Minion is successful, you will see an output 'True'.

Lastly, verify the Salt version using the command below.

salt minion1 test.version

In this example, the Salt Minion 3007.0 is installed.

Running arbitrary command via SaltStack

With everything configured, you will test your SaltStack installation by running the arbitrary command on the minion1 server from the master server.

Run the command below to update the repository package index for Minion servers.

salt '*' pkg.refresh_db

Now run the command below to package updates on the target server.

salt '*' pkg.list_upgrades

Next, run the following command to show information about the apache2 package.

salt '*' pkg.show apache2

To check running services on the Minion server, run the command below.

salt '*' service.get_running
salt '*' service.execs

Creating Salt State for LAMP Stack installation

In this section, you will learn how to create the first SaltState for installing LAMP Stack (Apache, MariaDB, and PHP) to the minion1 server.

First, create a new directory /srv/salt/lamp using the command below.

mkdir -p /srv/salt/lamp

Now create a new Salt state init file /srv/salt/lamp/init.sls using the following nano editor.

nano /srv/salt/lamp/init.sls

Add the configuration below to the file. With this, you will install LAMP Stack (Apache, MariaDB, and PHP) on the target server.

lamp_stack:
pkg.installed:
- pkgs:
- apache2
- mariadb-server
- php
- libapache2-mod-php

apache2:
service.running:
- enable: True
- reload: True

mariadb:
service.running:
- enable: True
- reload: True

Save the file and exit.

Now run the command below to verify your Salt state configuration against Salt Minion. Make sure you don't have any errors.

sudo salt * state.show_sls lamp

Next, run the command below to apply the Salt state 'lamp' to the minion1 server.

sudo salt minion1 state.apply lamp

When the process complete, you will get the following output:

Lastly, run the command below to verify Apache and MariaDB services on the minion1 server.

salt '*' service.get_running

Make sure both apache2 and mariadb services are running.

Conclusion

Congratulations! You have completed the installation of SaltStack (Salt Master and Minion) on Debian 12 servers. You also learned how to run the arbitrary command against Minion servers and created the first Salt state for installing LAMP Stack (Apache2, MariaDB, and PHP).

How to Install SaltStack IT Automation Framework on Debian 12 (2024)

FAQs

How to Install SaltStack IT Automation Framework on Debian 12? ›

SaltStack is a powerful tool for automating infrastructure management and can greatly simplify the process of managing cloud servers or instances. The installation and configuration process is straightforward, requiring the installation of the Salt master and minion components.

How to install salt minion on Debian 12? ›

Install Salt on Debian 12 (Bookworm) amd64
  1. Run sudo apt-get update to update your packages.
  2. sudo apt-get install salt-master sudo apt-get install salt-minion sudo apt-get install salt-ssh sudo apt-get install salt-syndic sudo apt-get install salt-cloud sudo apt-get install salt-api.

How do I install and configure SaltStack? ›

My library
  1. Install the license key.
  2. Install and configure the Master Plugin.
  3. Check the RaaS configuration file.
  4. Log in for the first time and change default credentials.
  5. Accept the Salt master key and back up data.
  6. Set up SSL certificates.
  7. Set up Single Sign-On (SSO)
  8. Configure SaltStack SecOps.
Feb 3, 2023

What components need to be installed on machines where we intend to automate infrastructure management with salt stack? ›

SaltStack is a powerful tool for automating infrastructure management and can greatly simplify the process of managing cloud servers or instances. The installation and configuration process is straightforward, requiring the installation of the Salt master and minion components.

How to install SaltStack on Windows? ›

To install Salt on Windows:
  1. Download the Salt installation file for Windows. See Windows downloads for a list of the latest downloads.
  2. Run the file to install Salt with a graphical user interface. You can optionally run the file from the command line.

How to install Salt minion on Linux? ›

After installing Salt on your operating system, you need to complete the following post-installation steps:
  1. Configure the Salt master and minions.
  2. Start the master and minion services.
  3. Accept the minion keys.
  4. Verify a Salt install.
  5. Install dependencies.

How to install stuff on Debian? ›

Run sudo apt-get install packageName to install the package.
  1. If additional dependencies are required for the package to install, follow the on-screen instructions to choose whether to install them now.
  2. To remove an installed package, use sudo apt-get remove packageName .
Nov 26, 2023

Is Salt better than ansible? ›

Ansible is known for its ease of use, thanks to a more flexible agentless approach, which requires no additional software to be installed on the targets being automated. By contrast, Salt takes an agent-based approach, meaning additional software is required on each machine.

What is Salt automation? ›

The Salt system is a Python-based, open-source remote execution framework for configuration management, automation, provisioning, and orchestration. Salt delivers a dynamic communication bus for infrastructure to leverage in: Remote execution. Configuration management. Automation and orchestration.

What is the command you must enter to setup your machine as a Salt master? ›

Setting Up the Salt Master
  1. systemctl start salt-master.
  2. service salt-master start.
  3. /etc/init.d/salt-master start.
  4. salt-master -d.
  5. salt-master -l debug.

Does SaltStack have a GUI? ›

SaltGUI is an open source web interface for managing a SaltStack server and its minions. Built using vanilla ES6 and implemented as a wrapper around the rest_cherrypy server a.k.a. salt-api. The version tagged release is the latest released version.

How to use Salt command in Linux? ›

Using the Salt Command
  1. salt '*foo.com' sys.doc.
  2. salt -E '.*' cmd.run 'ls -l | grep foo'
  3. salt -L foo.bar.baz,quo.qux cmd.run 'ps aux | grep foo'

What is SaltStack used for? ›

SaltStack, also known as Salt, is a configuration management and orchestration tool. It uses a central repository to provision new servers and other IT infrastructure, to make changes to existing ones, and to install software in IT environments, including physical and virtual servers, as well as the cloud.

How to install SaltStack on Ubuntu? ›

Install the Stable Version from the Official PPA

Installing from the Ubuntu PPA is the most straight forward installation method. To get started, you will need to add the SaltStack PPA to the server you will use as your master. You can do this by typing: sudo add-apt-repository ppa:saltstack/salt.

How to check salt version? ›

Verify the salt-common and salt-minion versions
  1. Log in to the physical node console.
  2. To verify the salt-common version, run: apt-cache policy salt-common.
  3. To verify the salt-minion version, run: apt-cache policy salt-minion.

How to install Windows terminal? ›

Step 1: Click the search icon from the taskbar and search for Microsoft Store. Then, select Microsoft Store from the search result to open it. Step 2: Search for Windows Terminal using the search box in Microsoft Store. Step 3: Click the Get button to download and install Windows Terminal on your device.

How to install lamp stack on Debian 11? ›

This guide explains how to install a LAMP stack on Debian 11.
  1. Prerequisites. Deploy a Debian 11 cloud server at Vultr. ...
  2. Install Apache. Install Apache and related utilities. ...
  3. Install MariaDB. Install the database server. ...
  4. Install PHP. ...
  5. Configure the Firewall. ...
  6. Test the LAMP Stack. ...
  7. More Information.
Sep 14, 2021

How to install Gnome shell on Debian 11? ›

Your options are:
  1. Download an image that features a desktop environment (complete installation image, see here) and reinstall Debian using this image.
  2. Install the desktop environment yourself. To do that, you could try sudo apt-get update && sudo apt-get install task-gnome-desktop .
Sep 17, 2021

How to install aptitude in Debian 11? ›

In Debian-based distributions like Ubuntu, you can install 'aptitude' by running the command sudo apt-get install aptitude . For using it, a simple command would be sudo aptitude install [package-name] . sudo apt-get update sudo apt-get install aptitude sudo aptitude install nano # Output: # Reading package lists...

How to install KDM on Debian? ›

To install the “K Desktop Environment” or “kde” on Debian 12, use the command “sudo apt install kde-version”. Replace the kde-version with “kde-full” for the full-fledged “kde” with all the applications and utilities.

Top Articles
Latest Posts
Article information

Author: Aron Pacocha

Last Updated:

Views: 5565

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Aron Pacocha

Birthday: 1999-08-12

Address: 3808 Moen Corner, Gorczanyport, FL 67364-2074

Phone: +393457723392

Job: Retail Consultant

Hobby: Jewelry making, Cooking, Gaming, Reading, Juggling, Cabaret, Origami

Introduction: My name is Aron Pacocha, I am a happy, tasty, innocent, proud, talented, courageous, magnificent person who loves writing and wants to share my knowledge and understanding with you.