安装keystone、memcached 、httpd服务
[[email protected] ~]# yum -y install openstack-keystone httpd mod_wsgi python-openstackclient memcached python-memcached openstack-utils
[[email protected] ~]# systemctl enable memcached.service
[[email protected] ~]# systemctl start memcached.service
[[email protected] ~]# systemctl status memcached.service
[[email protected] ~]# netstat -anpult | grep memcached
1.修改mamcached服务配置文件
[[email protected] ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,192.168.0.111"
修改keystone服务的配置文件
[[email protected] ~]# cp /etc/keystone/keystone.conf /etc/keystone/keystone.conf.bak
[[email protected] ~]# >/etc/keystone/keystone.conf
[[email protected] ~]# cat /etc/keystone/keystone.conf
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
[database]
connection = mysql+pymysql://keystone:[email protected]/keystone
[cache]
backend = oslo_cache.memcache_pool
enabled = true
memcache_servers = controller:11211
[memcache]
servers = controller:11211
[token]
expiration = 3600
provider = fernet
2.配置httpd服务
[[email protected] ~]# vi /etc/httpd/conf/httpd.conf
95 ServerName controller
[[email protected] ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
[[email protected] ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[[email protected] ~]# systemctl start httpd.service
[[email protected] ~]# systemctl status httpd.service
[[email protected] ~]# systemctl list-unit-files |grep httpd.service
3.创建数据库表,使用命令同步
[[email protected] ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone
[[email protected] ~]# mysql -hcontroller -ukeystone -pdevops 数据库检查表
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]>
初始化
[[email protected] ~]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
[[email protected] ~]# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
引导身份服务
[[email protected] ~]# keystone-manage bootstrap \
--bootstrap-password devops \
--bootstrap-username admin \
--bootstrap-project-name admin \
--bootstrap-role-name admin \
--bootstrap-service-name keystone \
--bootstrap-region-id RegionOne \
--bootstrap-admin-url http://controller:35357/v3 \
--bootstrap-internal-url http://controller:35357/v3 \
--bootstrap-public-url http://controller:5000/v3
验证:
[[email protected] ~]# openstack project list --os-username admin --os-project-name admin --os-user-domain-id default --os-project-domain-id default --os-identity-api-version 3 --os-auth-url http://controller:5000 --os-password devops
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 5315fe00d937450bb1f136aeb02b38e1 | admin |
+----------------------------------+-------+
4.创建admin用户环境变量,创建/root/admin-openrc文件并写入如下内容:
[[email protected] ~]# cat /root/admin-openrc
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_DOMAIN_ID=default
export OS_USERNAME=admin
export OS_PROJECT_NAME=admin
export OS_PASSWORD=devops
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
export OS_AUTH_URL=http://controller:35357/v3
5.创建service项目,用来管理其他服务用
[[email protected] ~]# openstack project create --domain default --description "Service Project" service
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Service Project |
| domain_id | default |
| enabled | True |
| id | e4fdeb56612d4a4c8ae523a8e8dd64d2 |
| is_domain | False |
| name | service |
| parent_id | default |
+-------------+----------------------------------+
创建一个普通项目demo
[[email protected] ~]# openstack project create --domain default --description "Demo Project" demo
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Demo Project |
| domain_id | default |
| enabled | True |
| id | bd5051c0f91a44d98ccd13eb1d0d180e |
| is_domain | False |
| name | demo |
| parent_id | default |
+-------------+----------------------------------+
创建一个普通用户demo
[[email protected] ~]# openstack user create --domain default demo --password devops
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 04137b0ef90d443392896120ac8519d3 |
| name | demo |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
创建user角色将demo用户赋予user角色
[[email protected] ~]# openstack role create user
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | None |
| id | 201208f262514a63a102ff47effa8cd5 |
| name | user |
+-----------+----------------------------------+
[[email protected] ~]# openstack role add --project demo --user demo user
去掉环境变量
[[email protected] ~]# unset OS_AUTH_URL OSPASSWORD
[[email protected] ~]# 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 --os-password devops
+------------+----------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+----------------------------------------------------------------------------------------------------+
| expires | 2017-05-04T06:48:17+0000 |
| id | gAAAAABZCsChgxLzBdT-OeKPYVo7TP1nF4o0PEyOEH7luvvckDA45wDfhd5IbSXK1V9bnJqwQMHaLpekY29GU68xvABw- |
| | BSrLFuCTpF83JLuPknonpDms49KSQTURbV9lEXNm7CxC-qwzOW-kTwRV1wIqys6tAirkT-33AIIbYCZFA-NPdLiUE |
| project_id | cb0ef8f994df41b2a470e7e0cdd92015 |
| user_id | 2dfa05385ca040eb9a2ff0259c41ebf5 |
+------------+----------------------------------------------------------------------------------------------------+
[[email protected] ~]# 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 --os-password devops
+------------+----------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+----------------------------------------------------------------------------------------------------+
| expires | 2017-05-04T07:17:13+0000 |
| id | gAAAAABZCsdqy1NtsxXldUEx7xVNNwiuLHbv8nd29OeWW60bGQSD3hudz1mlsv2IMmukoLBvgbvUENy1A4Q- |
| | NRb2eEuPVaDA467EK1HgOd3mduE-T0J0qUwjNdyOYosb3aIme72OAcXEa3LHCxXaB3H3Rq- |
| | rE91NMsmFm3o0e2SfqnTRAQPsquo |
| project_id | bd5051c0f91a44d98ccd13eb1d0d180e |
| user_id | 04137b0ef90d443392896120ac8519d3 |
+------------+----------------------------------------------------------------------------------------------------+
原文地址:https://blog.51cto.com/343614597/2419405