keystone安装操作Ubuntu
时间: 2023-10-03 19:05:56 浏览: 113
ubuntu 安装方法
以下是在 Ubuntu 上安装 Keystone 的基本步骤:
1. 首先,通过以下命令更新本地软件包列表:
```bash
sudo apt update
```
2. 安装 keystone 和其依赖项:
```bash
sudo apt install keystone apache2 libapache2-mod-wsgi
```
3. 配置数据库,以便 Keystone 可以使用它:
```bash
sudo mysql
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'KEYSTONE_DB_PASSWORD';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'KEYSTONE_DB_PASSWORD';
exit
```
注意:请将 "KEYSTONE_DB_PASSWORD" 替换为您选择的密码。
4. 编辑 /etc/keystone/keystone.conf 文件。在 [database] 部分中,确保以下行的值正确:
```ini
connection = mysql+pymysql://keystone:KEYSTONE_DB_PASSWORD@localhost/keystone
```
注意:请将 "KEYSTONE_DB_PASSWORD" 替换为您选择的密码。
5. 在 [DEFAULT] 部分中,设置 admin_token 选项:
```ini
admin_token = ADMIN_TOKEN
```
注意:请将 "ADMIN_TOKEN" 替换为您选择的密码。
6. 初始化 Keystone 数据库:
```bash
sudo keystone-manage db_sync
```
7. 在 /etc/apache2/sites-available 目录中创建一个名为 keystone.conf 的文件,并在其中输入以下内容:
```apache
<VirtualHost *:80>
ServerName controller
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone
WSGIProcessGroup keystone-public
WSGIScriptAlias / /usr/bin/keystone-wsgi-public
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog /var/log/apache2/keystone.log
CustomLog /var/log/apache2/access.log combined
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName controller
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog /var/log/apache2/keystone.log
CustomLog /var/log/apache2/access.log combined
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
```
8. 启用 keystone.conf 文件中定义的虚拟主机:
```bash
sudo a2ensite keystone
```
9. 重启 Apache 服务:
```bash
sudo systemctl restart apache2
```
10. 接下来,您需要创建一个初始的管理员用户和服务项目,以便您可以使用 Keystone API 进行身份验证和授权管理。请参考 Keystone 文档以了解更多详细信息。
以上是基本安装步骤,您可以根据需要进行进一步配置和定制。
阅读全文