How to Install and Configure OpenStack Nova

In this tutorial, How to Install and Configure the OpenStack compute ( Nova). In previous, My post has How to install OpenStack all in one Centos 7. If you have not yet installed OpenStack nova then step install as below

Step-by-Step Installation and Configuration of OpenStack Nova

Step 1: Create a User and Database for Nova

Use MariaDB to set up the required databases and users:

[root@DevopsRoles ~(keystone)]# mysql -u root -p

Run the following commands to create the necessary databases:

CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'password';

CREATE DATABASE nova_api;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'password';

CREATE DATABASE nova_placement;
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'%' IDENTIFIED BY 'password';

CREATE DATABASE nova_cell0;
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'password';

FLUSH PRIVILEGES;
EXIT;

Step 2: Add Users and Configure Services in Keystone

  1. Add the nova user to the service project:
    • openstack user create --domain default --project service --password servicepassword nova
    • openstack role add --project service --user nova admin
  2. Add the placement user:
    • openstack user create --domain default --project service --password servicepassword placement
    • openstack role add --project service --user placement admin
  3. Create service entries:
    • openstack service create --name nova --description "OpenStack Compute service" compute
    • openstack service create --name placement --description "OpenStack Compute Placement service" placement
  4. Define the Keystone controller address:
    • export controller=10.0.2.15
  5. Add endpoints:
    • openstack endpoint create --region RegionOne compute public http://$controller:8774/v2.1/%\(tenant_id\)s
    • openstack endpoint create --region RegionOne compute internal http://$controller:8774/v2.1/%\(tenant_id\)s
    • openstack endpoint create --region RegionOne compute admin http://$controller:8774/v2.1/%\(tenant_id\)s
    • openstack endpoint create --region RegionOne placement public http://$controller:8778
    • openstack endpoint create --region RegionOne placement internal http://$controller:8778
    • openstack endpoint create --region RegionOne placement admin http://$controller:8778

Step 3: Install OpenStack Nova

Install the Nova packages:

yum --enablerepo=centos-openstack-stein,epel -y install openstack-nova

Step 4: Configure OpenStack Nova

Edit the Nova configuration file:

mv /etc/nova/nova.conf /etc/nova/nova.conf.org
vi /etc/nova/nova.conf

Add the following configuration:

[DEFAULT]
my_ip = 10.0.2.15
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
log_dir = /var/log/nova
transport_url = rabbit://openstack:password@10.0.2.15

[api]
auth_strategy = keystone

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

[oslo_concurrency]
lock_path = $state_path/tmp

[api_database]
connection = mysql+pymysql://nova:password@10.0.2.15/nova_api

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

[keystone_authtoken]
www_authenticate_uri = http://10.0.2.15:5000
auth_url = http://10.0.2.15:5000
memcached_servers = 10.0.2.15:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = servicepassword

[placement]
auth_url = http://10.0.2.15:5000
os_region_name = RegionOne
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
password = servicepassword

[placement_database]
connection = mysql+pymysql://nova:password@10.0.2.15/nova_placement

Apply the correct permissions:

chmod 640 /etc/nova/nova.conf
chgrp nova /etc/nova/nova.conf

Step 5: Set Up SELinux and Firewall Rules

Enable SELinux for OpenStack:

yum --enablerepo=centos-openstack-stein -y install openstack-selinux
semanage port -a -t http_port_t -p tcp 8778

Update the firewall rules:

firewall-cmd --add-port={6080/tcp,6081/tcp,6082/tcp,8774/tcp,8775/tcp,8778/tcp} --permanent
firewall-cmd --reload

Step 6: Initialize the Database

Synchronize the database:

su -s /bin/bash nova -c "nova-manage api_db sync"
su -s /bin/bash nova -c "nova-manage cell_v2 map_cell0"
su -s /bin/bash nova -c "nova-manage db sync"
su -s /bin/bash nova -c "nova-manage cell_v2 create_cell --name cell1"

Step 7: Start Nova Services

Start and enable Nova services:

systemctl start openstack-nova-api openstack-nova-consoleauth openstack-nova-conductor openstack-nova-scheduler openstack-nova-novncproxy
systemctl enable openstack-nova-api openstack-nova-consoleauth openstack-nova-conductor openstack-nova-scheduler openstack-nova-novncproxy

Step 8: Install and Configure Nova Compute

Install Nova Compute:

yum --enablerepo=centos-openstack-stein,epel -y install openstack-nova-compute

Update the Nova configuration to enable VNC:

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

Restart the service:

systemctl start openstack-nova-compute
systemctl enable openstack-nova-compute

Final Steps

Verify the Nova setup:

openstack compute service list
How to Install and Configure OpenStack Nova

Congratulations! You have successfully installed and configured OpenStack Nova. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.