Skip to content

CLI Introduction

Besides using the dashboard to interact with your resources in Openstack you can also use the CLI. To access OpenStack components via the CLI install the OpenStack python client. Various Unix distributions provide ready-made packages via their package managers.

Use these instructions to install the OpenStack python client on Linux (Ubuntu/Debian) with Python3

$ apt install python3-dev python3-pip
$ pip3 install --upgrade pip
$ pip3 install python-openstackclient

On Mac OS install the client using brew

$ brew install openstackclient

On FreeBSD install the following package

$ pkg install py38-python-openstackclient

After the installation, ensure the openstack binary is in your path:

$ which openstack
/usr/local/bin/openstack

Configuring the CLI client

Before accessing OpenStack via the CLI, the client needs configuration information about the OpenStack installation. Log into the OpenStack web interface, click the pull-down menu in the upper right corner and select "OpenStack RC file". This will download a file that contains all the necessary environment variables. It prompts for the user password when it is sourced.

Note

The filename differs depending on the project name

$ source openstack-rc-file.sh

Afterwards, test the connection by running any command, for example:

$ openstack network list

If all went well, a list of the default networks for your project is displayed. Other sub-commands exist to list and manipulate the openstack instance from the CLI. Run openstack --help to see a full list.