Cloud

Install OpenStack CLI Client on Ubuntu / Debian / RHEL

The OpenStack CLI (python-openstackclient) is the unified command-line tool for managing OpenStack services. It combines Compute (Nova), Identity (Keystone), Image (Glance), Network (Neutron), Block Storage (Cinder), and Object Storage (Swift) into a single openstack command with consistent syntax. This guide covers installation on Ubuntu, Debian, Rocky Linux, and RHEL, plus configuration and verification.

Original content from computingforgeeks.com - post 21595

Prerequisites

  • A Linux system (Ubuntu 24.04/22.04, Debian 13/12, Rocky Linux 10/9, RHEL 10/9, Fedora 42)
  • Python 3.10 or newer (required by openstackclient 9.x)
  • Access credentials for an OpenStack deployment (auth URL, username, password, project name)

Install OpenStack CLI on Ubuntu / Debian

Option 1: Distribution package (simplest)

Ubuntu and Debian ship python3-openstackclient in their repositories. The version may lag behind the latest PyPI release, but it’s stable and integrates with system Python:

sudo apt update
sudo apt install -y python3-openstackclient

Option 2: pip in a virtual environment (latest version)

For the latest release (9.0.0 as of this writing), install via pip inside a virtual environment. This avoids conflicts with system packages:

sudo apt install -y python3-venv python3-dev
python3 -m venv ~/.openstack-venv
source ~/.openstack-venv/bin/activate
pip install --upgrade pip
pip install python-openstackclient

Activate the virtual environment before each use:

source ~/.openstack-venv/bin/activate

Install OpenStack CLI on Rocky Linux / RHEL / Fedora

Option 1: RDO packages

On RHEL-family systems, the RDO project provides packaged OpenStack clients. Enable the repository and install:

sudo dnf install -y centos-release-openstack-dalmatian
sudo dnf install -y python3-openstackclient

Replace dalmatian with the OpenStack release that matches your deployment (e.g., caracal, bobcat).

Option 2: pip in a virtual environment

sudo dnf install -y python3-devel python3-pip
python3 -m venv ~/.openstack-venv
source ~/.openstack-venv/bin/activate
pip install --upgrade pip
pip install python-openstackclient

Verify the Installation

Confirm the openstack command is available and check the installed version:

openstack --version

Expected output:

openstack 9.0.0

For more details about the installed package:

pip show python-openstackclient

Configure Authentication

The OpenStack CLI reads authentication credentials from environment variables. Create a credentials file (commonly called an RC file or openrc file):

vi ~/admin-openrc.sh

Add your OpenStack credentials:

export OS_AUTH_URL=https://openstack.example.com:5000/v3
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=your-password-here
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2

Update the values to match your OpenStack environment. You can download this file directly from the Horizon dashboard under Project > API Access > Download OpenStack RC File.

Source the file to load the credentials into your shell:

source ~/admin-openrc.sh

Test the Connection

Run a few commands to confirm the CLI is connecting to your OpenStack deployment:

openstack project list

List available compute flavors:

openstack flavor list

List networks:

openstack network list

If any command returns an authentication error, double-check the values in your RC file, particularly OS_AUTH_URL and OS_PASSWORD.

Enable Bash Completion

Tab completion makes the CLI significantly faster to use. Generate and install the completion script:

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

Log out and log back in (or run source /etc/bash_completion.d/osc.bash_completion) to activate. Now you can tab-complete any OpenStack command:

openstack server [TAB]
create  delete  list  rebuild  reboot  resize  show  start  stop  ...

Install Additional Service Clients

The base python-openstackclient covers core services. Some OpenStack services require separate client plugins:

ServicePlugin PackageInstall Command
Heat (Orchestration)python-heatclientpip install python-heatclient
Designate (DNS)python-designateclientpip install python-designateclient
Barbican (Key Manager)python-barbicanclientpip install python-barbicanclient
Octavia (Load Balancer)python-octaviaclientpip install python-octaviaclient
Manila (Shared File Systems)python-manilaclientpip install python-manilaclient
Magnum (Containers)python-magnumclientpip install python-magnumclient

These plugins register their commands automatically. After installing python-heatclient, for example, openstack stack list becomes available without further configuration.

Common OpenStack CLI Commands

Quick reference for the most-used operations after the client is set up:

TaskCommand
List serversopenstack server list
Create a serveropenstack server create --flavor m1.small --image Ubuntu-24.04 --network net1 myvm
List imagesopenstack image list
List networksopenstack network list
Create a networkopenstack network create mynet
List flavorsopenstack flavor list
Show token infoopenstack token issue
List usersopenstack user list
Check service endpointsopenstack endpoint list

For detailed networking operations, see the OpenStack networks and subnets guide. To manage images, see uploading images to OpenStack Glance. For compute flavors, the OpenStack flavors CLI guide covers creation and management. You can also deploy VMs on OpenStack using Terraform for infrastructure-as-code workflows.

Related Articles

Openstack Create VM on OpenStack Using Cloud-init user data Openstack Add SSH Key Pairs to OpenStack Using CLI Automation Configure AWS Application Load Balancer with CloudFormation Terminal Install Tilix GTK3 terminal emulator on Ubuntu / Debian

Leave a Comment

Press ESC to close