安装KeyStone
yum -y install openstack-keystone httpd mod_wsgi
查看keystone用户信息
cat /etc/group | grep keystone
cat /etc/passwd | grep keystone
创建keystone的数据库,并授权
mysql -uroot -p000000 -e "CREATE DATABASE keystone;"
mysql -uroot -p000000 -e "grant all privileges on keystone.* to keystone@'localhost' identified by '000000';"
mysql -uroot -p000000 -e "grant all privileges on keystone.* to keystone@'%' identified by '000000';"
修改keystone配置文件
cp /etc/keystone/keystone.conf /etc/keystone/keystone.conf.back
vi /etc/keystone/keystone.conf
命令模式使用/[database找到[database],添加
connection = mysql+pymysql://keystone:000000@controller/keystone
命令模式使用/[token找到[token],取消下面的注释
provider = fernet
初始化keystone数据库
同步数据库
su keystone -s /bin/sh -c "keystone-manage db_sync"
检查数据库
mysql -uroot -p000000
use keystone;
show tables;
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 000000 --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
配置web服务
为apache服务器添加wsgi
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d # 方法1
cp /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d # 方法2
修改配置文件
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.back
vi /etc/httpd/conf/httpd.conf
命令模式使用/ServerName,找到ServerName xxxxx.com:80,取消注释并修改为其下
ServerName controller
启动apache,并设置开机自启
systemctl start httpd.service && systemctl enable httpd.service
查看apache是否启动,如果没有启动请关闭selinux
systemctl status httpd
模拟登录认证
###创建初始化环境变量文件
vi admin-login
export OS_USERNAME=admin
export OS_PASSWORD=000000
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
export OS_IMAGE_API_VERSION=2
导入环境变量进行验证
source admin-login
export -p
检测keystone服务
创建于查阅项目列表
openstack project create --domain default project
查看现有项目列表
openstack project list
创建角色与查阅角色列表
openstack role create user
openstack role list
查看阅域列表,用户列表
openstack domain list
openstack user list