Install Keystone
Overview
Keystone is the identity service of OpenStack. It handles authentication and authorization for all other services. The steps include:
- Configure SQL database
- Install required packages
- Update keystone.conf
- Initialize Keystone
- Configure Apache
Each step builds the identity service, which is the core access control of OpenStack.
NOTES: The hostnames of all the nodes in this lab are configured in the /etc/hosts file in each node (See Networking and Security).
Lab diagram:

Configure MySQL Database
Start by preparing the database for Keystone. Log in as root on the controller node.
-
Loging to MySQL:
sudo mysql -
Create the database:
CREATE DATABASE keystone;Output:
Query OK, 1 row affectedinfoAlways end MySQL commands with a semicolon.
-
Grant privileges to the
keystoneuser for local access:GRANT ALL PRIVILEGES ON keystone.- TO 'keystone'@'localhost' IDENTIFIED BY 'openstack';Output:
Query OK, 0 row affected -
Grant privileges for remote access:
GRANT ALL PRIVILEGES ON keystone.- TO 'keystone'@'%' IDENTIFIED BY 'openstack';Output:
Query OK, 0 row affected -
Exit the database:
exit
The database is now ready for Keystone, which completes the backend setup for identity management.
Install Required Packages
Install Keystone and its dependencies. Keystone runs as a WSGI module under Apache.
apt install -y keystone apache2 libapache2-mod-wsgi-py3 crudini
Packages installed:
- Keystone for identity management
- Apache2 as the HTTP server
- WSGI module for integration
- Crudini for easier configuration editing
After installation, the system is ready for configuration.
Configure Keystone Database Access
The main configuration file is:
/etc/keystone/keystone.conf
In this setup, we can use crudini to set the database connection in the [database] section.
This command sets the connection parameter:
crudini --set /etc/keystone/keystone.conf \
database connection mysql+pymysql://keystone:openstack@controller/keystone
Here, the openstack is the password:
keystone:openstack
Output: No visible output if successful.
This connects Keystone to the MySQL database created earlier.
Configure Token Provider
Set the token provider to fernet in the [token] section:
crudini --set /etc/keystone/keystone.conf token provider fernet
Output: No visible output if successful.
Fernet is the recommended token provider for secure identity tokens. This completes the main Keystone configuration.