Book Image

Learning SaltStack

By : Colton Myers
Book Image

Learning SaltStack

By: Colton Myers

Overview of this book

Table of Contents (15 chapters)

Installing Salt


The dependencies for running Salt at the time of writing are as follows:

  • Python 2—Version 2.6 or greater (not Python 3-compatible)

  • msgpack-python

  • YAML

  • Jinja2

  • MarkupSafe

  • Apache Libcloud

  • Requests

  • ZeroMQ—Version 3.2.0 or greater

  • PyZMQ—Version 2.2.0 or greater

  • 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 a script called Salt-Bootstrap 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.

Installation with system packages (Ubuntu)

The latest release of Salt for Ubuntu is provided in Personal Package Archive (PPA), which is a type of package repository for Ubuntu. The easiest way to access the PPA to install Salt is using the add-apt-repository command, as follows:

# sudo add-apt-repository ppa:saltstack/salt

Note

If the add-apt-repository command is not found, you can add it by installing the python-software-properties package:

sudo apt-get install python-software-properties

If you are using Ubuntu Version 12.10 or greater, this step should not be required as the add-apt-repository command should be included in the base system.

After you have added the repository, you must update the package management database, as follows:

# sudo apt-get update

If the system asks whether you should accept a gpg key, press Enter to accept.

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 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.

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 a tool called Salt-Bootstrap. 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 Bootstrap here as it would take up too much space. However, it should be noted that, by default, Bootstrap will install only the Salt minion. We want both the Salt minion and the Salt master, which can be accomplished by passing in the -M flag, as follows:

# sudo sh install_salt.sh -M

The preceding command will result in a fully-functional installation of Salt on your machine! The supported operating system list is extensive, as follows:

  • Amazon Linux AMI 2012.09

  • Arch Linux

  • CentOS 5/6

  • Debian 6.x/7.x/8 (git installations only)

  • Fedora 17/18

  • FreeBSD 9.1/9.2/10

  • Gentoo Linux

  • Linaro

  • Linux Mint 13/14

  • OpenSUSE 12.x

  • Oracle Linux 5/6

  • RHEL 5/6

  • Scientific Linux 5/6

  • SmartOS

  • SuSE 11 SP1 and 11 SP2

  • Ubuntu 10.x/11.x/12.x/13.x/14.x

    Note

    The version of Salt used for the examples in this book is the 2014.7 release. Here is the full version information:

    # sudo salt --versions-report
               Salt: 2014.7.0
             Python: 2.7.6
             Jinja2: 2.7.2
           M2Crypto: 0.21.1
     msgpack-python: 0.3.0
       msgpack-pure: Not Installed
           pycrypto: 2.6.1
            libnacl: Not Installed
             PyYAML: 3.10
              ioflo: Not Installed
              PyZMQ: 14.0.1
               RAET: Not Installed
                ZMQ: 4.0.4
               Mako: 0.9.1
    

    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.