Installation

LinchPin can be run either as a container or as a bare-metal application

Docker Installation

The LinchPin container is built using the latest Fedora image. The image exists in the docker hub as contrainfra/linchpin and is updated with each release. The image can also be build manually.

From within the config/Dockerfiles/linchpin directory:

$ sudo buildah bud -t linchpin .

Finally, to run the linchpin container with podman/docker:

$ sudo podman run linchpin -v /path/to/workspace:/workdir -- linchpin -w /wordir up
$ sudo podman run linchpin -v /path/to/workspace:/workdir -- linchpin -w /workdir -vv destroy

Note

Setting the CREDS_PATH environment variable pointing the /workdir is recommended. AWS credentials can also be passed as evironment variables when the container is run, named AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID

Note

Beaker uses kinit, which is installed in the container but must be run within the container after it starts The default /etc/krb5.conf for kerberos requires privilege escalation. The linchpin Dockerfile replaces it with a version that eliminates this need

Bare Metal Installation

Currently, LinchPin can be run from any machine with Python 2.6+ (Python 3.x is currently experimental), and requires Ansible 2.7.1 or newer.

Note

Some providers have additional dependencies. Additional software requirements can be found in the Examples for all Providers documentation.

Refer to your specific operating system for directions on the best method to install Python, if it is not already installed. Many modern operating systems will have Python already installed. This is typically the case in all versions of Linux and OS X, but the version present might be older than the version needed for use with Ansible. You can check the version by typing python --version.

If the system installed version of Python is older than 2.6, many systems will provide a method to install updated versions of Python in parallel to the system version (eg. virtualenv).

Minimal Software Requirements

As LinchPin is heavily dependent on Ansible 2.9.0 or newer, this is a core requirement. Beyond installing Ansible, there are several packages that need to be installed:

* libffi-devel
* libyaml-devel
* python3-libselinux
* make
* gcc
* redhat-rpm-config
* libxml2-python
* libxslt-python

For CentOS or RHEL the following packages should be installed:

$ sudo yum install python3-pip python3-virtualenv libffi-devel \
openssl-devel libyaml-devel gmp-devel libselinux-python make \
gcc redhat-rpm-config git

Attention

CentOS 6 (and likely RHEL 6) require special care during installation. See Installing LinchPin on CentOS 6 for more detail.

For Fedora 30+ the following packages should be installed:

$ sudo dnf install python3-virtualenv libffi-devel \
openssl-devel libyaml-devel gmp-devel python3-libselinux make \
gcc redhat-rpm-config libxml2-python libxslt-python

Installing LinchPin

Note

Currently, linchpin is not packaged for any major Operating System. If you’d like to contribute your time to create a package, please contact the linchpin mailing list.

Create a virtualenv to install the package using the following sequence of commands (requires virtualenvwrapper)

$ mkvirtualenv linchpin
..snip..
(linchpin) $ pip3 install linchpin
..snip..

Note

mkvirtualenv is optional dependency you can install from here. An alternative, virtualenv, also exists. Please refer to the virtualenv documentation for more details.

To deactivate the virtualenv

(linchpin) $ deactivate
$

Then reactivate the virtualenv

$ workon linchpin
(linchpin) $

If testing or docs is desired, additional steps are required

(linchpin) $ pip3 install linchpin[docs]
(linchpin) $ pip3 install linchpin[tests]

Virtual Environments and SELinux

When using a virtualenv with SELinux enabled, LinchPin may fail due to an error related to the python3-libselinux libraries. This is because the python3-libselinux binary needs to be enabled in the Virtual Environment. Because this library affects the filesystem, it isn’t provided as a standard python module via pip. The RPM must be installed, then a symlink must occur.

(linchpin) $ sudo dnf install python3-libselinux
.. snip ..
(linchpin) $ echo ${VIRTUAL_ENV}
/path/to/virtualenvs/linchpin
(linchpin) $ export VENV_LIB_PATH=lib/python3.x/site-packages
(linchpin) $ export LIBSELINUX_PATH=/usr/lib64/python3.x/site-packages # make sure to verify this location
(linchpin) $ ln -s ${LIBSELINUX_PATH}/selinux ${VIRTUAL_ENV}/${VENV_LIB_PATH}
(linchpin) $ ln -s ${LIBSELINUX_PATH}/_selinux.so ${VIRTUAL_ENV}/${VENV_LIB_PATH}

Note

A script is provided to do this work at :code1.5:`scripts/install_selinux_venv.sh`

Installing on Fedora 30+

Install RPM pre-reqs

$ sudo dnf -y install python3-virtualenv libffi-devel openssl-devel libyaml-devel python3-libselinux make gcc redhat-rpm-config libxml2-python

Create a working-directory

$ mkdir mywork
$ cd mywork

Create linchpin directory, make a virtual environment, activate the virtual environment

$ mkvirtualenv linchpin
..snip..
(linchpin) $ pip3 install linchpin

Make a workspace, and initialize it to prove that linchpin itself works

(linchpin) $ mkdir workspace
(linchpin) $ cd workspace
(linchpin) $ linchpin init
PinFile and file structure created at /home/user/workspace

Note

The default workspace is $PWD, but can be set using the $WORKSPACE variable.

Installing on RHEL 7.4

Tested on RHEL 7.4 Server VM which was kickstarted and pre-installed with the following YUM package-groups and RPMs:

* @core
* @base
* vim-enhanced
* bash-completion
* scl-utils
* wget

For RHEL 7, it is assumed that you have access to normal RHEL7 YUM repos via RHSM or by pointing at your own http YUM repos, specifically the following repos or their equivalents:

* rhel-7-server-rpms
* rhel-7-server-optional-rpms

Install pre-req RPMs via YUM:

$ sudo yum install -y libffi-devel openssl-devel libyaml-devel gmp-devel python3-libselinux make gcc redhat-rpm-config libxml2-devel libxslt-devel libxslt-python libxslt-python

Create a working-directory

$ mkdir mywork
$ cd mywork

Create linchpin directory, make a virtual environment, activate the virtual environment

$ mkvirtualenv linchpin
..snip..
(linchpin) $ pip3 install linchpin

Inside the virtualenv, upgrade pip and setuptools because the EPEL versions are too old.

(linchpin) $ pip3 install -U setuptools

Install linchpin

(linchpin) $ pip3 install linchpin

Make a workspace, and initialize it to prove that linchpin itself works

(linchpin) $ mkdir workspace
(linchpin) $ cd workspace
(linchpin) $ linchpin init
PinFile and file structure created at /home/user/workspace

Source Installation

As an alternative, LinchPin can be installed via github. This may be done in order to fix a bug, or contribute to the project.

$ git clone git://github.com/CentOS-PaaS-SIG/linchpin
..snip..
$ cd linchpin
$ mkvirtualenv linchpin
..snip..
(linchpin) $ pip3 install file://$PWD/linchpin

linchpin setup : Automatic Dependency installation:

From version 1.6.5 linchpin includes linchpin setup commandline option to automate installations of linchpin dependencies. linchpin setup uses built in ansible-playbooks to carryout the installations.

Install all the dependencies:

$ linchpin setup

To install only a subset of dependencies, pass as arguments list:

$ linchpin setup beaker docs

It also supports ask-sudo-pass parameter when installing dnf related dependencies:

$ linchpin setup libvirt --ask-sudo-pass