How to Install OpenStack on Ubuntu Server

OpenStack is a free, open source cloud computing platform that enables users to build and manage public and private clouds. In this tutorial, we will guide you through the process of installing OpenStack on Ubuntu Server latest version.

Prerequisites

Before proceeding with the installation, you should ensure that you have the following prerequisites:

Step 1: Update the System

Before installing OpenStack, you should ensure that your system is up to date by running the following commands in the terminal:

sudo apt update
sudo apt upgrade

Step 2: Install OpenStack Packages

OpenStack consists of several components, including Keystone, Nova, Glance, Neutron, and Horizon, among others. To install the OpenStack packages, run the following command:

sudo apt install python3-openstackclient

Step 3: Setup Database

OpenStack requires a database to store its configuration and other data. In this tutorial, we will use MariaDB database. To install MariaDB, run the following command:

sudo apt install mariadb-server

Once MariaDB is installed, run the following commands to secure the database:

sudo mysql_secure_installation

Answer the prompts accordingly to set a secure password for the database root user and configure some additional security options.

Next, create a new user and database for OpenStack:

sudo mysql -u root -p

MariaDB> CREATE DATABASE keystone;
MariaDB> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'password';
MariaDB> EXIT;

Replace 'password' with your preferred password for the keystone user.

Step 4: Install and Configure Keystone

Keystone is the identity service for OpenStack. To install Keystone, run the following command:

sudo apt install keystone

Once Keystone is installed, edit the /etc/keystone/keystone.conf file and update the database connection settings:

[database]
connection = mysql+pymysql://keystone:password@localhost/keystone

Replace 'password' with the password you set for the keystone database user in the previous step.

Next, initialize the database and create a bootstrap token:

sudo keystone-manage db_sync
sudo keystone-manage bootstrap --bootstrap-password PASSWORD \
  --bootstrap-admin-url http://localhost:5000/v3/ \
  --bootstrap-internal-url http://localhost:5000/v3/ \
  --bootstrap-public-url http://localhost:5000/v3/ \
  --bootstrap-region-id RegionOne

Replace 'PASSWORD' with your preferred password for the bootstrap user.

Finally, restart the Keystone service:

sudo systemctl restart apache2

Step 5: Install and Configure Nova

Nova is the compute service for OpenStack. To install Nova, run the following command:

sudo apt install nova-api nova-conductor nova-novncproxy nova-scheduler nova-placement-api

Once Nova is installed, edit the /etc/nova/nova.conf file and update the database and Keystone settings:

[database]
connection = mysql+pymysql://nova:password@localhost/nova

[DEFAULT]
transport_url = rabbit://openstack:password@localhost
auth_strategy = keystone
my_ip = <IP_ADDRESS>
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[keystone_authtoken]
www_authenticate_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = PASSWORD

[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://localhost:6080/vnc_auto.html

[glance]
api_servers = http://localhost:9292

Replace 'password' and 'PASSWORD' with your preferred passwords for the nova and Keystone users, respectively.

Replace with the IP address of your server.

Next, initialize the database:

sudo su -s /bin/sh -c "nova-manage api_db sync" nova
sudo su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
sudo su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
sudo su -s /bin/sh -c "nova-manage db sync" nova

Finally, restart the Nova services:

sudo systemctl restart nova-api.service nova-scheduler.service nova-conductor.service nova-novncproxy.service

Step 6: Install and Configure Glance

Glance is the image service for OpenStack. To install Glance, run the following command:

sudo apt install glance

Once Glance is installed, edit the /etc/glance/glance-api.conf file and update the database and Keystone settings:

[database]
connection = mysql+pymysql://glance:password@localhost/glance

[keystone_authtoken]
www_authenticate_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = PASSWORD

Replace 'password' and 'PASSWORD' with your preferred passwords for the glance and Keystone users, respectively.

Next, initialize the database:

sudo glance-manage db_sync

Finally, start the Glance services:

sudo systemctl restart glance-api.service glance-registry.service

Step 7: Install and Configure Neutron

Neutron is the network service for OpenStack. To install Neutron, run the following command:

sudo apt install neutron-server neutron-plugin-ml2 neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent

Once Neutron is installed, edit the /etc/neutron/neutron.conf file and update the database and Keystone settings:

[database]
connection = mysql+pymysql://neutron:password@localhost/neutron

[DEFAULT]
core_plugin = ml2
service_plugins =
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True

[keystone_authtoken]
www_authenticate_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = neutron
password = PASSWORD

Replace 'password' and 'PASSWORD' with your preferred passwords for the neutron and Keystone users, respectively.

Next, configure the ML2 plugin by editing the /etc/neutron/plugins/ml2/ml2_conf.ini file:

[ml2]
type_drivers = flat,vlan
tenant_network_types = vlan
mechanism_drivers = linuxbridge

[ml2_type_flat]
flat_networks = provider

[ml2_type_vlan]
network_vlan_ranges = provider

[ml2_type_vxlan]

[securitygroup]
enable_ipset = true

Next, edit the /etc/neutron/plugins/ml2/linuxbridge_agent.ini file and configure the Linux bridge agent:

[linux_bridge]
physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME

[vxlan]
enable_vxlan = false

[agent]
prevent_arp_spoofing = True

Replace 'PROVIDER_INTERFACE_NAME' with the name of your physical network interface.

Next, edit the /etc/neutron/l3_agent.ini file and configure the L3 agent:

[DEFAULT]
interface_driver = linuxbridge

Finally, restart the Neutron services:

sudo systemctl restart neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service

Step 8: Install and Configure Horizon

Horizon is the dashboard interface for OpenStack. To install Horizon, run the following command:

sudo apt install openstack-dashboard

Once Horizon is installed, edit the /etc/openstack-dashboard/local_settings.py file and update the following settings:

ALLOWED_HOSTS = ['*']

OPENSTACK_HOST = "localhost"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True

# Identity
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"

# Disable SSL certificate check for development purposes
OPENSTACK_API_SSL_VERIFY = False

# Enable support for Neutron networking
OPENSTACK_NEUTRON_NETWORK = {
    'enable_quotas': False,
    'enable_router': True,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_fip_topology_check': False,
}

# Configure default role for newly created users
OPENSTACK_CREATE_INITIAL_PROJECT = True
OPENSTACK_INITIAL_ROLE = "user"

Finally, restart the Apache service:

sudo systemctl restart apache2

Conclusion

Congratulations! You have successfully installed and configured OpenStack on Ubuntu Server. You can now begin using OpenStack to build and manage cloud environments.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!