Openstack CLI - Intermediate

Openstack command-line interface (CLI) installation commands

Install the Openstack CLI tools

This example is for Debian 9, for other distributions look at the bottom of the page.

$ sudo apt update
$ sudo apt install -y python3-pip python3-dev
$ sudo pip3 install python-openstackclient

Configure the OpenStack CLI clients

  1. Log in to the Fuga Dashboard
  2. Go to Compute —> Access & Security —> API Access
  3. Click on download OpenStack RC file v3. This file contains all necessary configurations for the clients. You should open and edit this file with a text editor.
  4. Now copy the contents of this file and paste this in a new text file on the machine where you have installed the OpenStack CLI clients, for example:
    ~/.fuga-openrc.sh
  5. Run the following command to use the configuration file
    source ~/.fuga-openrc.sh
  6. Enter your Fuga password

Use the Fuga CLI

You have now installed and configured the OpenStack CLI client and you can start using the Fuga CLI.
The following are some examples you can try. You can also call openstack help for all available commands. For more in-depth information check out OpenStack command-line clients.

List your instances

$ openstack server list

List your volumes

$ openstack volume list

List the images

$ openstack image list

Interactive mode

If you only enter the command openstack, you enter interactive mode. This mode lets you interact faster with the Fuga CLI.

$ openstack

While in interactive mode enter: help to get all the different commands.

Pro tip

If you only need to find a specific command enter:

$ openstack help | grep "<your command>"

For instance:

$ openstack help | grep list

This will return all list commands.

Install the CLI tools on Windows or Mac OS X

If you want to install the Openstack CLI client on a Windows or Mac OS X operating system, you can check out the following guides:

Enjoy working the CLI tools! For questions, please don’t hesitate to contact us.

Create a new server with CLI

Start an interactive session with:

$ openstack

First create a new key named for example test_cli_key or use an existing key.

Creating a key with the CLI can be done with the following command:

keypair create test_cli_key

This command returns the newly generated private key. Store this somewhere save.

Now test if the key is created:

keypair list

Next up is to list the images and flavors we can choose from.

image list
flavor list

In this example I chose to create an instance, named CLITest with debian 9 of a small server using the newly generated key.

server create cli_test --image 5a2a94e7-3364-4bf8-a66b-ac84bc2c92de --flavor c1.small --key-name test_cli_key

After a few seconds the server is created and built.

Installation commands for different Linux distributions

Ubuntu 14.04:

$ sudo apt update
$ sudo apt install python-pip python-dev
$ sudo pip install --upgrade pip

$ sudo pip install python-openstackclient

pyOpenSSL and Cryptography don’t like python2, so all the given instruction can also be done with python3 and pip3, or just use the instructions from Ubuntu 16.04

Ubuntu 16.04:

$ sudo apt update
$ sudo apt install python3-pip python3-dev
$ sudo pip3 install python-openstackclient

Debian 8:

$ sudo apt update
$ sudo apt install python3-pip python3-dev
$ sudo pip3 install setuptools –upgrade
$ sudo pip3 install python-openstackclient

Debian 9:

$ sudo apt update
$ sudo apt install python3-pip python3-dev
$ sudo pip3 install python-openstackclient

CentOS 7:

$ sudo yum update
$ sudo easy_install pip
$ sudo yum install python-devel gcc
$ sudo pip install python-openstackclient

Fedora 23:

$ sudo dnf update
$ sudo pip3 install –upgrade pip
$ sudo pip3 install -U setuptools
$ sudo dnf install gcc python3-devel redhat-rpm-config
$ sudo pip3 install python-openstackclient

Was this article helpful?


Go to the next tutorial in Openstack CLI

Install and configure the CLI tools on Windows

Using the command line tools for OpenStack on Windows is a bit different and a bit more difficult. In this guide we provide you with the steps required to set this up. Install Python Use the latest stable Python web-based installer from https://www.python.org/downloads/windows/ with these extra settings: Add to PATH Add to environment variables In our experience the process is easier when using Firefox or Chrome instead of Edge
Fuga OpenStack

Code.Build.Deploy

Terms of use