您好,登录后才能下订单哦!
安装keystone、memcached 、httpd服务
[root@controller ~]# yum -y install openstack-keystone httpd mod_wsgi python-openstackclient memcached python-memcached openstack-utils
[root@controller ~]# systemctl enable memcached.service
[root@controller ~]# systemctl start memcached.service
[root@controller ~]# systemctl status memcached.service
[root@controller ~]# netstat -anpult | grep memcached
1.修改mamcached服务配置文件
[root@controller ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,192.168.0.111"
修改keystone服务的配置文件
[root@controller ~]# cp /etc/keystone/keystone.conf /etc/keystone/keystone.conf.bak
[root@controller ~]# >/etc/keystone/keystone.conf
[root@controller ~]# cat /etc/keystone/keystone.conf
[DEFAULT]
transport_url = rabbit://openstack:devops@controller
[database]
connection = mysql+pymysql://keystone:devops@controller/keystone
[cache]
backend = oslo_cache.memcache_pool
enabled = true
memcache_servers = controller:11211
[memcache]
servers = controller:11211
[token]
expiration = 3600
provider = fernet
2.配置httpd服务
[root@controller ~]# vi /etc/httpd/conf/httpd.conf
95 ServerName controller
[root@controller ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
[root@controller ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@controller ~]# systemctl start httpd.service
[root@controller ~]# systemctl status httpd.service
[root@controller ~]# systemctl list-unit-files |grep httpd.service
3.创建数据库表,使用命令同步
[root@controller ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone
[root@controller ~]# 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)]>
初始化
[root@controller ~]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
[root@controller ~]# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
引导身份服务
[root@controller ~]# 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
验证:
[root@controller ~]# 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文件并写入如下内容:
[root@controller ~]# 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项目,用来管理其他服务用
[root@controller ~]# 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
[root@controller ~]# 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
[root@controller ~]# 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角色
[root@controller ~]# openstack role create user
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | None |
| id | 201208f262514a63a102ff47effa8cd5 |
| name | user |
+-----------+----------------------------------+
[root@controller ~]# openstack role add --project demo --user demo user
去掉环境变量
[root@controller ~]# unset OS_AUTH_URL OSPASSWORD
[root@controller ~]# 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 |
+------------+----------------------------------------------------------------------------------------------------+
[root@controller ~]# 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://pan.baidu.com/s/1CnmKkFMTemv199ctgb5Oig
提取码:27om
复制这段内容后打开百度网盘手机App,操作更方便哦
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。