Skip to content

Building SaltStack

aborkar-ibm edited this page Nov 9, 2018 · 48 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.10, 7.3, 7.4, 7.5)
  • SLES (12 SP3, 15)
  • 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.10

    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 yum-utils
  • 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 yum-utils
  • 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 libzmq3 zeromq-devel
  • SLES 15

    sudo zypper install -y git tar bzip2 unzip python-devel make man autoconf net-tools wget python2-setuptools python2-lxml libxslt-devel gcc openssl libopenssl-devel libffi-devel python-xml gcc-c++ libbz2-devel libzmq5 zeromq-devel
  • Ubuntu (16.04, 18.04)

    sudo apt-get update 
    sudo apt-get install -y 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 libzmq3-dev
  • Build GCC 4.9.4 (For Rhel 6.10)

    cd /<source_root>/
    wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.gz
    tar -xzf gcc-4.9.4.tar.gz && cd gcc-4.9.4/
    ./contrib/download_prerequisites && cd ..
    mkdir gccbuild && cd gccbuild
    ../gcc-4.9.4/configure --prefix=$HOME/install/gcc-4.9.4 --enable-checking=release --enable-languages=c,c++ --disable-multilib
    make && sudo make install
    export PATH=$HOME/install/gcc-4.9.4/bin:$PATH
    export LD_LIBRARY_PATH=$HOME/install/gcc-4.9.4/lib64/
    gcc --version
    
  • Build Autoconf 2.65 (For Rhel 6.10)

    cd /<source_root>/
    wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.gz
    tar -xzf autoconf-2.65.tar.gz && cd autoconf-2.65
    ./configure --prefix=/usr --program-suffix=2.65
    make && sudo make install
    
  • Build libzmq (For RHEL 6.10,7.x)

     cd /<source_root>/
     git clone https://github.com/zeromq/libzmq.git  && cd libzmq/
     git checkout v4.2.5
     ./autogen.sh && ./configure && make && sudo make install && sudo ldconfig
    
    
  • Install Python 2.7.x (For RHEL 6.10)

    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.10
     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 -fs /usr/local/bin/pip /usr/bin/pip       (Only for RHEL 6.10)
    
    • RHEL (7.3, 7.4, 7.5), SLES (12 SP3, 15) and Ubuntu 16.04
     sudo easy_install pip
     sudo pip install -U setuptools
    
    • Ubuntu 18.04
     sudo apt-get install python-pip
     sudo pip install -U setuptools
    
  • Install required packages using pip

    • RHEL (6.10, 7.3, 7.4, 7.5) and SLES (12 SP3, 15)
    sudo 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)
    sudo 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
wget https://github.com/cro/salt/commit/e032bd315dd11c8a57c45081143e060f320f0220.patch --no-check-certificate (For SLES 15 only)
git apply e032bd315dd11c8a57c45081143e060f320f0220.patch (For SLES 15 only)
sudo 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
sudo pip install -r requirements/dev_python27.txt
sudo pip install -r requirements/zeromq.txt
sudo 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