You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

OpenStack Client is a command-line tool for OpenStack that brings the command set for Compute, Identity, Image, Object Storage and Block Storage APIs together in a single shell with a uniform command structure. The OpenStack client enables you to interact with OpenStack services over the network via API call.

A pre-requisite for this setup is a working OpenStack Cloud platform. You can check our OpenStack guides for how to articles. If you’re a developer and would like to contribute, the code is hosted on OpenStack’s Git server.

Step 1: Install Python Pip tool

Some Linux distributions include packaged versions of the OpenStack command-line clients that you can install directly, but we’ll install from Pip. Install pip through the package manager for your system:

------------ Install pip on Debian / Ubuntu ----------
$ sudo apt-get -y update
$ sudo apt-get -y install python-dev python-pip
$ sudo pip install --upgrade pip

------------ Install pip on CentOS / RHEL ----------
$ sudo yum -y install python-devel python-pip
$ sudo pip install --upgrade pip

------------ Install pip on Arch / Manjaro ----------
$ sudo pacman -Syy
$ sudo pacman -S python-pip
$ sudo pip install --upgrade pip

--------- Install pip on macOS ----------------
$ sudo easy_install pip

Confirm version of pip installed.

$ pip --version
pip 19.1.1 from /usr/lib/python3.7/site-packages/pip (python 3.7)

Step 2: Install OpenStack Client on Linux

After installation of Pip, proceed to install OpenStack command-line clients.

sudo pip install python-openstackclient

Display more information about installed Openstack Command Line client.

$ pip show python-openstackclient
Name: python-openstackclient
Version: 3.19.0
Summary: OpenStack Command-line Client
Author: OpenStack
Author-email: [email protected]
License: UNKNOWN
Location: /usr/lib/python3.7/site-packages
Requires: python-cinderclient, cliff, python-keystoneclient, keystoneauth1, python-novaclient, six, openstacksdk, oslo.i18n, python-glanceclient, osc-lib, pbr, Babel, oslo.utils

You should have openstack command in your PATH.

$ which openstack

Step 3: Configure OpenStack Client on Linux

You can pull OpenStack configuration file from OpenStack Director or create one if you have correct access credentials.

$ nano ~/.keystonerc
    export OS_USERNAME='admin'
    export OS_PASSWORD='adminpassword'
    export OS_AUTH_URL=
    export PS1='[\[email protected]\h \W(keystone_admin)]\$ '
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default

Update variables to match your OpenStack environment. When done, source the file to start using openstack command line tool to administer OpenStack Cloud.

$ source ~/.keystonerc

Your Shell prompt should change to.

[\[email protected]\h \W(keystone_admin)]$ 

Run openstack command to confirm it is working.

[\[email protected]\h \W(keystone_admin)]$ openstack network list
| ID                                   | Name                      | Subnets                                                                    |
| 900b1ede-3e62-4d73-88d3-b28c129a6bb6 | public                    | c1770934-54bb-4252-928a-c7a41c6e114a                                       |
| da22131e-0b50-46e7-8d35-b18bbb161f1b | mycluster-lww6p-openshift | 6770ab86-2481-46e6-8d29-ab3c6a82b6cc, ec91b5c4-37fd-453f-be02-9ee8327654c2 |
| e406e76f-e89d-42a2-bab1-9c883b2e49aa | private                   | 76ff61dd-0438-4848-a611-f4b4de070164                                       |

$ openstack image list
| ID                                   | Name                | Status |
| 0850ee38-1bdf-4379-9c69-0cf73e8b7c65 | Arch-Linux-x86_64   | active |
| e98445b6-f14f-488c-a18a-1f66c6de15c7 | CentOS-7-x86_64     | active |
| 7b4b616e-71f3-4419-9777-7aee66fad62c | Cirros-0.4.0-x86_64 | active |
| 8514fea0-3d55-4248-a79f-5c0183f95898 | CoreOS-x86_64       | active |
| 98bbd9e6-abbc-45fa-ac95-b91b7b18ba0a | Debian-9-amd64      | active |
| 113b90b6-4e1e-4715-b9ab-456c191a82b3 | Fedora-30-x86_64    | active |
| 06c17e8a-0d4c-428a-89b5-b0eb2489f403 | Ubuntu-16.04-x86_64 | active |
| 2ba79fa6-2434-4dc6-ad86-0baf29d44c79 | rhcos               | active |
| c3bb11c7-81af-49fe-a26c-a60e9b14585c | rhcos-kvm           | active |

Step 4: Enable OpenStack Bash completion

Use the openstack complete command to generate a bash-completion script.

openstack complete | sudo tee /etc/bash_completion.d/osc.bash_completion > /dev/null


$ logout
$ exit

Then login again to enjoy OpenStack bash completion.

$ openstack network <TAB>
agent     create    flavor    log       meter     rbac      service   show      trunk     
auto      delete    list      loggable  qos       segment   set       subport   unset    

You have learned how to install and configure OpenStack client on a Linux system.

Other interesting articles:

Top Open Source Cloud Platforms and Solutions

Best Linux Books for Beginners & Experts

Add Images to Glance using OpenStack command line

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF