OpenStack is an enterprise-grade open source platform for building and managing cloud computing infrastructure. With powerful automation and orchestration engines, it enables programmatic control over large pools of compute, storage and networking resources.

Mastering OpenStack puts full-stack developers in high demand as cloud architects and infrastructure engineers. This step-by-step guide explores installing a basic OpenStack environment on VirtualBox – perfect for testing by programmers and system admins.

Understanding OpenStack Architecture

Before starting the installation, it helps to understand OpenStack components and architecture.

OpenStack Architecture

OpenStack has a modular architecture, with loosely coupled services communicating through public APIs.

Main services:

  • Nova: Compute engine for managing virtual machines
  • Neutron: Networking service for managing network connections
  • Cinder: Block storage service for providing persistent volumes
  • Swift: Object storage service for storing files and data
  • Glance: Image service for distributing VM images
  • Keystone: Identity service for authentication and authorization

These services are controlled by the Horizon dashboard and Heat orchestration engine. Multiple OpenStack installations can be managed centrally through the Ansible automation tool.

Why Use OpenStack? Benefits for Developers

Before we dive into the installation, it‘s worth understanding why developers should learn OpenStack in the first place:

  • Infrastructure-as-Code: OpenStack allows programmatic control for provisioning infrastructure
  • Self-service: Users can spin up resources quickly without IT ticket overhead
  • Cost savings: Open source alternative to public cloud providers like AWS and Azure
  • Skills development: Learn in-demand cloud and DevOps engineering skills
  • Control: Fine-grained control over pool of resources not possible on public cloud
  • Open standards: Avoid vendor lock-in by using open APIs and platforms

As an engineer, getting hands-on with technologies like OpenStack is crucial for career advancement and unlocking new opportunities.

Prerequisites and Requirements

OpenStack deployment has some hardware and software requirements for smooth performance:

Hardware

Component Recommended Minimum
RAM 32 GB 16 GB
CPU cores 8 4
Disk space 500 GB 100 GB

Software

Component Version
OS base CentOS 7
Hypervisor VirtualBox 6.0+
OpenStack Rocky+
Ansible (optional) Latest

For starters, the minimum specs are enough to begin testing OpenStack on a single VM. Production deployments will need bare metal servers or virtualization clusters exceeding the recommended specs above.

Step 1 – Download CentOS 7 and Create a Virtual Machine

We‘ll first create a CentOS 7 VM in VirtualBox with bridged networking to act as our OpenStack controller node. This will run the core services and installation tooling.

Get CentOS 7 ISO

Download the latest 64-bit minimal CentOS 7 ISO. I prefer the minimal image since we will be installing packages ourselves.

CentOS 7 ISO Download

Create Virtual Machine

In VirtualBox, create a new VM with the following settings:

  • Name: OpenStack Controller
  • Type: Linux
  • Version: Red Hat (64 bit)
  • RAM: 16 GB (or higher if you have available memory)
  • Storage:
    • Disk type: Fixed size
    • Size: 100 GB
  • Network:
    • Attachment: Bridged adapter
    • Promiscuous mode: Allow All

Next, configure the VM to use the CentOS ISO image as a virtual optical drive.

With the VM created, launch it to begin the OS installation process.

Install CentOS 7

Follow the on-screen wizard to install CentOS with the minimum setup:

  • Set root password
  • Create user account
  • Configure networking
    • Set Ethernet connection as dynamic IP/DHCP

The VM will now boot into the default CentOS desktop screen.

Step 2 – Configure Networking

Log into the VM via SSH or the VirtualBox console as the root user.

Run the following to disable default networking services:

systemctl disable firewalld
systemctl stop firewalld 

systemctl disable NetworkManager  
systemctl stop NetworkManager

Enable the legacy network service instead for interface control:

systemctl enable network
systemctl start network

Check the network interface name with ip addr – for example enp0s3.

Configure this interface to use DHCP by default:

echo "DEVICE=enp0s3
ONBOOT=yes
BOOTPROTO=dhcp" > /etc/sysconfig/network-scripts/ifcfg-enp0s3 

Reboot CentOS for networking changes to apply. The OS should automatically get an IP address from your network.

Step 3 – Install OpenStack Packstack

With connectivity ensured, we can proceed with installing OpenStack services using Packstack. This auto-installer is provided via the Rocky Linux repository.

Enable the OpenStack repo:

yum install centos-release-openstack-rocky

Install Packstack installer:

yum install openstack-packstack

Now run the Packstack allinone installer to deploy core services:

packstack --allinone 

This will initialize required OpenStack packages, perform networking setup, start services and output admin credentials – taking 10-15 minutes.

Packstack Installation Screen

When finished, source credentials to access admin endpoints:

. keystonerc_admin

Our basic OpenStack environment is ready!

Step 4 – Configure Storage Backend

OpenStack provides persistence for instances via block storage devices. By default Packstack uses native file-based storage, which does not offer redundancy or performance.

Production deployments should leverage dedicated storage arrays or software-defined solutions. However for testing, we can simply switch the backend driver to use a basic logical volume (LVM):

  1. Disable native storage driver:
    Edit /etc/cinder/cinder.conf and set enabled_backends to an empty value:

     enabled_backends=
  2. Enable LVM storage driver:
    Edit /etc/cinder/cinder.conf and add a storage backend section:

     [lvm]
     volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
     volume_group = cinder-volumes 
     volumes_dir = /var/lib/cinder/volumes
  3. Restart storage services:

     systemctl restart openstack-cinder-volume.service \ 
                   openstack-cinder-scheduler.service 

Block storage is now configured and ready for container volumes!

Step 5 – Accessing the Dashboard

To access the OpenStack dashboard, we need the VM‘s IP address available on DHCP:

ip addr show dev enp0s3

Copy this IP and enter it in a browser with port 80 enabled:

http://192.168.1.25

You will see the Horizon login page. Use the admin credentials from the keystonerc_admin file earlier.

The main OpenStack dashboard should now load, showing metrics and topology maps of compute, network and storage infrastructure.

OpenStack Dashboard

The environment is ready start containerizing applications and configuring infrastructure services!

Going Forward: Tips and Gotchas

Here are some troubleshooting tips for running OpenStack on VirtualBox gleaned from past experience:

  • Shut down services properly before restarting Packstack installations
  • Check network connectivity between host and VMs during provisioning issues
  • Adjust PCI passthrough settings for improved storage perf if using iSCSI or FC protocols
  • Set reserved host memory in Nova if experiencing OOM or slowness issues
  • Monitor free disk space as logs can quickly fill up 20-30GB
  • Horizon dashboard may be slow; use native clients or ansible instead for large configs

Additionally, when looking to experiment with various OpenStack components, consult the compatibility matrix before mixing versions:

Release Nova Neutron Cinder
Rocky 17.0.9 14.0.1 14.0.2
Stein 18.0.1 14.0.4 15.0.0
Train 19.0.2 15.0.3 16.0.1

Care should be taken to match versions for stability, as OpenStack undergoes continual rapid development.

This covers the basics of an OpenStack all-in-one installation on VirtualBox. With core infrastructure services now running, developers can start interacting through native Python clients, provision containers, configure networks, attach storage volumes and carry out automation tasks.

Let me know in the comments if you have any issues getting OpenStack up and running!

Similar Posts