2017-12-10 16:16:14 +01:00
|
|
|
.. _install-guide-from-source:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
Install from source code and configure
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
This section describes how to install and configure the Container
|
2017-12-10 16:16:14 +01:00
|
|
|
Infrastructure Management service for from source code.
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. include:: common/prerequisites.rst
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
Install and configure components
|
|
|
|
--------------------------------
|
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
1. Install Magnum from source:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
a. Install OS-specific prerequisites:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Ubuntu 16.04 (xenial) or higher:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# apt update
|
|
|
|
# apt install python-dev libssl-dev libxml2-dev \
|
|
|
|
libmysqlclient-dev libxslt-dev libpq-dev git \
|
|
|
|
libffi-dev gettext build-essential
|
2017-10-23 17:09:58 +02:00
|
|
|
* CentOS 7:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-10-23 17:09:58 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# yum install python-devel openssl-devel mariadb-devel \
|
|
|
|
libxml2-devel libxslt-devel postgresql-devel git \
|
|
|
|
libffi-devel gettext gcc
|
|
|
|
|
|
|
|
* Fedora 21 / RHEL 7
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# yum install python-devel openssl-devel mysql-devel \
|
|
|
|
libxml2-devel libxslt-devel postgresql-devel git \
|
|
|
|
libffi-devel gettext gcc
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Fedora 22 or higher
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# dnf install python-devel openssl-devel mysql-devel \
|
|
|
|
libxml2-devel libxslt-devel postgresql-devel git \
|
|
|
|
libffi-devel gettext gcc
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* openSUSE Leap 42.1
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# zypper install git libffi-devel libmysqlclient-devel \
|
|
|
|
libopenssl-devel libxml2-devel libxslt-devel \
|
|
|
|
postgresql-devel python-devel gettext-runtime gcc
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
b. Create magnum user and necessary directories:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Create user:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# groupadd --system magnum
|
|
|
|
# useradd --home-dir "/var/lib/magnum" \
|
|
|
|
--create-home \
|
|
|
|
--system \
|
|
|
|
--shell /bin/false \
|
|
|
|
-g magnum \
|
|
|
|
magnum
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Create directories:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# mkdir -p /var/log/magnum
|
|
|
|
# mkdir -p /etc/magnum
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Set ownership to directories:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# chown magnum:magnum /var/log/magnum
|
|
|
|
# chown magnum:magnum /var/lib/magnum
|
|
|
|
# chown magnum:magnum /etc/magnum
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
c. Install virtualenv and python prerequisites:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Install virtualenv and create one for magnum's installation:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# easy_install -U virtualenv
|
|
|
|
# su -s /bin/sh -c "virtualenv /var/lib/magnum/env" magnum
|
2017-10-06 16:20:22 +07:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Install python prerequisites:
|
2017-10-06 16:20:22 +07:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# su -s /bin/sh -c "/var/lib/magnum/env/bin/pip install tox pymysql \
|
|
|
|
python-memcached" magnum
|
2016-11-13 15:53:19 +01:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
d. Clone and install magnum:
|
2016-11-13 15:53:19 +01:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-11-13 15:53:19 +01:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# cd /var/lib/magnum
|
|
|
|
# git clone https://git.openstack.org/openstack/magnum.git
|
|
|
|
# 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" magnum
|
2016-12-07 11:06:23 +05:30
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
e. Copy api-paste.ini:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# su -s /bin/sh -c "cp etc/magnum/api-paste.ini /etc/magnum" magnum
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
f. Generate a sample configuration file:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# 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" magnum
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
e. Optionally, if you want to customize the policies for Magnum API accesses,
|
|
|
|
you can generate a sample policy file, put it into ``/etc/magnum`` folder
|
|
|
|
for further modifications:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: console
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# 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
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. include:: common/configure_2_edit_magnum_conf.rst
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Additionally, edit the ``/etc/magnum/magnum.conf`` file:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* In the ``[oslo_concurrency]`` section, configure the ``lock_path``:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
.. code-block:: ini
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
[oslo_concurrency]
|
|
|
|
...
|
|
|
|
lock_path = /var/lib/magnum/tmp
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* If you decide to customize Magnum policies in ``1.e``, then in the
|
2017-10-06 16:20:22 +07:00
|
|
|
``[oslo_policy]`` section, configure the ``policy_file``:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
|
|
|
|
|
|
|
[oslo_policy]
|
|
|
|
...
|
|
|
|
policy_file = /etc/magnum/policy.yaml
|
|
|
|
|
2016-05-13 16:26:29 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Make sure that ``/etc/magnum/magnum.conf`` still have the correct
|
|
|
|
permissions. You can set the permissions again with:
|
|
|
|
|
|
|
|
# chown magnum:magnum /etc/magnum/magnum.conf
|
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
3. Populate Magnum database:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# su -s /bin/sh -c "/var/lib/magnum/env/bin/magnum-db-manage upgrade" magnum
|
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
4. Set magnum for log rotation:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# cd /var/lib/magnum/magnum
|
|
|
|
# cp doc/examples/etc/logrotate.d/magnum.logrotate /etc/logrotate.d/magnum
|
|
|
|
|
|
|
|
Finalize installation
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
#. Create init scripts and services:
|
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Ubuntu 16.04 or higher, Fedora 21 or higher/RHEL 7/CentOS 7 or openSUSE
|
|
|
|
Leap 42.1:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2016-09-14 16:14:21 +02:00
|
|
|
#. Start magnum-api and magnum-conductor:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Ubuntu 16.04 or higher, Fedora 21 or higher/RHEL 7/CentOS 7 or openSUSE
|
|
|
|
Leap 42.1:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# systemctl enable magnum-api
|
|
|
|
# systemctl enable magnum-conductor
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# systemctl start magnum-api
|
|
|
|
# systemctl start magnum-conductor
|
|
|
|
|
2016-09-14 16:14:21 +02:00
|
|
|
#. Verify that magnum-api and magnum-conductor services are running:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Ubuntu 16.04 or higher, Fedora 21 or higher/RHEL 7/CentOS 7 or openSUSE
|
|
|
|
Leap 42.1:
|
2016-05-13 16:26:29 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# systemctl status magnum-api
|
|
|
|
# systemctl status magnum-conductor
|
2016-09-14 16:14:21 +02:00
|
|
|
|
2016-09-15 15:01:45 +02:00
|
|
|
Install the command-line client
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
#. Install OS-specific prerequisites:
|
|
|
|
|
|
|
|
* Fedora 21/RHEL 7/CentOS 7
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# yum install python-devel openssl-devel python-virtualenv \
|
|
|
|
libffi-devel git gcc
|
|
|
|
|
|
|
|
* Fedora 22 or higher
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# dnf install python-devel openssl-devel python-virtualenv \
|
|
|
|
libffi-devel git gcc
|
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
* Ubuntu
|
2016-09-15 15:01:45 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2017-12-10 16:16:14 +01:00
|
|
|
# apt update
|
|
|
|
# apt install python-dev libssl-dev python-virtualenv \
|
|
|
|
libffi-dev git gcc
|
2016-09-15 15:01:45 +02:00
|
|
|
|
|
|
|
* openSUSE Leap 42.1
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
# zypper install python-devel libopenssl-devel python-virtualenv \
|
|
|
|
libffi-devel git gcc
|
|
|
|
|
|
|
|
#. Install the client in a virtual environment:
|
2016-09-14 16:14:21 +02:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2016-09-15 15:01:45 +02:00
|
|
|
$ cd ~
|
|
|
|
$ git clone https://git.openstack.org/openstack/python-magnumclient.git
|
|
|
|
$ cd python-magnumclient
|
|
|
|
$ virtualenv .magnumclient-env
|
|
|
|
$ .magnumclient-env/bin/pip install -r requirements.txt
|
|
|
|
$ .magnumclient-env/bin/python setup.py install
|
|
|
|
|
|
|
|
#. Now, you can export the client in your PATH:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ export PATH=$PATH:${PWD}/.magnumclient-env/bin/magnum
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
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.
|