1.数据库配置
mysql -uroot -p123456
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';
#验证
mysql -uroot -p123456 -e "show databases;"
2.安装keystone
安装
yum install openstack-keystone httpd mod_wsgi -y
cp /etc/keystone/keystone.conf /etc/keystone/keystone.conf.bak
sed -ri '/^[ \t]*(#|$)/d' /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\
--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
3.安装httpd(控制节点)
#安装
yum install httpd -y
#配置
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
vim /etc/httpd/conf/httpd.conf
ServerName controller
#创建软连接
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
#启动
systemctl enable httpd.service
systemctl restart httpd.service
systemctl status httpd
4.模拟用户登录的脚本
vim /root/admin-openrc.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
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
5.创建域、项目、用户、角色
source /root/admin-openrc.sh
openstack domain create --description "An Example Domain" example
openstack project create --domain default --description "Service Project" service
openstack project create --domain default --description "Demo Project" myproject
openstack user create --domain default --password myuser myuser
openstack role create myrole
openstack role add --project myproject --user myuser myrole
6.验证
#请求admin身份验证令牌:
openstack --os-auth-url http://controller:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name admin --os-username admin token issue
#请求myuser身份验证令牌:
openstack --os-auth-url http://controller:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name myproject --os-username myuser --os-password myuser token issue