1.关闭防火墙和selinux

2.配置hosts

[root@compute ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
20.0.20.21 controller
20.0.20.22 compute

3.配置ntp

yum -y install chrony
[root@controller ~]# vim /etc/chrony.conf
allow 20.0.20.0/16
server ntp1.aliyun.com iburst 
#compute节点只需同步到controller节点
[root@controller ~]# systemctl enable chronyd.service
[root@controller ~]# systemctl start chronyd.service

4.在所有节点上安装openstack

[root@controller ~]# yum install centos-release-openstack-pike -y
[root@controller ~]# yum upgrade -y
[root@controller ~]# yum install python-openstackclient -y

5.在controller节点上安装数据库

[root@controller ~]# yum install mariadb mariadb-server python2-PyMySQL -y
[root@controller ~]# cat /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 20.0.20.21
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
[root@controller ~]# systemctl enable mariadb.service
[root@controller ~]# systemctl start mariadb.service
[root@controller ~]# mysql_secure_installation

6.数据库配置,创建数据库、用户授权

mysql -u root -p

create database keystone;
grant all privileges on keystone.* to 'keystone'@'localhost' identified by 'keystone';
grant all privileges on keystone.* to 'keystone'@'%' identified by 'keystone';
grant all privileges on keystone.* to 'keystone'@'controller' identified by 'keystone';

create database glance;
grant all privileges on glance.* to 'glance'@'localhost' identified by 'glance';
grant all privileges on glance.* to 'glance'@'%' identified by 'glance';
grant all privileges on glance.* to 'glance'@'controller' identified by 'glance';

create database nova;
grant all privileges on nova.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova.* to 'nova'@'%' identified by 'nova';
grant all privileges on nova.* to 'nova'@'controller' identified by 'nova';

create database nova_api;
grant all privileges on nova_api.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova_api.* to 'nova'@'%' identified by 'nova';
grant all privileges on nova_api.* to 'nova'@'controller' identified by 'nova';

create database nova_cell0;
grant all privileges on nova_cell0.* to 'nova'@'localhost' identified by 'nova';
grant all privileges on nova_cell0.* to 'nova'@'%' identified by 'nova';
grant all privileges on nova_cell0.* to 'nova'@'controller' identified by 'nova';

create database neutron;
grant all privileges on neutron.* to 'neutron'@'localhost' identified by 'neutron';
grant all privileges on neutron.* to 'neutron'@'%' identified by 'neutron';
grant all privileges on neutron.* to 'neutron'@'controller' identified by 'neutron';

flush privileges;
MariaDB [(none)]> select user,host from mysql.user;
+----------+------------+
| user     | host       |
+----------+------------+
| glance   | %          |
| keystone | %          |
| neutron  | %          |
| nova     | %          |
| root     | 127.0.0.1  |
| root     | ::1        |
| glance   | controller |
| keystone | controller |
| neutron  | controller |
| nova     | controller |
| root     | controller |
| glance   | localhost  |
| keystone | localhost  |
| neutron  | localhost  |
| nova     | localhost  |
| root     | localhost  |
+----------+------------+
16 rows in set (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| neutron            |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
+--------------------+
9 rows in set (0.00 sec)

7.在controller节点安装RabbitMQ消息队列

[root@controller ~]# yum install rabbitmq-server -y
[root@controller ~]# systemctl enable rabbitmq-server.service
[root@controller ~]# systemctl start rabbitmq-server.service
[root@controller ~]# rabbitmqctl add_user openstack openstack
Creating user "openstack" ...
[root@controller ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" 
Setting permissions for user "openstack" in vhost "/" ...
[root@controller ~]# rabbitmq-plugins enable rabbitmq_management
[root@controller ~]# lsof -i:15672
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 3162 rabbitmq   54u  IPv4 449707      0t0  TCP *:15672 (LISTEN)

#访问RabbitMQ,访问地址是http://ip:15672
#默认用户名密码都是guest,浏览器添加openstack用户到组并登陆测试
OpenStack Pike Minimal安装:一、环境准备_第1张图片

8.在controller节点上安装memcached

[root@controller ~]# yum install memcached python-memcached -y
[root@controller ~]# systemctl enable memcached.service
[root@controller ~]# systemctl start memcached.service