Skip to content

Building SaltStack

aborkar-ibm edited this page Jul 9, 2018 · 43 revisions

Building SaltStack

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

  • Ubuntu 16.04 has 2015.8.8
  • Ubuntu 18.04 has 2017.7.4

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

  • RHEL (6.9, 7.3, 7.4, 7.5)
  • SLES (11 SP4, 12 SP3)
  • Ubuntu (16.04, 18.04)

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

  • RHEL 6.9

    sudo yum install -y git wget tar make man bzip2 unzip gcc gcc-c++ make autoconf net-tools ssh sqlite-devel openldap-devel libxslt-devel openssl-devel libffi-devel openssl  libtool libbz2-devel bzip2-devel.s390x
  • RHEL (7.3, 7.4, 7.5)

    sudo yum install -y git wget tar make man bzip2 unzip gcc gcc-c++ python-devel make autoconf net-tools python-setuptools python-lxml python-ldap sqlite-devel openldap-devel libxslt-devel openssl-devel libffi-devel openssl libtool libbz2-devel
  • SLES 11 SP4

    sudo zypper install -y ncurses patch zlib zlib-devel git awk tar bzip2 man unzip openssl-devel make automake autoconf libtool net-tools wget libxslt-devel gcc libffi-devel  gcc-c++ libbz2-devel xz
    • Build OpenSSL

       cd /source_root/
       git clone git://github.com/openssl/openssl.git
       cd openssl
       git checkout OpenSSL_1_0_2l	 
       ./config --prefix=/usr --openssldir=/usr/local/openssl shared
       make
       sudo make install
    • Build curl

       cd /source_root/
       git clone git://github.com/curl/curl.git
       cd curl
       git checkout curl-7_52_1
       ./buildconf 
       ./configure --prefix=/usr/local --with-ssl --disable-shared
       make && sudo make install
       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
       export PATH=/usr/local/bin:$PATH
    • Generate ca-bundle.crt for curl

       echo insecure >> $HOME/.curlrc
       wget https://raw.githubusercontent.com/curl/curl/curl-7_53_0/lib/mk-ca-bundle.pl
       perl mk-ca-bundle.pl -k
       export SSL_CERT_FILE=`pwd`/ca-bundle.crt
       rm $HOME/.curlrc
  • SLES 12 SP3

    sudo zypper install -y git tar bzip2 unzip python-devel make man autoconf net-tools wget python-setuptools python-lxml python-ldap libxslt-devel gcc openssl libopenssl-devel libffi-devel python-xml gcc-c++ libbz2-devel
  • Ubuntu 16.04

    sudo apt-get update 
    sudo apt-get install git wget tar make bzip2 unzip gcc python python-dev python-setuptools python-lxml python-ldap libxslt1-dev libffi-dev openssl libtool g++ libssl-dev
  • Ubuntu 18.04

    sudo apt-get update 
    sudo apt-get install git wget tar make bzip2 unzip gcc python python-dev python-setuptools python-lxml python-ldap libxslt1-dev libffi-dev openssl libtool g++ libssl-dev 
  • Install Python 2.7.x (For RHEL 6.9 and SLES 11 SP4)

    Python >=2.7. is required for Salt Stack. So we will install Python 2.7.14 from source in /usr/local and switch back to old python after running tests. Instructions for building Python can be found here.

    After installing Python in /usr/local, set the newly installed Python as default.

    export PATH=/usr/local/bin:$PATH
    sudo /usr/sbin/update-alternatives --install /usr/bin/python python /usr/local/bin/python 10
    sudo /usr/sbin/update-alternatives --display python
    python -V
    
  • Install pip

    • RHEL 6.9 and SLES 11 SP4
     curl -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
     sudo /usr/local/bin/python2.7 /tmp/get-pip.py
     sudo ln -s /usr/local/bin/pip /usr/bin/pip       (Only for RHEL 6.9)
    
    • RHEL (7.3, 7.4, 7.5), SLES 12 SP3 and Ubuntu 16.04
     easy_install pip
     pip install -U setuptools
    
    • Ubuntu 18.04
     sudo apt-get install python-pip
     pip install -U setuptools
    
  • Install required packages using pip

    • SLES 11 SP4
    pip install cffi
    pip install paramiko httplib2 passlib six patch django call coverage coveralls funcsigs pyzmq PyYAML pycrypto cryptography msgpack-python jinja2 psutil futures 'tornado<5.0'
    
    • RHEL (6.9, 7.3, 7.4, 7.5) and SLES 12 SP3
    pip install paramiko httplib2 passlib six patch django call coverage coveralls funcsigs pyzmq PyYAML pycrypto cryptography msgpack-python jinja2 psutil futures 'tornado<5.0'
    
    • Ubuntu (16.04, 18.04)
    pip install paramiko httplib2 passlib six patch 'django<2.0' call coverage==3.7.1 coveralls funcsigs pyzmq PyYAML pycrypto msgpack-python jinja2 psutil futures 'tornado<5.0'
    

Step 2: Clone the repository and install SaltStack

cd /<source_root>/
git clone git://github.com/saltstack/salt
cd salt        
git checkout v2018.3.2 
pip install -e . 

Note: Make sure that you have proper python installation directory added in the PATH variable.You may also use sudo env PATH=$PATH <command> if proper python is not getting selected

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/
cd /<source_root>/etc/salt/ 
  • Edit config file master as shown below

    -	    #user: root
    +	    user: root
    -	    #root_dir: /
    +	    root_dir: /<source_root>/
    -	    #pki_dir: /etc/salt/pki/master
    +	    pki_dir: /<source_root>/etc/salt/pki/master

    Note: Change the publish_port and ret_port values if required

  • Edit config file minion as shown below

    -	    #master: salt
    +	    master: localhost
    -	    #user: root
    +	    user: root
    -	    #root_dir: /
    +	    root_dir: /<source_root>/
    -	    #pki_dir: /etc/salt/pki/minion
    +	    pki_dir: /<source_root>/etc/salt/pki/minion

    Note: If the ret_port value in the master config file is changed then, 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>/
sudo salt-master -c ./etc/salt -d 
sudo salt-minion -c ./etc/salt -d 
sudo salt-key -c ./etc/salt -L 
sudo salt-key -c ./etc/salt -A 
sudo salt -c ./etc/salt '*' test.ping  

Note: Make sure that you have proper python installation directory added in the PATH variable. You may also use sudo env PATH=$PATH <command> if proper python is not getting selected

Step 4: Test SaltStack

cd /<source_root>/salt
pip install -r requirements/dev_python27.txt
pip install -r requirements/zeromq.txt
python tests/runtests.py

Note: Test failures seen in the following modules can be ignored as those are not related to IBM z Systems: Module Tests, NetAPI Tests, State Tests, Shell Tests, External Pillar Tests, 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