Installing Salt
The dependencies for running Salt at the time of writing are as follows:
- Python 2 – Version 2.6 or greater (Salt is not Python 3-compatible)
- Msgpack – python
- YAML
- Jinja2
- MarkupSafe
- ZeroMQ – Version 3.2.0 or greater
- PyZMQ – Version 2.2.0 or greater
- Tornado
- PyCrypto
- M2Crypto
The easiest way to ensure that the dependencies for Salt are met is to use system-specific package management systems, such as apt
on Ubuntu systems, that will handle the dependency-resolution automatically. You can also use the Salt Bootstrap script to handle all of the system-specific commands for you. Salt Bootstrap is an open source project with the goal of creating a Bourne shell-compatible script that will install Salt on any compatible server. The project is managed and hosted by the SaltStack team. You can find more information at https://github.com/saltstack/salt-bootstrap.
We will explore each of these methods of installation in turn, on a few different platforms.
Installation with system packages (Ubuntu)
The latest release of Salt for Ubuntu is provided via the official SaltStack package repository at http://repo.saltstack.com.
First, you must add the official SaltStack GPG key so that the packages can be verified:
# wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add –
Now, you must open the file /etc/apt/sources.list
and add the following line:
deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main
Save and close that file.
After you have added the repository, you must update the package management database, as follows:
# sudo apt-get update
You should then be able to install the Salt master and the Salt minion with the following command:
# sudo apt-get install salt-master salt-minion
Assuming there are no errors after running this command, you should be done! Salt is now installed on your machine.
Note that we have installed both the Salt master and the Salt minion. The term master
refers to the central server—the server from which we will be controlling all of our other servers. The term minion
refers to the servers connected to and controlled by a master.
Installation with system packages (CentOS 6)
The latest release of Salt for RedHat/CentOS systems is also provided via the official SaltStack package repository at http://repo.saltstack.com.
You can set up both the repository and the keys required with a single command:
# sudo rpm -ivh https://repo.saltstack.com/yum/redhat/salt-repo-2015.8.el6.noarch.rpm
Make sure that the caches are clean with the following command:
# sudo yum clean expire-cache
Then, install the Salt master and Salt minion with the following commands:
# sudo yum install salt-master # sudo yum install salt-minion
Assuming that there are no errors after running this command, you should be done! Salt is now installed on your machine.
As with Ubuntu, we installed both the Salt master and the Salt minion. The term master refers to the central server—the server from which we will be controlling all of our other servers. The term minion refers to the servers connected to and controlled by a master.
Installation with system packages (Windows)
The latest release of Salt for Windows systems is also provided via official packages from SaltStack. However, because Windows doesn't currently have a built-in package manager, the process is more manual. You download the installer and then run it like you would install most other software on Windows.
Start by going to the Windows section of the SaltStack repo: http://repo.saltstack.com/#windows.
Here, you'll see links to the x86 and AMD64 versions of the Salt minion for Windows:
For most setups, you'll want the 64-bit version, highlighted in the preceding image. When you download and run that file, you'll see the following screen:
Continue the installation process by clicking Next and agreeing to the license agreement.
You'll then be shown a configuration page:
Here, you can enter the hostname or IP address of your Salt master, so the minion knows where to connect. You'll also have the option of setting the ID of the minion. Set it to something that describes the purpose of the minion so that when you have many minions, you'll be able to tell each of them apart. Then, click Install.
Once the installation completes, you'll have the option of starting the minion. Leave this box checked and click Finish:
You are done! Salt is now installed on your machine.
Note that the Salt master is not supported on Windows machines, so we only installed the Salt minion on this machine.
Installing with Salt Bootstrap
Information about manual installation on other major Linux distributions can be found online at http://docs.saltstack.com. However, in most cases, it is easier and more straightforward to use the Salt Bootstrap script. In-depth documentation can be found on the project page at https://github.com/saltstack/salt-bootstrap; however, the tool is actually quite easy to use, as follows:
# curl -L https://bootstrap.saltstack.com -o install_salt.sh # sudo sh install_salt.sh -h
We won't include the help text for Salt Bootstrap here as it would take up too much space. However, it should be noted that, by default, Salt Bootstrap will only install the Salt minion. We want both the Salt minion and the Salt master, which can be accomplished by passing in the -M
flag. We also want to pass in the -P
flag to allow bootstrap to install Tornado using pip
:
# sudo sh install_salt.sh -M -P
The preceding command will result in a fully functional installation of Salt on your machine! The supported operating system list is extensive, as shown in the salt-bootstrap documentation at https://github.com/saltstack/salt-bootstrap.
Note
The version of Salt used for the examples in this book is the 2015.8 release. Here is the full version information:
# sudo salt --versions-report Salt Version: Salt: 2015.8.5 Dependency Versions: Jinja2: 2.7.2 M2Crypto: Not Installed Mako: 0.9.1 PyYAML: 3.10 PyZMQ: 14.0.1 Python: 2.7.6 (default, Mar 22 2014, 22:59:56) RAET: Not Installed Tornado: 4.2.1 ZMQ: 4.0.4 cffi: Not Installed cherrypy: Not Installed dateutil: 1.5 gitdb: 0.5.4 gitpython: 0.3.2 RC1 ioflo: Not Installed libgit2: Not Installed libnacl: Not Installed msgpack-pure: Not Installed msgpack-python: 0.3.0 mysql-python: 1.2.3 pycparser: Not Installed pycrypto: 2.6.1 pygit2: Not Installed python-gnupg: Not Installed smmap: 0.8.2 timelib: Not Installed System Versions: dist: Ubuntu 14.04 trusty machine: x86_64 release: 3.13.0-46-generic system: Ubuntu 14.04 trusty
It's probable that the version of Salt you installed is a newer release and might have slightly different output. However, the examples should still all work in the latest version of Salt.