Many resources are there to help a beginner OpenStack developer. To name a few, OpenStack contributor’s wiki, guide, reference documentation in each project. For example Manila Developer’s guide for Manila project. But it might get complex for a beginner and you might run into many errors like I did. So, I decided to compile all steps I followed to install DevStack, address errors I faced in this article. Hope it will help you to start in no time.
I used Outreachy alum Nisha Yadav’s post as reference, it helped me a lot. My machine is Mac OS, so I had to install Virtual Box and for my operating system, I downloaded Ubuntu 20. But from my experience, you need to download lower version of Ubuntu like 18 or 17. Because some features of DevStack may not work and most probably you will face many errors like I did.
1. Install Virtual Box
Following are instructions from Nisha Yadav’s article on how to install Virtual Box and Ubuntu. It is complete and still relates in 2020.
Download a suitable Oracle Virtual Box for your operating system.
Download the desired Ubuntu iso file. Install and start Oracle Virtual Box.
Click on the “New” button in the wizard, give the new virtual machine a name, check “Linux” in the “Type” area and check “Ubuntu” in the “Version” area (32 or 64-bit, depending on downloaded iso file).
Set the amount of RAM (ideally not more than 50% of your total RAM). Something to keep in mind: DevStack will perform best with 4GB or more of RAM.
Select “Create a Virtual Hard Disk Now,” check “VDI (VirtualBox Disk Image),” then select “Dynamically Allocated” and finally set the hard disk size (60- 100 GB ideally).
Double-click your new machine in the left menu and select the downloaded Ubuntu iso file.
Next, click “Install Ubuntu”. Click “Continue” and then select “Erase Disk and Install Ubuntu”. (Note: this will not erase files on your local machine). Complete the rest of the wizard and, finally, you’ll have Ubuntu installed inside your VM.
Before restarting the VM:
Select your machine and click on “Settings”.
Under the “Storage” tab, check if the installation iso file is still present; if it is, select and remove it.
To work in full screen, install guest additions. To do so, restart your VM, click on “Devices” from menu, select “Insert Guest Additions CD image” and press “Run”. After completion, press “Enter” and restart your VM.
In my machine I am not able to restart VM through Virtual Box menu, so I run
VirtualBoxVM --startvm YOUR_MACHINE_NAME in my terminal and it works. Also, I recommend to go to “Devices” from you menu, then “Shared Clipboard” and to make it “Bidirectional” to be able to copy paste from host machine to virtual machine (VM).
2. Set up SSH access
Next, go to you home directory:
cd ~ using terminal on VM. And following instructions from Nisha Yadav’s article only below steps, this will be useful to setup Gerritt as well, later on. Alternatively, there is nice article from another Outreachy alum, Maari Tamm on setting up SSH access.
a) Create a new SSH key, using your provided email as a label:
ssh-keygen -t rsa -C "YOUR_EMAIL@EMAIL_ADDRESS.com"
b) Press the “Enter” key to accept the default file location in which to save the key.
c) At the prompt, type a secure passphrase. You may keep it empty by directly pressing the “Enter” key for no passphrase.
d) Start the ssh-agent in the background
eval "$(ssh-agent -s)"
e) Add your SSH key to ssh-agent.
f) Download and install xclip.
sudo apt-get install xclip
g) Copy the SSH key (i.e. contents of the id_rsa.pub file) to your clipboard.
sudo xclip -sel clip < ~/.ssh/id_rsa.pub
If you are unable to install clip use
h) If you don’t have a github account, first create one. Then, login into your github account, go to “Settings”, click “SSH and GPG keys” then select “new SSH key”. Write a description in “Title” and paste your key into the “Key” field (for pasting, press Ctrl+V). Finally press “Add SSH Key”.
i) Test your connection using ssh:
ssh -T email@example.com
Now if the fingerprint matches, type “yes.” If you now see you username in the message, you have successfully set up your SSH key!
3. Set up DevStack
Install git from terminal:
sudo apt-get install git
git clone https://opendev.org/openstack/devstack
Then change you directory to devstack:
Create local.conf file in devstack directory:
Install vim editor and paste necessary configuration for your project to local.conf file.
sudo apt-get install vim
to go to INSERT MODE press
i , to write changes and quit press ESC, then
Sample local.conf files can be be found here. I used
CEPHFS driver configuration settings and was able to install DevStack. Just add HOST_IP line in the config file, generally it is your localhost ip ,
127.0.0.1. Like below:
Next run below command in your terminal:
It should take about 40 minutes, more or less depending on your internet connection. While installing you might run into error
broute' is incompatible, use 'nft' tool , the solution is here on Stack Overflow.
If you run into error
NETWORK_ID can't be created, try
./unstack.sh and then run again
./stack.sh, it should work.
./clean.sh will remove all devstack files, so be careful and use it, only if you need to remove all files.
./stack.sh command was completed successfully, you will see user and password on your screen.
Now, you can access DevStack on
http://HOST_IP/dashboard in your browser and you should see following window:
4. Set up Gerrit
First you need to create Launchpad account.
Next, from terminal window go to your home directory:
Copy your SSH key:
sudo xclip -sel clip < ~/.ssh/id_rsa.pub
Go to Gerrit from your browser, login with your Launchpad credentials.
Install git review from your terminal:
sudo apt-get install git-review
Now click on “Settings,” then select “SSH Public Keys” and press “Add Key”. Press Ctrl+V to paste the key and then click “Add.”
Move to project directory from terminal, for example Manila UI:
Run following command from your terminal, to test git review:
git review -s
5. Get ready for a Development
After implementing changes in your project, you always have to run tests with
tox command in your terminal before submitting changes for review.
If you installed Ubuntu 20, your
tox command might result in error. I was able to fix this, by installing Python 3.7 and dependencies. Just follow all steps in this detailed post from techadmin.net. Otherwise it should work fine. For development I am using Visual Studio Code. I installed Remote – SSH extension from Microsoft. Then added SSH target like below:
2) Next you need to enter your connection, for example firstname.lastname@example.org:
3) Click on Open Folder and go to to your directory. In my case, I’m developing Manila UI, so I am open directory
/opt/stack/manila-ui. You can choose any project you are working on.
This is it, now you are ready to start your development. Any additions and suggestions to this post are welcome.