OpenStack下Keystone安装
时间: 2023-11-15 14:04:49 浏览: 120
安装Keystone之前,您需要确保已经安装并配置好了OpenStack Identity服务所需的依赖项。这些依赖项包括Python、MySQL数据库、Apache HTTP服务器、以及其他一些Python库。如果您还没有安装这些依赖项,请先安装它们。
以下是在Ubuntu 18.04操作系统上安装Keystone的步骤:
1.安装Keystone软件包:
```
sudo apt-get update
sudo apt-get install keystone
```
2.编辑Keystone配置文件/etc/keystone/keystone.conf,将[database]部分中的连接信息修改为您的MySQL数据库连接信息,例如:
```
[database]
connection = mysql+pymysql://keystone:PASSWORD@controller/keystone
```
3.编辑/etc/apache2/sites-available/wsgi-keystone.conf文件,将WSGIScriptAlias行中的/var/www/cgi-bin/keystone修改为/usr/bin/keystone-wsgi-public:
```
WSGIScriptAlias / /usr/bin/keystone-wsgi-public
```
4.创建一个新的数据库并将权限授予Keystone:
```
sudo mysql -u root -p
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'PASSWORD';
exit
```
5.初始化Keystone数据库:
```
sudo su -s /bin/sh -c "keystone-manage db_sync" keystone
```
6.为管理员创建一个新的OpenStack Identity服务用户:
```
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
export OS_IMAGE_API_VERSION=2
```
7.创建管理员用户、服务、终端节点和角色:
```
openstack user create --domain default --password-prompt admin
openstack role create admin
openstack role add --project admin --user admin admin
openstack service create --name keystone --description "OpenStack Identity" identity
openstack endpoint create --region RegionOne identity public http://controller:5000/v3
openstack endpoint create --region RegionOne identity internal http://controller:5000/v3
openstack endpoint create --region RegionOne identity admin http://controller:35357/v3
```
8.重新启动Apache HTTP服务器:
```
sudo service apache2 restart
```
现在,您已经成功地安装和配置了Keystone服务。您可以使用OpenStack命令行工具或其他OpenStack服务来验证Keystone是否正常工作。
阅读全文