请严格按照实验环境执行,如果你是新手,不按环境来,几乎不会成功,因为OpenStack依赖的组件太多了。
任何一个小错误都可能导致最终无法创建虚拟机。
一.基础软件包安装
1.安装EPEL仓库
# rpm -ivh [url]http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm[/url]
2.安装OpenStack仓库
# yum install -y centos-release-openstack-queens
3.安装OpenStack客户端
# yum install -y python-openstackclient
4.安装openstack SELinux管理包
# yum install -y openstack-selinux
二.MySQL数据库部署
1.MySQL安装
[root@linux-node1 ~]# yum install -y mariadb mariadb-server python2-PyMySQL
2.修改MySQL配置文件
[root@linux-node1 ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.56.11 #设置监听的IP地址
default-storage-engine = innodb #设置默认的存储引擎
innodb_file_per_table = on#使用独享表空间
collation-server = utf8_general_ci #服务器的默认校对规则
character-set-server = utf8 #服务器安装时指定的默认字符集设定
max_connections = 4096 #设置MySQL的最大连接数,生产请根据实际情况设置。
3.启动MySQL Server并设置开机启动
[root@linux-node1 ~]# systemctl enable mariadb.service
[root@linux-node1 ~]# systemctl start mariadb.service
4.进行数据库安全设置
[root@linux-node1 ~]# mysql_secure_installation
5.数据库创建
[root@linux-node1 ~]# mysql -u root -p
Enter password:
…
MariaDB [(none)]>
Keystone数据库
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';
Glance数据库
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';
Nova数据库
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' 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';
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';
Neutron 数据库
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';
Cinder数据库
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';
三:消息代理RabbitMQ
1.安装RabbitMQ
[root@linux-node1 ~]# yum install -y rabbitmq-server
2.设置开启启动,并启动RabbitMQ
[root@linux-node1 ~]# systemctl enable rabbitmq-server.service
[root@linux-node1 ~]# systemctl start rabbitmq-server.service
3.添加openstack用户。
[root@linux-node1 ~]# rabbitmqctl add_user openstack openstack
Creating user "openstack" ...
4.给刚才创建的openstack用户,创建权限。
[root@linux-node1 ~]# rabbitmqctl set_permissions openstack "." "." ".*"
Setting permissions for user "openstack" in vhost "/" ...
5.启用Web监控插件
[root@linux-node1 ~]# rabbitmq-plugins list
[root@linux-node1 ~]# rabbitmq-plugins enable rabbitmq_management