How to install OpenStackClient on Windows using Windows Subsystem for Linux on CloudFerro Cloud OpenStack Hosting[](#how-to-install-openstackclient-on-windows-using-windows-subsystem-for-linux-on-brand-name-openstack-hosting "Permalink to this headline") =============================================================================================================================================================================================================================================================== In this tutorial, you will control your OpenStack environment in a deeper and more precise way using the CLI (Command Line Interface). Of course, you can use the Horizon GUI (Graphical User Interface) running in your browser, but the CLI includes additional features like the ability to use scripts for more automated management of your environment. The instructions for installing Windows Subsystem for Linux are based on the official Windows documentation found at . What We Are Going To Cover[](#what-we-are-going-to-cover "Permalink to this headline") --------------------------------------------------------------------------------------- > * Installing Windows Subsystem for Linux on Microsoft Windows > * Installing the OpenStack CLI client and authenticating Prerequisites[](#prerequisites "Permalink to this headline") ------------------------------------------------------------- No. 1 **Hosting** You need a CloudFerro Cloud hosting account with Horizon interface . No. 2 **Computer running Microsoft Windows** Your computer must be running Microsoft Windows. This article is written for Windows Server 2019 version 1709 or later. The instructions for the following versions are linked in the appropriate location of this article: > * Windows 10 version 1903 up to and excluding version 2004 > * Windows 10 version 2004 or later (Build 19041), Windows 11 > * Windows Server 2022 No. 3 **Optional – software for 2FA authentication** Your account at CloudFerro Cloud cloud may have two-factor authentication enabled. It means that apart from the usual username and password combination, you also need software to generate the TOTP – the six-digit code for the additional, second step of authentication. This article will provide additional technical details: [How to activate OpenStack CLI access to CloudFerro Cloud cloud using one- or two-factor authentication](../accountmanagement/How-to-activate-OpenStack-CLI-access-to-CloudFerro-Cloud-cloud-using-one-or-two-factor-authentication.html.md). Step 1: Check the version of Windows[](#step-1-check-the-version-of-windows "Permalink to this headline") ---------------------------------------------------------------------------------------------------------- Right-click on your start menu and left-click “System”. A screen will appear in which you will see the version of your Microsoft Windows operating system. Memorize it or write it somewhere down. Step 2: Install Ubuntu on Windows Subsystem for Linux[](#step-2-install-ubuntu-on-windows-subsystem-for-linux "Permalink to this headline") -------------------------------------------------------------------------------------------------------------------------------------------- Note The following instructions from this step are for Windows Server 2019 version 1709 or later. If you are running a different operating system, please follow the instructions found under the appropriate link and skip to Step 3: > * Windows Server 2022 - section **Install WSL on Windows Server 2022** > * Windows 10 version 1903 up to and excluding version 2004 - > * Windows 10 version 2004 or later (Build 19041), Windows 11 - Enter the following website: . Download Ubuntu 20.04 using the provided link. This tutorial assumes that your browser saved it in your **Downloads** directory - if that is not the case, please modify the instructions accordingly. Locate the downloaded file: ![wsl01_creodias.png](../_images/wsl01_creodias.png) Right-click it and select the option **Rename**. ![wsl02_creodias.png](../_images/wsl02_creodias.png) Rename the downloaded file to **Ubuntu.zip**: ![wsl03_creodias.png](../_images/wsl03_creodias.png) Right-click the file and select **Extract All…**. ![wsl04_creodias.png](../_images/wsl04_creodias.png) In the wizard that appeared do not change any options and click **Extract**: ![wsl05_creodias.png](../_images/wsl05_creodias.png) A directory called **Ubuntu** should have appeared: ![wsl06_creodias.png](../_images/wsl06_creodias.png) Enter that folder and view its content: ![wsl07_creodias.png](../_images/wsl07_creodias.png) Memorize or write somewhere down the name of the **.appx** file which ends with **x64**. Open your **Start** menu. Right-click the entry **Windows PowerShell** and select **Run as administrator**: ![wsl08_creodias.png](../_images/wsl08_creodias.png) In the displayed window type the following command and press Enter: ``` Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux ``` The following progress bar should have appeared: ![wsl09_creodias.png](../_images/wsl09_creodias.png) After the end of the process you will be asked if you want to restart your computer to complete the operation: ![wsl10_creodias.png](../_images/wsl10_creodias.png) Make sure that the restart will not cause any disruptions and press **Y** to restart. During the reboot you will see the following process message: ![wsl11_creodias.png](../_images/wsl11_creodias.png) Once the reboot is completed, start the PowerShell again as described previously. Run the following command (replace **Ubuntu.appx** with the name of your **.appx** file which you memorized or wrote somewhere down previously): ``` Add-AppxPackage .\Downloads\Ubuntu\Ubuntu.appx ``` During the process, you will see the status bar similar to this: ![wsl12_creodias.png](../_images/wsl12_creodias.png) Once the process is finished, execute the following command (replace the **C:\Users\Administrator\Ubuntu** path with the location of your **Ubuntu** folder): ``` $userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") [System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User") ``` Your newly installed Ubuntu should appear in your **Start** menu: ![wsl13_creodias.png](../_images/wsl13_creodias.png) Run it. You will see the following message: ![wsl14_creodias.png](../_images/wsl14_creodias.png) Wait until this process finishes. After that, you will get a prompt asking you for your desired username (which is to be used in the installed Ubuntu): ![wsl15_creodias.png](../_images/wsl15_creodias.png) Type it and press Enter. You will now be asked to provide the password for that account: ![wsl16_creodias.png](../_images/wsl16_creodias.png) Note Your password will not be visible as you type, not even as masking characters. Input your password and press Enter. You will then be asked to type it again: ![wsl17_creodias.png](../_images/wsl17_creodias.png) If you typed the same password twice, it will be set as the password for that account. You wil get the following message as confirmation: ![wsl18_creodias.png](../_images/wsl18_creodias.png) Wait for a short time. Eventually your Linux environment will be ready: ![wsl19_creodias.png](../_images/wsl19_creodias.png) Step 3: Install OpenStack CLI in an isolated Python environment[](#step-3-install-openstack-cli-in-an-isolated-python-environment "Permalink to this headline") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- Now that you have installed Windows Subsystem on Linux running Ubuntu on your Windows computer, it is time to install OpenStack CLI. Update the software running on your Ubuntu: ``` sudo apt update && sudo apt upgrade ``` Once the process is finished, install the **python3-venv** package to create a separate Python environment: ``` sudo apt install python3-venv ``` Create a virtual environment in which you will have OpenStack CLI installed: ``` python3 -m venv openstack_cli ``` Enter your new virtual environment: ``` source openstack_cli/bin/activate ``` Upgrade **pip** to the latest version: ``` pip install --upgrade pip ``` Install the **python-openstackclient** package: ``` pip install python-openstackclient ``` Verify that the OpenStack CLI works by viewing its help: ``` openstack --help ``` If the command shows its output using a pager, you should be able to use the arrows (or vim keys - **J** and **K**) to scroll and **Q** to exit. If everything seems to work, time to move to the next step - authentication to your user account on CloudFerro Cloud. Step 4: Download your OpenStack RC File[](#step-4-download-your-openstack-rc-file "Permalink to this headline") ---------------------------------------------------------------------------------------------------------------- Login to CloudFerro Cloud hosting account with Horizon interface . Click on your username in the upper right corner. You will see the following menu: ![wsl20_creodias.png](../_images/wsl20_creodias.png) If your account has two factor authentication enabled, click the option **OpenStack RC File (2FA)**. If, however, it does not have it enabled, use the **OpenStack RC File** option. The RC file will be downloaded. Memorize or write somewhere down the name of that file. Move this file to the root location of your **C:** drive. Step 5: Move the RC file to your Ubuntu environment[](#step-5-move-the-rc-file-to-your-ubuntu-environment "Permalink to this headline") ---------------------------------------------------------------------------------------------------------------------------------------- Return to your **Ubuntu** window. You will now copy your RC file to your Ubuntu environment. Since Windows Subsystem for Linux mounts the **C:** drive under **/mnt/c**, the command for copying your RC file to your Ubuntu environment is as follows (replace **main-openrc.sh** with the name of your RC file): ``` cp /mnt/c/main-openrc.sh $HOME ``` If your account uses two-factor authentication, you will need **jq** to activate access to your cloud environment. To install **jq**, execute: ``` sudo apt install -y jq ``` Now use the **source** command on this file to begin the authentication process (replace **main-rc.sh** with the name of your RC file): ``` source main-openrc.sh ``` You will see the prompt for password to your CloudFerro Cloud account. Type your password there and press Enter (the password is still being accepted even if you do not see the characters being typed). If your account has two factor authentication enabled, you will also see the prompt for your six-digit code. Open software which you use for generating such codes (for example KeePassXC or FreeOTP) and find your code there, as usual. Make sure that you enter it before it expires. If you think that you will not manage to enter your current code, wait until a new one is generated. After having entered your code, press Enter. Now you can test whether you have successfully authenticated by listing your VMs: ``` openstack server list ``` How to run this environment later?[](#how-to-run-this-environment-later "Permalink to this headline") ------------------------------------------------------------------------------------------------------ If you close the window with Ubuntu and reopen it, you will see that you are no longer in the **openstack\_cli** environment you created and thus no longer have access to OpenStack. You will need to reenter the **openstack\_cli** environment and reauthenticate. After reopening the Ubuntu Window, execute the **source** command on the file used for entering you **openstack\_cli** environment, just like previously: ``` source openstack_cli/bin/activate ``` Now, reauthenticate by invoking the **source** comand on your **RC** file (replace **main-openrc.sh** with the name of your RC file): ``` source main-openrc.sh ``` Type your password and press Enter. You should now be able execute the OpenStack CLI commands as usual. What To Do Next[](#what-to-do-next "Permalink to this headline") ----------------------------------------------------------------- After installing the OpenStack CLI client and activating your new RC file, you can use other articles to perform operations on CloudFerro Cloud cloud: [How to create a set of VMs using OpenStack Heat Orchestration on CloudFerro Cloud](How-to-create-a-set-of-VMs-using-OpenStack-Heat-Orchestration-on-CloudFerro-Cloud.html.md) [Generating and authorizing Terraform using Keycloak user on CloudFerro Cloud](../openstackdev/Generating-and-authorizing-Terraform-using-Keycloak-user-on-CloudFerro-Cloud.html.md) [How to upload your custom image using OpenStack CLI on CloudFerro Cloud](../cloud/How-to-upload-your-custom-image-using-OpenStack-CLI-on-CloudFerro-Cloud.html.md) [How to create a VM using the OpenStack CLI client on CloudFerro Cloud cloud](../cloud/How-to-create-a-VM-using-the-OpenStack-CLI-client-on-CloudFerro-Cloud-cloud.html.md) [How To Use Command Line Interface for Kubernetes Clusters On CloudFerro Cloud OpenStack Magnum](../kubernetes/How-To-Use-Command-Line-Interface-for-Kubernetes-Clusters-On-CloudFerro-Cloud-OpenStack-Magnum.html.md)