内容纲要
实验环境 192.168.50.200
1.安装mariadb
yum install mariadb-server mariadb -y
2.修改/etc/my.cnf 在[mysqld]下面设置并重启mariadb
[mysqld]
symbolic-links=0
character-set-server=utf8
[root@controller200 ~]# systemctl restart mariadb;systemctl enable mariadb
3.创建一个keystone的mysql用户
[root@controller200 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
MariaDB [(none)]> create database keystone;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on keystone.* to keystone@'controller200.lionelmessi.vip' identified by 'guaiwolou1234';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on keystone.* to keystone@'%' identified by 'guaiwolou1234';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on keystone.* to keystone@'localhost' identified by 'guaiwolou1234';
Query OK, 0 rows affected (0.00 sec)
4.安装keystone
yum install openstack-keystone httpd mod_wsgi -y
yum install python2-openstackclient openstack-u* -y
5.修改keystone的配置文件/etc/keystone/keystone.conf
在[database]下面加入
connection = mysql+pymysql://keystone:guaiwolou1234@controller200/keystone
在[token]下面加入
provider = fernet
6.初始化数据库及认证endpoit
/bin/sh -c "keystone-manage db_sync" keystone
[root@controller200 ~]# keystone-manage fernet_setup\
> --keystone-user keystone --keystone-group keystone
[root@controller200 ~]# keystone-manage credential_setup \
> --keystone-user keystone --keystone-group keystone
[root@controller200 ~]# keystone-manage bootstrap --bootstrap-password guaiwolou1234 \
> --bootstrap-admin-url http://controller200:35357/v3/ \
> --bootstrap-internal-url http://controller200:5000/v3/ \
> --bootstrap-public-url http://controller200:5000/v3/ \
> --bootstrap-region-id RegionOne
7.启动http服务
[root@controller200 ~]# sed -i '/#ServerName/cServerName controller200.lionelmessi.vip:80' \
> /etc/httpd/conf/httpd.conf
[root@controller200 ~]# ln -s /usr/share/keystone/wsgi-keystone.conf \
> /etc/httpd/conf.d/
[root@controller200 ~]# systemctl start httpd.service;systemctl enable httpd.service
8.在root家目录创建一个adminrc文件来登录openstack
vim adminrc
export OS_USERNAME=admin
export OS_PASSWORD=guaiwolou1234
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://controller200:35357/v3
export OS_IDENTITY_API_VERSION=3
export PS1='[\u@\h\W(admin)]\$'
[root@controller200 ~]# source adminrc
[root@controller200~(admin)]#openstack user list
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 673ebd4a5c354294a8fba99becbc475c | admin |
+----------------------------------+-------+