Many links are broken or point to redirect pages, update all of them. Use better RST for intra-document links so that they do not silently break if documents move. Use opendev.org consistently for git. Change-Id: I8fedff2fff82177fd12da808b8b421270cbe2d95
7.5 KiB
Install from source code and configure
This section describes how to install and configure the Container Infrastructure Management service for from source code.
Install and configure components
- Install Magnum from source:
Install OS-specific prerequisites:
Ubuntu 16.04 (xenial) or higher:
# apt update # apt install python-dev libssl-dev libxml2-dev \ libmysqlclient-dev libxslt-dev libpq-dev git \ libffi-dev gettext build-essentialCentOS 7:
# yum install python-devel openssl-devel mariadb-devel \ libxml2-devel libxslt-devel postgresql-devel git \ libffi-devel gettext gccFedora 21 / RHEL 7
# yum install python-devel openssl-devel mysql-devel \ libxml2-devel libxslt-devel postgresql-devel git \ libffi-devel gettext gccFedora 22 or higher
# dnf install python-devel openssl-devel mysql-devel \ libxml2-devel libxslt-devel postgresql-devel git \ libffi-devel gettext gccopenSUSE Leap 42.1
# zypper install git libffi-devel libmysqlclient-devel \ libopenssl-devel libxml2-devel libxslt-devel \ postgresql-devel python-devel gettext-runtime gcc
Create magnum user and necessary directories:
Create user:
# groupadd --system magnum # useradd --home-dir "/var/lib/magnum" \ --create-home \ --system \ --shell /bin/false \ -g magnum \ magnumCreate directories:
# mkdir -p /var/log/magnum # mkdir -p /etc/magnumSet ownership to directories:
# chown magnum:magnum /var/log/magnum # chown magnum:magnum /var/lib/magnum # chown magnum:magnum /etc/magnum
Install virtualenv and python prerequisites:
Install virtualenv and create one for magnum's installation:
# easy_install -U virtualenv # su -s /bin/sh -c "virtualenv /var/lib/magnum/env" magnumInstall python prerequisites:
# su -s /bin/sh -c "/var/lib/magnum/env/bin/pip install tox pymysql \ python-memcached" magnum
Clone and install magnum:
# cd /var/lib/magnum # git clone https://opendev.org/openstack/magnum # chown -R magnum:magnum magnum # cd magnum # su -s /bin/sh -c "/var/lib/magnum/env/bin/pip install -r requirements.txt" magnum # su -s /bin/sh -c "/var/lib/magnum/env/bin/python setup.py install" magnumCopy api-paste.ini:
# su -s /bin/sh -c "cp etc/magnum/api-paste.ini /etc/magnum" magnumGenerate a sample configuration file:
# su -s /bin/sh -c "/var/lib/magnum/env/bin/tox -e genconfig" magnum # su -s /bin/sh -c "cp etc/magnum/magnum.conf.sample /etc/magnum/magnum.conf" magnumOptionally, if you want to customize the policies for Magnum API accesses, you can generate a sample policy file, put it into
/etc/magnumfolder for further modifications:# su -s /bin/sh -c "/var/lib/magnum/env/bin/tox -e genpolicy" magnum # su -s /bin/sh -c "cp etc/magnum/policy.yaml.sample /etc/magnum/policy.yaml" magnum
Additionally, edit the
/etc/magnum/magnum.conffile:In the
[oslo_concurrency]section, configure thelock_path:[oslo_concurrency] ... lock_path = /var/lib/magnum/tmp
If you decide to customize Magnum policies in
1.e, then in the[oslo_policy]section, configure thepolicy_file:[oslo_policy] ... policy_file = /etc/magnum/policy.yaml
Note
Make sure that
/etc/magnum/magnum.confstill have the correct permissions. You can set the permissions again with:# chown magnum:magnum /etc/magnum/magnum.conf
Populate Magnum database:
# su -s /bin/sh -c "/var/lib/magnum/env/bin/magnum-db-manage upgrade" magnumSet magnum for log rotation:
# cd /var/lib/magnum/magnum # cp doc/examples/etc/logrotate.d/magnum.logrotate /etc/logrotate.d/magnum
Finalize installation
- Create init scripts and services:
Ubuntu 16.04 or higher, Fedora 21 or higher/RHEL 7/CentOS 7 or openSUSE Leap 42.1:
# cd /var/lib/magnum/magnum # cp doc/examples/etc/systemd/system/magnum-api.service \ /etc/systemd/system/magnum-api.service # cp doc/examples/etc/systemd/system/magnum-conductor.service \ /etc/systemd/system/magnum-conductor.service
- Start magnum-api and magnum-conductor:
Ubuntu 16.04 or higher, Fedora 21 or higher/RHEL 7/CentOS 7 or openSUSE Leap 42.1:
# systemctl enable magnum-api # systemctl enable magnum-conductor# systemctl start magnum-api # systemctl start magnum-conductor
- Verify that magnum-api and magnum-conductor services are running:
Ubuntu 16.04 or higher, Fedora 21 or higher/RHEL 7/CentOS 7 or openSUSE Leap 42.1:
# systemctl status magnum-api # systemctl status magnum-conductor
Install the command-line client
Install OS-specific prerequisites:
Fedora 21/RHEL 7/CentOS 7
# yum install python-devel openssl-devel python-virtualenv \ libffi-devel git gccFedora 22 or higher
# dnf install python-devel openssl-devel python-virtualenv \ libffi-devel git gccUbuntu
# apt update # apt install python-dev libssl-dev python-virtualenv \ libffi-dev git gccopenSUSE Leap 42.1
# zypper install python-devel libopenssl-devel python-virtualenv \ libffi-devel git gcc
Install the client in a virtual environment:
$ cd ~ $ git clone https://opendev.org/openstack/python-magnumclient $ cd python-magnumclient $ virtualenv .magnumclient-env $ .magnumclient-env/bin/pip install -r requirements.txt $ .magnumclient-env/bin/python setup.py installNow, you can export the client in your PATH:
$ export PATH=$PATH:${PWD}/.magnumclient-env/bin/magnumNote
The command-line client can be installed on the controller node or on a different host than the service. It is good practice to install it as a non-root user.