Preparing a Computer
Preparing a Computer
Before using the OpenStack CLI you must first decide which computer(s) you will use to run it. You can use a physical desktop or laptop computer, or a virtual cloud instance like those available on Jetstream2. A bit of setup work is needed per computer, so consider your choice carefully.
The CLI can be installed on Linux, Mac or Windows computers. Before continuing, you will want to make sure that your operating system has been fully updated.
- Windows Note:
-
The CLI reads values from specific environment variables to discover which physical cloud, project and user to target when executing CLI commands. The page Configuring an openrc.sh File discusses how you can create a script file to define the necessary variables. This script must be executed in the Bash shell.
Because Windows systems cannot natively process Bash scripts, it is recommended that you install a version of the Bash shell on your Windows computer. One of the easiest ways to do that is to install Git for Windows, which includes the handy Bash emulator "Git Bash".
Python Considerations
The Openstack CLI is written in Python, and thus requires a Python 3 environment to be installed on your computer (the use of Python 2 with the CLI is strongly discouraged). Consult the Current Status section of the OpenStack Python 3 page to select a release of Python 3 that fully supports the CLI.
The Windows operating system does not come with Python installed, but some older Linux distributions and Mac computers have version 2.7 of Python installed by default. In addition to any pre-installed versions of Python, you might have other installations of Python on your system that you use for your work. You can choose to run the CLI on any suitable Python 3 installation that is already on your computer, but there are several reasons why you might want to install a separate version of Python for use by the CLI.
- Your Windows computer does not have Python installed.
- You wish to run the CLI on a different version of Python than those that are already installed.
- You do not want to risk disturbing the system's installation of Python (on Linux and Mac) when you install the CLI and its dependencies.
- You do not have sufficient permissions to add the CLI to the system's Python installation.
If you are in situation 3 or 4 above, you have two choices for creating another installation of Python. The first is to install the CLI with the user install option. With this option, the system-wide Python installation is not touched and the CLI packages are installed into a folder in your account, where they are only available to you. This allows each user to install packages without affecting the operating system or other users.
Alternatively, you can create a virtual environment into which the CLI can be installed. A Python virtual environment system not only isolates your Python environment from the system-wide installation and from other users, but also allows you to create multiple such environments that are isolated from each other.
Installing Python
With these considerations in mind, you can determine if you want to install a new version of Python on your system. There are several ways to do so, including:
- For Windows and Mac, Download an installer from Python.org.
-
For recent versions of Ubuntu, issue a command like:
sudo apt install python3.11L
-
For Rocky Linux or AlmaLinux, issue the command:
sudo dnf install python3
- Install a Python package management system like conda (Windows, Mac or Linux).
Most of these installation techniques will update your environment
so that it knows where to find the Python command.
To confirm this, execute the command: python3 --version
.
If Python is not found, you must update your environment's PATH variables yourself
to include the location of the new installation.
The procedures to do this are different on
Windows,
Mac
and Linux.
A Few Last Things
Unless you are using the conda system to manage packages
(typically in conjunction with the Anaconda Python Distribution),
Python's package installers "pip" and "setuptools" are needed to install the CLI.
They should be included with all versions of Python that are sufficient for running the CLI.
To confirm this, run the command pip3 list
.
If the pip3
command is not found, you will need to
install pip by hand.
If the command runs, you should see "setuptools" in the list of installed packages.
If setuptools is missing, run the command pip3 install setuptools
.
- Windows Note:
- If you are installing Python on a Windows computer, you will need to make sure that Microsoft's Visual C++ Compiler is installed on your system so that the CLI installation will be successful. Information on the version you should choose and how to install it are available at python.org.
With Bash and Python installed on your computer, you are ready to install the openstack-client.