Install Openstack On Centos 7

admin13 April 2024Last Update :

Prerequisites for Installing OpenStack on CentOS 7

Before diving into the installation process, it’s essential to ensure that your system meets the necessary requirements. Here are the prerequisites you need to check off your list:

  • A minimum of 2 CPUs (4 recommended)
  • At least 4GB of RAM (8GB recommended)
  • A minimum of 20GB of available disk space
  • CentOS 7 installed and updated
  • Root privileges or access via an account with sudo privileges
  • Network connectivity and proper network configuration
  • SELinux set to permissive mode
  • Disabled firewall or properly configured firewall rules

Setting Up the Environment

To begin, you’ll need to prepare your CentOS 7 environment for OpenStack installation. This involves several steps to configure the system and its components.

System Update and Package Installation

Start by updating your system packages to the latest versions and installing the required dependencies:

yum update -y
yum install -y centos-release-openstack-train
yum update -y

Next, install the OpenStack client:

yum install -y python-openstackclient

Database Configuration

OpenStack services use a database to store information. Install MariaDB and configure it as follows:

yum install -y mariadb mariadb-server
systemctl enable mariadb.service
systemctl start mariadb.service
mysql_secure_installation

During the secure installation process, set a root password and answer ‘Y’ to all subsequent prompts.

RabbitMQ Installation

RabbitMQ is the messaging backend for OpenStack. Install and configure it using the following commands:

yum install -y rabbitmq-server
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
rabbitmqctl add_user openstack RABBIT_PASS
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

Replace RABBIT_PASS with a strong password of your choice.

Memcached Installation

Memcached is used for token caching by the OpenStack Identity service (Keystone). Install Memcached and its Python library:

yum install -y memcached python-memcached
systemctl enable memcached.service
systemctl start memcached.service

Etcd Installation

Etcd is a distributed key-value store that provides a reliable way to store data across a cluster of machines. Install etcd with:

yum install -y etcd

Configure etcd by editing the /etc/etcd/etcd.conf file and then start the service:

systemctl enable etcd
systemctl start etcd

Installing OpenStack Components

With the environment ready, you can now proceed to install the various OpenStack components. Each component has specific configurations and services that need to be addressed.

Keystone: Identity Service

Install Keystone and create the database:

yum install -y openstack-keystone httpd mod_wsgi
mysql -u root -p -e "CREATE DATABASE keystone;"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'KEYSTONE_DBPASS';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'KEYSTONE_DBPASS';"

Replace KEYSTONE_DBPASS with a secure password.

Glance: Image Service

For Glance, install the package and configure its database:

yum install -y openstack-glance
mysql -u root -p -e "CREATE DATABASE glance;"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';"

Again, replace GLANCE_DBPASS with a secure password.

Nova: Compute Service

Nova requires several packages and a database setup:

yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
mysql -u root -p -e "CREATE DATABASE nova;"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';"

Substitute NOVA_DBPASS with a secure password.

Neutron: Networking Service

Neutron also needs its own set of packages and database:

yum install -y openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
mysql -u root -p -e "CREATE DATABASE neutron;"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'NEUTRON_DBPASS';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'NEUTRON_DBPASS';"

Remember to replace NEUTRON_DBPASS with a secure password.

Cinder: Block Storage Service

Cinder requires installation of its components and database creation:

yum install -y openstack-cinder
mysql -u root -p -e "CREATE DATABASE cinder;"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';"

Change CINDER_DBPASS to a secure password.

Configuring OpenStack Services

Each OpenStack service requires careful configuration to ensure they work together seamlessly. You will need to edit configuration files for each service, setting up connection strings, endpoints, and other necessary parameters.

Keystone Configuration

Edit the /etc/keystone/keystone.conf file to configure the database connection string and other settings. Then, populate the Keystone database and initialize Fernet keys:

su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone

Set up the Apache HTTP server to handle authentication requests:

ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
systemctl enable httpd.service
systemctl start httpd.service

Glance Configuration

Configure Glance by editing the /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf files to include the correct database connection strings and Keystone authentication details. Afterward, sync the Glance database:

su -s /bin/sh -c "glance-manage db_sync" glance

Nova Configuration

Nova’s configuration involves editing multiple files such as /etc/nova/nova.conf and populating the Nova database:

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

Neutron Configuration

For Neutron, modify the /etc/neutron/neutron.conf and plugin configuration files like /etc/neutron/plugins/ml2/ml2_conf.ini. Ensure the database connection strings and service credentials are correctly set, then synchronize the Neutron database:

su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf 
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

Cinder Configuration

Adjust the /etc/cinder/cinder.conf file to include the appropriate database connection string and message queue settings. Sync the Cinder database afterward:

su -s /bin/sh -c "cinder-manage db sync" cinder

Launching OpenStack Services

Once all services are configured, you can start them. For each service, enable and start its associated processes. For example, for Nova:

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

Repeat similar steps for Glance, Neutron, and Cinder services.

Verifying OpenStack Installation

After starting all services, verify that each component is functioning correctly. Source the admin credentials and use the OpenStack command-line tools to check the status of services:

source admin-openrc
openstack service list
openstack image list
openstack compute service list
openstack network agent list

If all services show up without errors, your OpenStack installation on CentOS 7 is successful.

Frequently Asked Questions

Here are some common questions related to installing OpenStack on CentOS 7:

  • Can I install OpenStack on a virtual machine? Yes, you can install OpenStack on a VM, but make sure the VM meets the hardware requirements.
  • How do I troubleshoot installation issues? Check log files located in /var/log/ for each OpenStack service. They often contain detailed error messages.
  • Is it possible to automate the OpenStack installation process? Yes, there are tools like Packstack and Kolla-Ansible that can help automate the installation.
  • What should I do if a service fails to start? Verify that all configuration files have the correct settings and that all prerequisites are met. Also, ensure that the service’s database was created and synced properly.
  • How can I secure my OpenStack installation? Use key-based SSH logins, configure firewalls, set SELinux to enforcing mode after testing, and follow OpenStack’s security best practices.

References

For further reading and more detailed instructions, consider the following resources:

Leave a Comment

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


Comments Rules :

Breaking News