How to Install OpenStack on CentOS 8 with Packstack

Openstack is a free and open-source private cloud software through which we can manage compute, network and storage resources of our data center with an ease using a single dashboard and via openstack cli commands. In this article we will demonstrate on how to install Openstack on a CentOS 8 system with packstack. Packstack is a command line utility which deploy different components of openstack using puppet modules.

Openstack deployment with packstack is generally used for POC (proof of concept) purpose, so it is not recommended to use packstack for production deployment. Use TripleO method to deploy openstack in production environment.

Minimum System requirements for OpenStack

  • Minimal CentOS 8
  • Dual core Processor
  • 8 GB RAM
  • 40 GB free disk space
  • Stable Internet Connection
  • At least one nic card

My Lab setup details:

  • Hostname – openstack.example.com
  • IP – 192.168.1.8
  • Flat Network – 192.168.1.0/24

Let’s deep dive into the openstack installation steps,

Step 1) Set the hostname and update /etc/hosts file

Open the terminal and set the hostname using the following hostnamectl command,

[[email protected] ~]# hostnamectl set-hostname "openstack.example.com"
[[email protected] ~]# exec bash

Run below echo command to append hostname entry in /etc/hosts file.

[[email protected] ~]# echo -e "192.168.1.8\topenstack.example.com" >> /etc/hosts

Step 2) Disable Network Manager and Configure Network using network-scripts

Network-Manager is the default tool in CentOS 8 to manager networks but for Openstack we must disable it because openstack networking will not work properly with network-manager. In place of network manager, we must install native network-scripts.

To disable network-manager run the following commands,

[[email protected] ~]# systemctl disable NetworkManager
[[email protected] ~]# systemctl stop NetworkManager

Run following dnf command to install native network-scripts

[[email protected] ~]# dnf install network-scripts -y

Once the network-scripts package is installed then we can manage networking (ifcfg-* files) using native network.service

Now let’s configure IP address in ifcfg-enp0s3 file and start network service

[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

network-file-ifcfg-enp0s3-centos8

Save and exit the file and then start network service using following command,

[[email protected] ~]# systemctl start network
[[email protected] ~]# systemctl enable network

Now verify whether IP is assigned to NIC (enp0s3) using ip command,

[[email protected] ~]# ip a s enp0s3

ifcfg-enp0s3-ip-command-linux

Step 3) Enable OpenStack repositories and install packstack utility

At time of writing this article, ussuri openstack was available, so run the following command to configure its repositories

[[email protected] ~]# dnf config-manager --enable PowerTools
[[email protected] ~]# dnf install -y centos-release-openstack-ussuri

Now installed all the available updates and reboot your system,

[[email protected] ~]# dnf update -y
[[email protected] ~]# reboot

Once the system is available after the reboot, execute following dnf command to install packstack utility

[[email protected] ~]# dnf install -y openstack-packstack

Step 4) Generate answer file and install openstack using packstack

Use packstack command to generate the answer file,

[[email protected] ~]# packstack --gen-answer-file /root/openstack-answer.txt

Once the answer file is generated, edit the following parameters using vi editor,

[[email protected] ~]# vi /root/openstack-answer.txt
..............
CONFIG_HEAT_INSTALL=y
CONFIG_PROVISION_DEMO=n
[email protected]
CONFIG_NEUTRON_OVN_BRIDGE_IFACES=br-ex:enp0s3
..............

Save and exit the file.

Replace the interface name (enp0s3) as per your setup.

Note: Default Tenant network type drive is set as “geneve” and default neutron type driver is set as “geneve and flat”. If wish to change these default parameters, then update following lines in answer file. In this demonstration i am not going to update these parameters.

CONFIG_NEUTRON_ML2_TYPE_DRIVERS=geneve,flat
CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=geneve

Run the following command to initiate the openstack deployment using answer file.

[[email protected] ~]# packstack --answer-file /root/openstack-answer.txt

Deployment will take around 20 to 30 minutes depending on your system’s hardware and internet speed. Once it is installed successfully, we will get the following:

Openstack-Successfull-Installation-Screen

Now verify whether IP from enp03 interface is assigned to bridge br-ex and also confirm whether interface enp0s3 is added as a port in ovs-bridge.

Run the following commands:

[[email protected] ~]# ip a s enp0s3
[[email protected] ~]# ip a s br-ex
[[email protected] ~]# ovs-vsctl show

ovs-vsctl-command-centos8

Perfect, above output confirms that installation was successful, and networking is also configured as per the answer file.

Step 5) Access Horizon Dashboard

Now try to login to Horizon dashboard. URL is already specified in the above output, in my case url is http://192.168.1.8/dashboard , Use the user name as admin and password that we specify in answer file.

We also refer the file “keystonerc_admin” for credentials

OpenStack-Horizon-Dashboard-CentOS8

Instance-Overview-OpenStack-Dashboard

Now, let’s test this openstack deployment by launching an instance.

Step 6) Test and verify OpenStack installation by launching an instance

Before launching an instance in openstack, first we must create networks and router and glance image. So, let’s first create external network in admin tenant using following neutron commands,

[[email protected] ~]# source keystonerc_admin
[[email protected] ~(keystone_admin)]# neutron net-create external_network --provider:network_type flat --provider:physical_network extnet --router:external

Now add a subnet of your flat network to external network by running following neutron command.

[[email protected] ~(keystone_admin)]# neutron subnet-create --name public_subnet --enable_dhcp=True --allocation-pool=start=192.168.1.210,end=192.168.1.230 --gateway=192.168.1.1 external_network 192.168.1.0/24

Create a router by executing the following neutron command and set its gateway using external network

[[email protected] ~(keystone_admin)]# neutron router-create dev-router
[[email protected] ~(keystone_admin)]# neutron router-gateway-set dev-router external_network

Create private network and attach a subnet to it. Run the following neutron command,

[[email protected] ~(keystone_admin)]# neutron net-create pvt_net
[[email protected] ~(keystone_admin)]# neutron subnet-create --name pvt_subnet pvt_net 10.20.1.0/24

Add pvt_net interface to router “dev_router” using beneath neutron command,

[[email protected] ~(keystone_admin)]# neutron router-interface-add dev-router  pvt_subnet

Now Download Cirros image and then upload it to glance

[[email protected] ~(keystone_admin)]# wget http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
[[email protected] ~(keystone_admin)]# openstack image create --disk-format qcow2 --container-format bare --public --file cirros-0.5.1-x86_64-disk.img  cirros

Now head back to horizon dashboard and verify the network topology

Network-Topology-OpenStack-Dashboard

Perfect, above confirms that private and external network have been setup correctly along with the router.

One final step before creating a vm, update the default security group, add icmp and ssh ingress rules, click on “Security Groups” under the network Tab, Click on Manage Rules and then click on “Add rule

Manage-Security-Group-Rules-ICMP-OpenStack

Similarly add rule for ssh

Manage-Security-Group Rules-ssh-OpenStack

Click on Add

Now all the requirements for launching an openstack instance are fullfilled. Click on Compute Tab and then Choose Instances option and click on “Launch Instance

VM-Creation-OpenStack

Once VM is launched successfully then we will get something like below,

Instances-Status-OpenStack-Dashboard

Now Associate floating IP to instance (demo_vm), Under the “Actions” Tab, Choose “Associate Floating IP

Associate-Floating-IP-Option-Openstack

Now Choose IP or Click on + sign to get floating IP from external network and then associate it

Choose-IP-Associate-Port-OpenStack

Once IP is associated to the VM then floating IP will be displayed for under ‘IP Address‘ option, example is shown below

Floating-IP-Address-Openstack-VM

Now try to access this demo_vm using the floating ip, use cirros as a user and ‘gocubsgo’ as password

Access-VM-using-floating-ip-openstack

Great, above output confirms that we can access our instance via floating ip. This concludes the article; I hope this tutorial helps to deploy openstack on CentOS 8 system. Please don’t hesitate to share your feedback and comments.

Also Read: How to Create an Instance in OpenStack via Command Line

7 Responses

  1. marian says:

    when issuing command “dnf config-manager –enable PowerTools” it throws an error “No such command: config-manager. Please use /usr/bin/dnf –help

    [[email protected] ~]# dnf config-manager –enable PowerTools
    No such command: config-manager. Please use /usr/bin/dnf –help
    It could be a DNF plugin command, try: “dnf install ‘dnf-command(config-manager)'”
    [[email protected] ~]#

    • Pradeep Kumar says:

      Hi Marian,

      Run the following dnf command to fix the above said issue:

      $ sudo dnf install ‘dnf-command(config-manager)’

  2. Manusia says:

    Hi Sir,
    I get an issue below :

    ERROR : Failed to run remote script, stdout: skipping creation of hiera.yaml symlink

    stderr: Warning: Permanently added ‘10.10.69.100’ (ECDSA) to the list of known hosts.
    + trap t ERR
    + [[ -f /etc/hiera.yaml ]]
    + echo ‘skipping creation of hiera.yaml symlink’
    ++ puppet config print hiera_config
    + sed -i ‘s;:datadir:.*;:datadir: /var/tmp/packstack/d7eabbcf57df47b6b283fc89caeb47be/hieradata;g’ /etc/puppet/hiera.yaml
    sed: can’t read /etc/puppet/hiera.yaml: No such file or directory
    ++ t
    ++ exit 2

    How to solve it?

  3. yoichi says:

    Hi Sir,
    I was able to access this demo_vm using cirros as user with floating IP.
    But from demo_vm, the following fails.
    $ ping 8.8.8.8
    How to solve it?

  4. Pradeep Kumar says:

    Add the DNS Sever IP while creating the external network subnet.

  5. yoichi says:

    Thank you
    I added a DNS server to the external network subnet, but it doesn’t work.
    Other conditions are as follows.
    Ping from demo_vm
    to: FloatingIP -> Success
    to: GestOS IP -> Success
    (Use VirtualBox and bridge connection)
    to: Host Default GW IP -> Failure
    How to solve it?

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest