本节介绍如何在控制器节点上安装和配置代码为keystone的OpenStack身份认证服务。(参照官网进行的整理,侵删)
1、openstack版本:rocky
2、linux操作系统版本:centos7
3、有$符号的是命令,没有的是文本,本文代码中#号为注释
(1)创建数据库并赋权
$ mysql -u root -p
创建数据库
MariaDB [(none)]> CREATE DATABASE keystone;
赋权,注意密码
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'keystone';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'keystone';
#别忘记
$ flush privileges;
(2)安装和配置组件
安装包
$ yum install openstack-keystone httpd mod_wsgi
编辑/etc/keystone/keystone.conf文件
$ vim /etc/keystone/keystone.conf
[database]
connection = mysql+pymysql://keystone:keystone@controller/keystone
[token]
provider = fernet
填充认证服务数据库
$ su -s /bin/sh -c "keystone-manage db_sync" keystone
初始化Fernet密钥存储库:
$ keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
$ keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
引导认证服务:
$ keystone-manage bootstrap --bootstrap-password ADMIN_PASS \
--bootstrap-admin-url http://controller:5000/v3/ \
--bootstrap-internal-url http://controller:5000/v3/ \
--bootstrap-public-url http://controller:5000/v3/ \
--bootstrap-region-id RegionOne
#替换ADMIN_PASS为管理员用户的密码
(3)配置Apache HTTP服务器
编辑/etc/httpd/conf/httpd.conf文件并配置ServerName选项以引用控制器节点:
ServerName controller
创建指向/usr/share/keystone/wsgi-keystone.conf的链接:
$ ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
(4)完成安装
$ systemctl enable httpd.service
$ systemctl start httpd.service
配置管理帐户
$ export OS_USERNAME=admin
$ export OS_PASSWORD=ADMIN_PASS
$ export OS_PROJECT_NAME=admin
$ export OS_USER_DOMAIN_NAME=Default
$ export OS_PROJECT_DOMAIN_NAME=Default
$ export OS_AUTH_URL=http://controller:5000/v3
$ export OS_IDENTITY_API_VERSION=3
#将ADMIN_PASS替换为管理员密码