Install the openstack client for nova

Installation

To use OpenStack from the command line, you have to install the OpenStack client on your machine.

OpenStack client installation

Install the OpenStack client for python with pip install.

For a good practice, please create a virtual environment for gricad-nova.
First, install the python3-virtualenv library if it is not already.

$ sudo apt-get install python3-virtualenv

Then, create your virtual environment :

$ virtualenv gricad-nova
$ source gricad-nova/bin/activate
$ pip install python-openstackclient

Now, you can use the openstack command line.

Some services need to install the python-openstack plugin.

Module updates

Depending on your distribution, you may need to update some modules as follows

$ pip install -U MODULE_NAME

Prepare ssh access

To create and access a virtual machine, you need to use an ssh key pair.

Creating a key pair

At least, please have an 4096-bit RSA key protected by a password.
Later, we will learn how to use an ssh agent in order to connect easily.

$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/noemie/.ssh/id_rsa):

Enter a name for the key pair

id_rsa_nova

Then, define a passphrase. It will be linked to the key pair.

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa_nova.
Your public key has been saved in id_rsa_nova.pub.
The key fingerprint is:
SHA256:q+zRYSQS1dBU0iEuy6Vs1IhqBwtiiNQeBKuZMV/+U4A noemie@noemie-HP-EliteBook-820-G3
The key's randomart image is:
+---[RSA 4096]----+
| o+...o=+oo.     |
|+ .o + +oo.      |
|Boo E * =        |
|+B B = O         |
|+ = o * S        |
| . . o + o       |
|      + o        |
|     . +         |
|     .+          |
+----[SHA256]-----+

You have just created the following key pair: (id_rsa_nova , id_rsa_nova.pub).
The private key (id_rsa_nova) saves the identification and should never be given.
This is the public key, id_rsa_nova.pub, which will be used to create and access virtual machines.

Ssh agent

As we don’t want to enter the passphrase for each connection to an instance, we can use the ssh-agent.
Just give the passphrase to the ssh-agent with the ssh-add command.

$ ssh-add
Enter passphrase for /home/<nom_utilisateur>/.ssh/id_rsa: 
Identity added: /home/<nom_utilisateur>/.ssh/id_rsa (/home/<nom_utilisateur>/.ssh/id_rsa)

To know which user is declared, please use

$ ssh-add -l 

that returns :

  • the fingerprint of the known key
  • the user name
  • the type of encryption key used