OpenStack?安裝?Keystone的過(guò)程詳解
OpenStack 安裝 Keystone
本篇主要記錄一下 如何安裝 openstack的 第一個(gè)組件 keystone 認(rèn)證授權(quán)組件
openstack 版本 我選的是queens 版本

1.OpenStack 官網(wǎng)
看了一下官網(wǎng) 文檔還是蠻全的,我采用 centos7 來(lái)做實(shí)驗(yàn)
https://docs.openstack.org/keystone/queens/install/

2.KeyStone 概述
Keystone 是openstack 體系下面的認(rèn)證、授權(quán)、和 目錄服務(wù)管理 的一個(gè)重要的組件,keystone 通常是我們接觸openstack 的第一個(gè)組件,它可以管理其他openstack service ,每個(gè)服務(wù)都可以有一個(gè)或者多個(gè)endpoints,并且 endpoint 被分為 3種類型: admin 、internal、public, 通過(guò)名稱我們也能大概知道 就是其他服務(wù)所暴露的終端地址 給不通場(chǎng)景使用,public 一般是對(duì)外的 internal 一般是服務(wù)之間的通信地址,admin 一般管理員操作的地址,并且 endpoint 具有 region 類型,既可以對(duì) endpoint 進(jìn)行局域劃分 ,我們默認(rèn)使用RegionOne
具體看 https://docs.openstack.org/keystone/queens/install/
3.安裝 OpenStack packages
前置 需要準(zhǔn)備一個(gè) centos7 系統(tǒng)
1.Upgrade the packages on all nodes:
yum upgrade
注意:If the upgrade process includes a new kernel, reboot your host to activate it.
2.Install the appropriate OpenStack client for your version.
# yum install python-openstackclient
For CentOS 7 and RHEL 7
# yum install python-openstackclient
For CentOS 8 and RHEL 8
# yum install python3-openstackclient
3.RHEL and CentOS enable SELinux by default. Install the openstack-selinux package to automatically manage security policies for OpenStack services:
# yum install openstack-selinux
?或者通過(guò)手動(dòng)關(guān)閉selnux
4.Network Time Protocol (NTP ) (必須)
openstack 各個(gè)組件之間 需要進(jìn)行頻繁的調(diào)用,所以他們的 時(shí)間一點(diǎn)要保持一致,所以這個(gè) NTP 必須要進(jìn)行處理
centos7 已經(jīng)推薦使用 chrony 了 ,我看 openstack 官方文檔也是這樣操作的
4.1 安裝 chrony
yum -y install chrony
4.2 編輯/etc/chrony.conf
#注釋 這4個(gè) #server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst #添加阿里云 ntp 服務(wù)器 server ntp1.aliyun.com iburst #允許同步的網(wǎng)段 我的是這個(gè),根據(jù)情況自己配置 allow 192.168.56.0/24
4.3 啟動(dòng) chrony
注意是 chronyd.service
systemctl enable chronyd.service systemctl start chronyd.service
4.4 執(zhí)行同步 chronyc sources -v

4.5 其他nodes 節(jié)點(diǎn)也需要安裝 chrony
nodes 其他節(jié)點(diǎn) 直接同步 上面的 controller節(jié)點(diǎn)即可
server 192.168.56.30

注意: 由于chrony 使用 udp 端口 123 和 323 ,所以 注意關(guān)閉 防火墻,或者把端口打開(kāi)!
5. 安裝 mariadb
由于 keystone 中相關(guān)的 services 信息 都需要存儲(chǔ)的地方 ,所以 需要安裝 mariadb ,不過(guò)也支持其他
5.1 Install the packages: 安裝 mariadb 包
# yum install mariadb mariadb-server python2-PyMySQL
5.2 編輯 /etc/my.cnf.d/openstack.cnf
Create and edit the /etc/my.cnf.d/openstack.cnf file (backup existing configuration files in /etc/my.cnf.d/ if needed) and complete the following actions:
- Create a
[mysqld]section, and set thebind-addresskey to the management IP address of the controller node to enable access by other nodes via the management network. Set additional keys to enable useful options and the UTF-8 character set:
[mysqld] bind-address = 192.168.56.30 default-storage-engine = innodb innodb_file_per_table = on max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8
? 注意 在 /etc/my.cnf.d/openstack.cnf 下面進(jìn)行編輯 然后 bind-address 可以指定為 controller 節(jié)點(diǎn)ip
5.3 啟動(dòng) mariadb 服務(wù)
systemctl enable mariadb.service systemctl start mariadb.service
5.4 安全設(shè)置向?qū)?/h4>
mysql_secure_installation #一步步配置即可
mysql_secure_installation #一步步配置即可

6.安裝 rabbitmq (本篇可選,由于本篇只是安裝keystone)
OpenStack 使用消息隊(duì)列來(lái)協(xié)調(diào)服務(wù)之間的操作和狀態(tài)信息。消息隊(duì)列服務(wù)通常在控制器節(jié)點(diǎn)上運(yùn)行。OpenStack支持多種消息隊(duì)列服務(wù),包括RabbitMQ,Qpid和ZeroMQ。
6.1 安裝 rabbitmq-server
yum install rabbitmq-server
6.2 啟動(dòng)
systemctl enable rabbitmq-server.service systemctl start rabbitmq-server.service
6.3 配置 openstack rabiitmq 用戶
rabbitmqctl add_user openstack RABBIT_PASS #注意替換 RABBIT_PASS 密碼
6.4 Permit configuration, write, and read access for the openstack user:
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
7. 安裝 Keystone 和 必要配置
官網(wǎng)地址:https://docs.openstack.org/keystone/queens/install/index-rdo.html

7.1 配置 mysql
上面已經(jīng)安裝了 mariadb 服務(wù),這里需要開(kāi)始對(duì)它進(jìn)行配置
Before you install and configure the Identity service, you must create a database.
使用root用戶登錄 mysql :
$ mysql -u root -p
創(chuàng)建 keystone database:
MariaDB [(none)]> CREATE DATABASE keystone;
Grant proper access to the keystone database:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \ IDENTIFIED BY 'KEYSTONE_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \ IDENTIFIED BY 'KEYSTONE_DBPASS';
?Replace KEYSTONE_DBPASS with a suitable password.

7.2 安裝 keystone 組件
7.2.1 安裝 keystone
yum install openstack-keystone httpd mod_wsgi
安裝過(guò)程中的報(bào)錯(cuò):
Error: Package: python2-qpid-proton-0.22.0-1.el7.x86_64 (centos-openstack-queens)
Requires: qpid-proton-c(x86-64) = 0.22.0-1.el7
Available: qpid-proton-c-0.14.0-2.el7.x86_64 (extras)
qpid-proton-c(x86-64) = 0.14.0-2.el7
Available: qpid-proton-c-0.17.0-4.el7.x86_64 (centos-openstack-queens)
qpid-proton-c(x86-64) = 0.17.0-4.el7
Available: qpid-proton-c-0.22.0-1.el7.x86_64 (centos-openstack-queens)
qpid-proton-c(x86-64) = 0.22.0-1.el7
Installing: qpid-proton-c-0.35.0-1.el7.x86_64 (epel)
qpid-proton-c(x86-64) = 0.35.0-1.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
包沖突導(dǎo)致的兼容錯(cuò)誤單獨(dú)選定需要的版本進(jìn)行安裝即可
`解決方案:yum install -y python2-qpid-proton-0.22.0-1.el7.x86_64
安裝完成后 /etc/keyston 就存在了

7.2.2 編輯 /etc/keystone/keystone.conf連接 mysql
[database] # ... connection = mysql+pymysql://keystone:KEYSTONE_DBPASS@controller/keystone
注意 controller 是你的 本機(jī)ip 可以配置掉 /etc/hosts中
7.2.3 token provider
[token] # ... provider = fernet
7.2.4 同步 keystone db
su -s /bin/sh -c "keystone-manage db_sync" keystone
7.2.5 初始化 fernet key
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
7.2.6 Bootstrap the Identity service:
注意替換 ADMIN_PASS
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
7.3 配置 Apache Http 服務(wù)
7.3.1 編輯 /etc/httpd/conf/httpd.conf
ServerName controller
7.3.2 創(chuàng)建 ln -s
Create a link to the /usr/share/keystone/wsgi-keystone.conf file:
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
7.3.3 啟動(dòng) httpd
systemctl enable httpd.service systemctl start httpd.service
7.3.4 暴露賬號(hào)到環(huán)境變量中
為了可以執(zhí)行 openstack 命令
export OS_USERNAME=admin export OS_PASSWORD=ADMIN_PASS #這個(gè)是上面 keystone-manage bootstrap 指定的 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
8.創(chuàng)建域 項(xiàng)目、用戶、角色 等
8.1 創(chuàng)建 域
openstack domain create --description "An Example Domain" example
8.2 創(chuàng)建項(xiàng)目
openstack project create --domain default --description "Service Project" myservice
8.3 創(chuàng)建角色 關(guān)聯(lián)用戶
#創(chuàng)建 用戶 openstack user create --domain default --password ADMIN_PASS myuser #創(chuàng)建 角色 openstack role create myrole #為servce 項(xiàng)目指定用戶角色 openstack role add --project service --user myuser myrole #為service項(xiàng)目指定用戶角色

9.驗(yàn)證 KeyStone 服務(wù)
9.1 驗(yàn)證 admin 用戶
unset OS_AUTH_URL OS_PASSWORD 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

9.2 驗(yàn)證 myuser 用戶
openstack --os-auth-url http://controller:5000/v3 \ --os-project-domain-name Default --os-user-domain-name Default \ --os-project-name myservice --os-username myuser token issue

至此 openstack keystone 組件已經(jīng)安裝完成了。。
總結(jié)
本篇主要記錄一下 openstack queens 版本 keystone 組件的安裝過(guò)程 被領(lǐng)導(dǎo)催促要學(xué)習(xí)openstack 我也很無(wú)奈。

到此這篇關(guān)于OpenStack 安裝 Keystone的文章就介紹到這了,更多相關(guān)OpenStack 安裝 Keystone內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
git rebase -i合并多次提交的實(shí)現(xiàn)
這篇文章主要介紹了git rebase -i合并多次提交的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07
2018年GitHub賬戶注冊(cè)圖文教程(github從注冊(cè)到使用)
Github是最流行的代碼庫(kù),里面存儲(chǔ)著豐富的優(yōu)秀的開(kāi)源代碼。不僅如此,作為一款免費(fèi)的代碼存儲(chǔ)利器也是流的一逼,支持各種編程語(yǔ)言,代碼顯示效果堪稱完美,可以隨時(shí)隨地查看自己記錄的筆記2018-02-02
從git倉(cāng)庫(kù)中刪除.idea文件夾的小妙招
這篇文章主要介紹了從git倉(cāng)庫(kù)中刪除.idea文件夾的小妙招,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-01-01
git修改已commit的注釋信息實(shí)現(xiàn)
這篇文章主要介紹了git修改已commit的注釋信息實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07
基于Leaflet的VideoOverlay視頻圖層疊加實(shí)戰(zhàn)教程
這篇文章主要介紹了基于Leaflet的VideoOverlay視頻圖層疊加實(shí)戰(zhàn),本文首先介紹了DistortableVideo組件的相關(guān)知識(shí),它的github倉(cāng)庫(kù)信息,相關(guān)源代碼的目錄說(shuō)明,使用依賴信息,需要的朋友可以參考下2023-02-02

