Skip to content

OpenStack Client Installation

OpenStack Client (OSC) is a command-line client for OpenStack, which consolidates the command set for Compute, Identity, Image, Object Storage, and Block Storage APIs into a single shell with a unified command structure.

This chapter describes how to install and configure OCS.

Prerequisites

  • Basic knowledge of the Linux operating system (shell)
  • Access to a running Linux VM (Ubuntu in our example) with an open port (Egress 443) to the OpenStack API
  • Application Credentials (cloud.yaml)

The steps to be executed are:

  • Installation of python-openstackclient and python-keystoneclient packages
  • Configuration of Authentication (Application Credentials)

Note

We recommend python venv or/and pyenv. Based on our experience, Python version 3.9.16 is currently the most suitable.

Steps:

1) Install pyenv

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"

2.) Install python 3.9.16 version in pyenv

sudo apt update
sudo apt install build-essential libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget curl libncurses5-dev libncursesw5-dev xz-utils libffi-dev liblzma-dev
pyenv install 3.9.16 # takes a couple of minutes
echo '3.9.16' > ~/.python-version
# you can use virtualenv from within pyenv as well...

3.) Install openstack clients

cd ~/  # this is important to guarantee the pyenv installed python 3.9.16 is used
pip install -U pip
pip install -U \
  "gnocchiclient==7.0.7" \
  "openstacksdk<0.102.0" \
  "osc-placement<4.1.0" \
  "oslo.utils<6.1.0" \
  "python-barbicanclient<5.5.0" \
  "python-cinderclient<9.2.0" \
  "python-cloudkittyclient<4.7.0" \
  "python-designateclient<5.1.0" \
  "python-glanceclient<4.2.0" \
  "python-heatclient<3.2.0" \
  "python-keystoneclient<5.1.0" \
  "python-magnumclient<4.1.0" \
  "python-mistralclient<5.0.0" \
  "python-neutronclient<8.2.0" \
  "python-novaclient<18.2.0" \
  "python-octaviaclient<3.2.0" \
  "python-openstackclient<6.1.0" \
  "python-swiftclient<4.2.0"

Tip

To utilize the latest Port Forwarding features in the Python OpenStack Client you must also install the following package:

#Install customized python_openstack client with port forwarding support
pip install https://s3.ewstorage.ch/pub/python_openstackclient-6.2.1.dev3-py3-none-any.whl 

4.) Setup bash_completion

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

5.) Configure Application Credentials

mkdir -p ~/.config/openstack

# Paste your clouds.yaml file content or copy it to
vim ~/.config/openstack/clouds.yaml

# Define default connection
export OS_CLOUD=openstack 

Note

OS_CLOUD=openstack refers to the configuration block in your clouds.yaml file, and you can have multiple blocks! If you do not export the OS_CLOUD variable, you can also specify the cloud configuration block on the command line. For example openstack --os-cloud=openstack image list

Example: clouds.yaml

6.) Test Configuration and Connectivity

openstack image list
root@ewos1-admin1-prod:~# openstack image list --public
+--------------------------------------+-----------------------------------+--------+
| ID                                   | Name                              | Status |
+--------------------------------------+-----------------------------------+--------+
| 95538b63-f446-48db-a57a-c9100c194562 | AlmaLinux 10                      | active |
| 9afa452e-3343-46f7-8be2-59aa7af05541 | AlmaLinux 10 LVM                  | active |
| 12d88af5-2bd3-4907-8053-8f7e1b5439ea | AlmaLinux 9                       | active |
| 19d86022-e8de-483f-a21c-30f044dd78af | AlmaLinux 9 LVM                   | active |
| c7d50227-3398-4870-8db5-e31e5d7d2dcf | CentOS Stream 9                   | active |
| 17047aaf-51a7-4441-b2bf-dcf673e07bb7 | CentOS Stream 9 LVM               | active |
| 089f1825-a762-499e-9b4b-5d0ef7b05068 | CirrOS 0.6.3                      | active |
| 62303abb-bcd3-4604-aedb-e282f1eef863 | Red Hat Enterprise Linux 7        | active |
| 37fd3deb-4915-4e74-97ca-9a8f3000c3fe | Ubuntu 22.04                      | active |
| 6d158068-bf79-4459-a69d-0d374231bf5b | Ubuntu 22.04 DevTools             | active |
| 888b3974-711f-4b74-9d96-5b3c4d8f658d | Ubuntu 22.04 GPU                  | active |
| 3bb383ce-7db3-46c4-99af-ee82300d9fa9 | Ubuntu 22.04 LVM                  | active |
| b152a2bd-4f31-463e-bbd4-0983d97440bb | Ubuntu 24.04                      | active |
| 455a6a66-53dd-4ecb-90a9-e57be4c43590 | Ubuntu 24.04 DevTools             | active |
| 2aa5310e-5942-49ae-91c0-f953cce26fa6 | Ubuntu 24.04 GPU                  | active |
| b10f68a1-2486-492f-80f6-6e0e6a5200fd | Ubuntu 24.04 LVM                  | active |
| 739eede2-f176-442b-8574-516701eac5bd | Windows Server 2019 Standard      | active |
| 14fe6d1d-752f-4aef-b69c-f9cb9fc4421e | Windows Server 2022 Standard      | active |
| 43ebb5db-f6cb-4bf4-a24e-5a1eafc7c12f | Windows Server 2022 Standard Core | active |
| 590ea95b-3a7a-43bb-8657-ee8645900cf7 | almalinux-9-amd64-disk-temp       | active |
| 7f438b74-7c48-47c8-b3de-969b9f60e87a | centos-9_stream-amd64-disk-temp   | active |
| ff4599a3-7814-4d5a-849d-7574b1643e98 | cirros-0.5.2-x86_64-disk          | active |
| 3eb03356-1bc6-4771-baf9-1907fd171b3c | cirros-0.6.1-x86_64-disk          | active |
| 14430020-2025-0503-0535-71358578b868 | gardenlinux-1443                  | active |
+--------------------------------------+-----------------------------------+--------+

Congratulations, your OpenStack client is working!

For more information on the available commands, please visit the following website: OpenStackClient User Manual