基于OpenStack构建企业私有云(1)实验环境准备

in #openstack7 years ago

一.基础软件包安装

1.安装EPEL仓库

# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

2.安装OpenStack仓库

# yum install -y centos-release-openstack-queens

3.安装OpenStack客户端

# yum install -y python-openstackclient

4.安装openstack SELinux管理包(实验环境关闭selinux可以不安装)

# yum install -y openstack-selinux

二.MySQL数据库部署

1.MySQL安装

# yum install -y mariadb mariadb-server python2-PyMySQL

2.修改MySQL配置文件

[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并设置开机启动

# systemctl enable mariadb.service
# systemctl start mariadb.service

4.进行数据库安全设置

# mysql_secure_installation

5.数据库创建

# 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

# yum install -y rabbitmq-server

2.设置开启启动,并启动RabbitMQ

# systemctl enable rabbitmq-server.service
# systemctl start rabbitmq-server.service

3.添加openstack用户。

# rabbitmqctl add_user openstack openstack
Creating user "openstack" ...

4.给刚才创建的openstack用户,创建权限。

# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...

5.启用Web监控插件

# rabbitmq-plugins list
# rabbitmq-plugins enable rabbitmq_management