openstack 安裝keystone
阿新 • • 發佈:2018-11-07
openstack Q版
伺服器系統centos7
控制端IP:192.168.50.31
計算端IP:192.168.50.32
Keystone
下面所有操作全在控制端
資料庫操作
# 登入資料庫
mysql -u root -p
# 建立表
CREATE DATABASE keystone;
# 授權
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';
安裝配置
# YUM安裝keystone 及相關軟體
yum -y install openstack-keystone httpd mod_wsgi
#修改配置檔案keystone.conf
vim /etc/keystone/keystone.conf
[database]
connection = mysql+pymysql://keystone: [email protected]/keystone
[token]
provider = fernet
# 同步資料庫
su -s /bin/sh -c "keystone-manage db_sync" keystone
初始化keystone基礎資訊
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 openstackadmin \ --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
配置httpd
# 修改配置檔案httpd.conf
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 start httpd.service
keystone 初始帳戶角色和專案
# 臨時環境變數配置管理帳戶 export OS_USERNAME=admin export OS_PASSWORD=openstackadmin export OS_PROJECT_NAME=admin export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_DOMAIN_NAME=Default export OS_AUTH_URL=http://controller:35357/v3 export OS_IDENTITY_API_VERSION=3 # 建立域、專案、使用者和角色 # 建立新的域 example 預設default已經存在 openstack domain create --description "An Example Domain" example # 建立service專案 openstack project create --domain default --description "Service Project" service # 建立demo專案 openstack project create --domain default --description "Demo Project" demo # 建立demo使用者 openstack user create --domain default --password-prompt demo #會提示輸入密碼 和再次輸入密碼 #建立demo角色: openstack role create user # 新增``demo`` 角色到 demo 專案和使用者上: openstack role add --project demo --user demo user # 驗證操作 # 重置變數 unset OS_AUTH_URL OS_PASSWORD #訪問測試 openstack --os-auth-url http://controller:35357/v3 \ --os-project-domain-name Default --os-user-domain-name Default \ --os-project-name admin --os-username admin token issue 會提示輸入admin密碼(輸入openstackadmin) openstack --os-auth-url http://controller:5000/v3 \ --os-project-domain-name Default --os-user-domain-name Default \ --os-project-name demo --os-username demo token issue 會提示輸入demo密碼 (輸入demo)
建立登入指令碼並測試使用
#建立指令碼 admin-openrc
vim admin-openrc
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=JZopenstack123!
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
#建立指令碼 demo-openrc
vim demo-openrc
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=demo
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
# 測試使用
. admin-openrc
openstack token issue
. demo-openrc
openstack token issue