(Last Updated On: March 20, 2019)

Create and Start Virtual Machine Instance ad Installation of Horizon

Step One: Log in with a new user we created earlier in the system and let us get going on with creating an instance

[[email protected] ~(keystone)]# su - tech ##use your username
[[email protected] ~]$
[[email protected] ~]$ vim ~/keystonerc
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=helloworld #remember the project we had created
export OS_USERNAME=penchant #remember the username we had created for the project
export OS_PASSWORD=helloworld123 #remember the password we had created for the project
export OS_AUTH_URL=http://192.168.122.130:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
export PS1='[\[email protected]\h \W(keystone)]\$ '
[[email protected] ~]$ chmod 600 ~/keystonerc
[[email protected] ~]$ source ~/keystonerc
[[email protected] ~(keystone)]$ echo "source ~/keystonerc " >> ~/.bash_profile

Step Two: Check the flavors, network and images available

[[email protected] ~(keystone)]$ openstack flavor list                         
+----+-------+-----+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-------+-----+------+-----------+-------+-----------+
| 0 | Basic | 512 | 10 | 0 | 1 | True |
+----+-------+-----+------+-----------+-------+-----------+
[[email protected] ~(keystone)]$ openstack network list 
+--------------------------------------+-----------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+-----------+--------------------------------------+
| e9927eb9-7467-4e7e-844a-fc07db9c9b85 | firstnet1 | 800efe16-5a49-40f9-8523-e43a48560650 |
+--------------------------------------+-----------+--------------------------------------+
[[email protected] ~(keystone)]$ openstack image list   
+--------------------------------------+---------+--------+
| ID | Name | Status |
+--------------------------------------+---------+--------+
| c13fd621-0d74-4e8f-9481-5cbb02decbd3 | CentOS7 | active |
+--------------------------------------+---------+--------+

Step Three: Create a security group for the instances, you can call it any name for “securegroupone” part

[[email protected] ~(keystone)]$ openstack security group create securegroupone
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at | 2019-03-14T10:41:10Z |
| description | securegroupone |
| id | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| name | securegroupone |
| project_id | f5547f8c879c41bea9c60e4541745c35 |
| revision_number | 2 |
| rules | created_at='2019-03-14T10:41:10Z', direction='egress', ethertype='IPv6', id='80d35496-b370-4699-ac7b-a55e96466d23', updated_at='2019-03-14T10:41:10Z' |
| | created_at='2019-03-14T10:41:10Z', direction='egress', ethertype='IPv4', id='ddc1edd5-8ce2-411a-933c-acb1765d43b1', updated_at='2019-03-14T10:41:10Z' |
| updated_at | 2019-03-14T10:41:10Z |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+

Step Four: Create a SSH keypair that will be used for connecting to instances

[[email protected] ~(keystone)]$ ssh-keygen -q -N ""                                                              
Enter file in which to save the key (/home/tech/.ssh/id_rsa):

Step Five: Add public-key

[[email protected] ~(keystone)]$ openstack keypair create --public-key ~/.ssh/id_rsa.pub penchantkey
+-------------+-------------------------------------------------+
| Field | Value |
+-------------+-------------------------------------------------+
| fingerprint | b6:25:cb:6c:a6:ff:29:5b:4f:59:76:aa:d2:6e:0c:25 |
| name | penchantkey |
| user_id | 1e03edc140cf47858778ab44319391f6 |
+-------------+-------------------------------------------------+
[[email protected] ~(keystone)]$ netID=$(openstack network list | grep firstnet1 | awk '{ print $2 }')
[[email protected] ~(keystone)]$ openstack server create --flavor Basic --image CentOS7 --security-group securegroupone --nic net-id=$netID --key-name penchantkey Cent7
+-----------------------------+------------------------------------------------+
| Field | Value |
+-----------------------------+------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-STS:power_state | NOSTATE |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | None |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | |
| adminPass | SLpUbJgmuwd4 |
| config_drive | |
| created | 2019-03-14T10:53:50Z |
| flavor | Basic (0) |
| hostId | |
| id | 37822ec3-7b4b-4354-bafe-76d1e34c90c2 |
| image | CentOS7 (c13fd621-0d74-4e8f-9481-5cbb02decbd3) |
| key_name | penchantkey |
| name | Cent7 |
| progress | 0 |
| project_id | f5547f8c879c41bea9c60e4541745c35 |
| properties | |
| security_groups | name='05e8cdf2-d59b-40fa-ad55-59d9a3c8af04' |
| status | BUILD |
| updated | 2019-03-14T10:53:51Z |
| user_id | 1e03edc140cf47858778ab44319391f6 |
| volumes_attached | |
+-----------------------------+------------------------------------------------+
[[email protected] ~(keystone)]$ openstack server list
+--------------------------------------+-------+--------+----------+---------+--------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-------+--------+----------+---------+--------+
| 37822ec3-7b4b-4354-bafe-76d1e34c90c2 | Cent7 | BUILD | | CentOS7 | Basic |
+--------------------------------------+-------+--------+----------+---------+--------+

Step Six: Configure security settings for the security group you created above that will give you the ability SSH and ICMP

[[email protected] ~(keystone)]$ openstack security group rule create --protocol icmp --ingress securegroupone
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| created_at | 2019-03-14T15:17:04Z |
| description | |
| direction | ingress |
| ether_type | IPv4 |
| id | 43a93b70-0907-407f-a559-2be73a395cdd |
| name | None |
| port_range_max | None |
| port_range_min | None |
| project_id | f5547f8c879c41bea9c60e4541745c35 |
| protocol | icmp |
| remote_group_id | None |
| remote_ip_prefix | 0.0.0.0/0 |
| revision_number | 0 |
| security_group_id | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| updated_at | 2019-03-14T15:17:04Z |
+-------------------+--------------------------------------+

Step Seven: Allow SSH

[[email protected] ~(keystone)]$ openstack security group rule create --protocol tcp --dst-port 22:22 securegroupone
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| created_at | 2019-03-14T15:17:36Z |
| description | |
| direction | ingress |
| ether_type | IPv4 |
| id | 39f53276-e0c4-4955-8caa-0a62f52a06cd |
| name | None |
| port_range_max | 22 |
| port_range_min | 22 |
| project_id | f5547f8c879c41bea9c60e4541745c35 |
| protocol | tcp |
| remote_group_id | None |
| remote_ip_prefix | 0.0.0.0/0 |
| revision_number | 0 |
| security_group_id | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| updated_at | 2019-03-14T15:17:36Z |
+-------------------+--------------------------------------+

List the created group rule

[[email protected] ~(keystone)]$ openstack security group rule list
+--------------------------------------+-------------+-----------+------------+--------------------------------------+--------------------------------------+
| ID | IP Protocol | IP Range | Port Range | Remote Security Group | Security Group |
+--------------------------------------+-------------+-----------+------------+--------------------------------------+--------------------------------------+
| 39f53276-e0c4-4955-8caa-0a62f52a06cd | tcp | 0.0.0.0/0 | 22:22 | None | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| 3f2d46e5-3ca5-4b0f-b263-e09d27184707 | None | None | | None | 4ca419b0-6e49-49ad-a365-b3fda3f409e1 |
| 43a93b70-0907-407f-a559-2be73a395cdd | icmp | 0.0.0.0/0 | | None | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| 6c80f5c1-be37-431d-ac6f-323d959e8ce2 | None | None | | 4ca419b0-6e49-49ad-a365-b3fda3f409e1 | 4ca419b0-6e49-49ad-a365-b3fda3f409e1 |
| 80d35496-b370-4699-ac7b-a55e96466d23 | None | None | | None | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| 9f71dd53-cf8a-4871-b404-a4ab9c429958 | None | None | | 4ca419b0-6e49-49ad-a365-b3fda3f409e1 | 4ca419b0-6e49-49ad-a365-b3fda3f409e1 |
| ddc1edd5-8ce2-411a-933c-acb1765d43b1 | None | None | | None | 05e8cdf2-d59b-40fa-ad55-59d9a3c8af04 |
| e998a70b-4cf4-48cd-ab3d-23e5c195b633 | None | None | | None | 4ca419b0-6e49-49ad-a365-b3fda3f409e1 |
+--------------------------------------+-------------+-----------+------------+--------------------------------------+--------------------------------------+

Install Horizon

Head over to the root user and follow through the following to have Horizon installed.

[[email protected] ~(keystone)]$ sudo su -
[[email protected] ~(keystone)]#
[[email protected] ~(keystone)]# yum --enablerepo=centos-openstack-queens,epel -y install openstack-dashboard
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base: mirror.ucu.ac.ug
centos-qemu-ev: mirror.ucu.ac.ug
extras: mirror.ucu.ac.ug
updates: mirror.ucu.ac.ug
base | 3.6 kB 00:00:00
centos-ceph-luminous | 2.9 kB 00:00:00
centos-openstack-queens | 2.9 kB 00:00:00
centos-qemu-ev | 2.9 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package openstack-dashboard.noarch 1:13.0.1-1.el7 will be installed

Go ahead and configure Horizon

[[email protected] ~(keystone)]# vim /etc/openstack-dashboard/local_settings
# Jump to line 38 and add Dashboard Host depending on the domain name you require here
ALLOWED_HOSTS = ['horizon.example.com', 'localhost'] #input your FQDN at horizon.example.com
# on line 64: uncomment the lines to look like below
OPENSTACK_API_VERSIONS = {
"data-processing": 1.1,
"identity": 3, "volume": 2, "compute": 2,
}
# on line 75: uncomment, edit as shown
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
# uncomment line 97 as shown below
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'
# on about line 167 and 168: change the IP and add Memcache server to your own
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '192.168.122.130:11211',
},
}
# on the line 189: change OPENSTACK_HOST to the ip of your host
OPENSTACK_HOST = "192.168.122.130"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "member"

Edit the httpd file for dashboard like below:

[[email protected] ~(keystone)]# vim /etc/httpd/conf.d/openstack-dashboard.conf
# on about line 4: add the following lines
WSGIDaemonProcess dashboard
WSGIProcessGroup dashboard
WSGISocketPrefix run/wsgi
WSGIApplicationGroup %{GLOBAL}

Access to your dashboard via a web browser by inputting the URL below
http://(input server’s hostname or IP address here)/dashboard/

And there you go. On the dashboard, you can create other images, create networks, subnets, launch instances and many more. It has been a successful journey and we would wish to thank you for following through to the end.

Below are previous posts in case you missed them. Cheers guys:

Installation of Openstack three Node Cluster on CentOS 7 Part One

Installation of Three node OpenStack Queens Cluster – Part Two

Installation of Three node OpenStack Queens Cluster – Part Three

Installation of Three node OpenStack Queens Cluster – Part Four

Installation of Three node OpenStack Queens Cluster – Part Five

Installation of Three node OpenStack Queens Cluster – Part Six

Installation of Three node OpenStack Queens Cluster – Part Seven

Installation of Three node OpenStack Queens Cluster – Part Eight

Installation of Three node OpenStack Queens Cluster – Part Nine