Skip to content

Building SaltStack

aborkar-ibm edited this page Dec 21, 2018 · 48 revisions

Building SaltStack

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

  • SLES 15 has 2018.3.0
  • 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.3 on Linux on IBM Z for the following distributions:

  • RHEL (6.10, 7.4, 7.5, 7.6)
  • 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 curl git wget tar make man bzip2 unzip gcc gcc-c++ make autoconf net-tools openldap-devel libxslt-devel openssl-devel libffi-devel openssl libtool libbz2-devel yum-utils pkgconfig
    • Build GCC 4.9.4

      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

      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
    • Install Python 2.7.x

      Python >=2.7.x is required for Salt Stack. So we will install Python 2.7.15 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
  • RHEL (7.4, 7.5, 7.6)

    sudo yum install -y curl git wget tar make man bzip2 unzip gcc gcc-c++ python-devel make autoconf net-tools openldap-devel libxslt-devel openssl-devel libffi-devel openssl libtool libbz2-devel yum-utils pkg-config
  • SLES (12 SP3, 15)

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

    sudo apt-get update
    sudo apt-get install -y curl git wget tar make bzip2 unzip gcc python-dev libxslt1-dev libffi-dev openssl libtool g++ libssl-dev libzmq3-dev
  • Install libzmq (For RHEL 6.10 and 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 pip

    • RHEL 6.10

      curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
      sudo /usr/local/bin/python2.7 get-pip.py
      sudo ln -fs /usr/local/bin/pip /usr/bin/pip
      
    • RHEL (7.4, 7.5, 7.6), SLES (12 SP3, 15) and Ubuntu (16.04, 18.04)

      curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
      sudo python get-pip.py
      sudo pip install --upgrade pip setuptools
      

Step 2: Clone the repository and install SaltStack

cd /<source_root>/
git clone git://github.com/saltstack/salt
cd salt        
git checkout v2018.3.3

sudo pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil futures tornado 'pyOpenSSL>=0.14' 'six>=1.10.0'
sudo pip install -r requirements/dev_python27.txt
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/
  • Edit config file /<source_root>/etc/salt/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 /<source_root>/etc/salt/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/tests.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, 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