Skip to content

Building SaltStack

aborkar-ibm edited this page Feb 4, 2020 · 43 revisions

Building SaltStack

Below versions of SaltStack(Salt) are available in respective distributions at the time of creation of these build instructions:

  • SLES 15 SP1 has 2019.2.0
  • Ubuntu 16.04 has 2015.8.8
  • Ubuntu 18.04 has 2017.7.4
  • Ubuntu 19.10 has 2018.3.4

The instructions provided below specify the steps to build SaltStack v2019.2.3 on Linux on IBM Z for the following distributions:

  • RHEL (7.5, 7.6, 7.7, 8.0)
  • SLES (12 SP4, 15 SP1)
  • Ubuntu (16.04, 18.04, 19.10)

General notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Step 1: Install the dependencies

export SOURCE_ROOT=/<source_root>/
  • RHEL (7.5, 7.6, 7.7, 8.0)

    sudo yum install -y cyrus-sasl-devel gcc gcc-c++ git libffi-devel libtool libxml2-devel libxslt-devel make man openssl-devel swig tar wget
    
    • Install M2Crypto

      sudo /usr/local/bin/pip3 install --upgrade pip 
      sudo -H /usr/local/bin/pip3 install M2Crypto
      
    • Install ZeroMQ

      cd $SOURCE_ROOT
      wget https://github.com/zeromq/zeromq4-1/releases/download/v4.1.6/zeromq-4.1.6.tar.gz
      tar -xzvf zeromq-4.1.6.tar.gz
      cd zeromq-4.1.6
      ./configure
      make
      sudo make install
      sudo ldconfig
      
  • SLES (12 SP4, 15 SP1)

    sudo zypper install -y curl cyrus-sasl-devel gawk gcc gcc-c++ git libffi-devel libopenssl-devel libxml2-devel libxslt-devel make man python3-devel tar wget zeromq-devel
    • Install pip

      curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
      sudo python3 get-pip.py
      
  • Ubuntu (16.04, 18.04, 19.10)

    sudo apt-get update
    sudo apt-get install -y g++ gcc git libffi-dev libsasl2-dev libssl-dev libxml2-dev libxslt1-dev libzmq3-dev make man python3-dev python3-pip tar wget libz-dev
  • Install Python 3.7.x (Only for RHEL and SLES 12 SP4) -- Instructions for building Python 3.7.x can be found here

Step 2: Clone the repository and install SaltStack

cd $SOURCE_ROOT
git clone git://github.com/saltstack/salt
cd salt
git checkout v2019.2.3
  • Only for Ubuntu(18.04, 19.10) and SLES(15 SP1)
sudo -H pip3 install pyzmq 'PyYAML<5.1' pycrypto msgpack-python jinja2 psutil futures tornado
sudo -H pip3 install -e .
  • Only for RHEL and SLES 12 SP4
sudo -H /usr/local/bin/pip3 install pyzmq 'PyYAML<5.1' pycrypto msgpack-python jinja2 psutil futures tornado
sudo -H /usr/local/bin/pip3 install -e .
  • Only for Ubuntu 16.04
sudo pip3 install --upgrade pip
sudo -H pip install pyzmq 'PyYAML<5.1' pycrypto msgpack-python jinja2 psutil futures tornado
sudo -H pip install -e .

Step 3: Configure SaltStack to run self-contained version

cd $SOURCE_ROOT
mkdir -p $SOURCE_ROOT/etc/salt/pki/{master,minion}
cp ./salt/conf/master ./salt/conf/minion $SOURCE_ROOT/etc/salt/
  • Edit config file $SOURCE_ROOT/etc/salt/master as shown below

    -	    #user: root
    +	    user: <username>
    -	    #root_dir: /
    +	    root_dir: /<source_root>/

    Note: Change the publish_port and ret_port values if required

  • Edit config file $SOURCE_ROOT/etc/salt/minion as shown below

    -	    #master: salt
    +	    master: localhost
    -	    #user: root
    +	    user: <username>
    -	    #root_dir: /
    +	    root_dir: /<source_root>/

    Note: If the ret_port value in the master config file is changed, set the same value to master_port value in the minion config file

  • Start the master and minion, accept the minion's key, and verify your local Salt installation is working:

    cd $SOURCE_ROOT
    salt-master -c ./etc/salt -d
    salt-minion -c ./etc/salt -d
    salt-key -c ./etc/salt -L
    salt-key -c ./etc/salt -A
    salt -c ./etc/salt '*' test.version

Step 4: Test SaltStack (Optional)

  • Only for Ubuntu and SLES 15 SP1
cd $SOURCE_ROOT/salt
sudo -H pip3 install jsonschema==2.6.0
sudo -H pip3 install -r requirements/tests.txt
sudo python3 tests/runtests.py
  • Only for RHEL and SLES 12 SP4
cd $SOURCE_ROOT/salt
sudo ln -s /usr/local/bin/python3.7 /usr/bin/python3.7
sudo -H /usr/local/bin/pip3 install jsonschema==2.6.0
sudo -H /usr/local/bin/pip3 install -r requirements/tests.txt
sudo /usr/local/bin/python3 tests/runtests.py

Note: User can ignore intermittent test-case failures as it does not affect the functionality. Test failures seen in the following modules can be ignored as those are not related to IBM Z Systems: Module Tests, Shell Tests and Unit Tests.

References:

https://docs.saltstack.com/en/latest/topics/installation/index.html
https://docs.saltstack.com/en/latest/topics/development/hacking.html
https://docs.saltstack.com/en/latest/topics/development/tests/index.html

Clone this wiki locally