
Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: May 20, 2024
Cloud computing has revolutionized business operations, offering scalability, efficiency, and innovation. OpenStack, an open-source cloud platform, provides a flexible and cost-effective solution for building and managing our own cloud infrastructure.
In this article, we’ll go through installing OpenStack on Ubuntu, a stable and widely supported operating system. These step-by-step instructions will enable us to create virtual machines, manage storage, and set up networks within our cloud environment. Get ready to unlock the power of OpenStack on Ubuntu and embark on our cloud computing journey.
OpenStack is an open-source cloud computing platform that provides software tools for building and managing public and private clouds. It consists of a group of open-source projects that form this platform together. It allows users to create and manage virtual machines, storage, and networking resources in a scalable and flexible manner.
OpenStack was designed to be modular and interoperable, providing a framework for integrating various components and technologies to create a comprehensive cloud infrastructure. It includes components such as Nova (compute service), Cinder (block storage), Neutron (networking), and Keystone (identity service), among others.
OpenStack enables organizations to deploy and manage their cloud infrastructure, offering features like self-service provisioning, resource monitoring, and automation. It has gained popularity among businesses and service providers looking for an open and customizable cloud solution.
A physical or virtual machine with:
Once we’ve set up a machine with these specs, we can start with the installation process.
We’ll install Microstack, a fully-fledged flavor of OpenStack designed for development, testing, and small-scale cloud deployments.
Firstly, we’ll install OpenStack using snap:
$ sudo snap install openstack --channel 2023.1
Next, we must prepare the machine to ensure all our dependencies are installed.
To do this, we’ll use a tool called Sunbeam. Sunbeam is an OpenStack project that makes installation easier by using some default configurations so that we don’t need to do much customization to set up our environment.
To prepare the machine, run:
$ sunbeam prepare-node-script | bash -x && newgrp snap_daemon
This will run a script that installs missing dependencies and sets some system configurations.
To view the contents of this script, we can run:
$ sunbeam prepare-node-script
The script will install some dependencies and set passwordless sudo for the current user.
After the script has finished running, we can deploy the OpenStack cloud using this command:
$ sunbeam cluster bootstrap --accept-defaults
This command will bootstrap the cloud cluster using some preset defaults.
We can skip the defaults and use our values by running this instead:
$ sunbeam cluster bootstrap
At this point, we’ll be prompted to enter the address ranges and CIDR of our control plane; below is an example:
Management networks shared by hosts (CIDRs, separated by comma) (10.20.20.0/24): 172.16.1.0/24
MetalLB address allocation range (supports multiple ranges, comma separated) (10.20.20.10-10.20.20.20): 172.16.1.201-172.16.1.220
Afterwards, we need to configure our cluster and get our credentials:
$ sunbeam configure --accept-defaults --openrc demo-openrc
Again, this command will use prefilled defaults. To skip this and choose our values, we can remove the –accept-defaults part from the command.
If we choose not to use the defaults, we’ll be prompted to set some values for our cluster; below is an example:
Local or remote access to VMs [local/remote] (local): remote
CIDR of network to use for external networking (10.20.20.0/24): 172.16.2.0/24
IP address of default gateway for external network (10.20.20.1): 172.16.2.1
Populate OpenStack cloud with demo user, default images, flavors etc [y/n] (y):
Username to use for access to OpenStack (demo):
Password to use for access to OpenStack (mt********):
Network range to use for project network (192.168.122.0/24):
Enable ping and SSH access to instances? [y/n] (y):
Start of IP allocation range for external network (10.20.20.2): 172.16.2.2
End of IP allocation range for external network (10.20.20.254): 172.16.2.254
Network type for access to external network [flat/vlan] (flat):
Writing openrc to demo-openrc ... done
Free network interface that will be configured for external traffic [eno1/eno2] (eno1): eno2
After running the previous command successfully, we’ll now have our OpenStack cluster deployed.
Now, since our cluster is ready, we can test it by starting a VM instance:
$ sunbeam launch ubuntu --name test
We set the name of our VM as test, and it is based on the Ubuntu image.
An example of the output for the previous command:
Launching an OpenStack instance ...
Access instance with `ssh -i /home/ubuntu/.config/openstack/sunbeam [email protected]`
We can use the ssh command in the output above to access the VM. Note that it may take a few minutes for the VM to become ready. Time may vary according to the resources of the cluster.
At this point, we have a deployed OpenStack cluster, and we’ve created a VM instance inside it.
Now that we’ve finished installing OpenStack, we can start playing with it more. We’ll suggest some topics to look at next that will improve our understanding of OpenStack and take us to the next level. Note that these topics will not be covered in this article; they are just to guide us on what to look at next.
First, we suggest playing with the OpenStack client or CLI and becoming comfortable using it. This will be useful as we will use it a lot when working with OpenStack. Afterward, we’d suggest setting up the OpenStack dashboard. This is a web portal that will help us manage and visualize our cluster resources.
We’d also encourage to read about the different OpenStack services and tools available. It is important to know their differences and when to use each.
To sum up, in this article, we discussed what OpenStack is and why it is useful. We then explored how to install it on a single machine running Ubuntu. Finally, we talked about what the next steps in our learning journey for OpenStack could be.