一、实验说明

按照官方文档搭建queens版本openstack,拓扑如下图所示:

二、实验目的

准备好openstack组件安装前所需要的其他软件,如MariaDB,RabbitMQ等。

三、操作步骤

修改所有节点/etc/hosts文件

如果hosts文件中有将主机名解析到127.0.0.1的配置段,将其注销
所有节点关闭NetworkManager
[root@compute1 ~]# systemctl stop NetworkManager.service
[root@compute1 ~]# systemctl disable NetworkManager.service
所有节点添加openstack需要的yum源
[root@controller ~]# vim /etc/yum.repo.d/OpenStack-Queens.repo

[OpenStack-Queens]
name=OpenStack-Queens
baseurl=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-queens/
enable=1
gpgcheck=0

安装NTP服务 controller节点进行以下操作:

  1. 安装并设置允许同步的网段
    [root@controller ~]# yum install chrony
    [root@controller ~]# vim /etc/chrony.conf
allow 172.16.80.0/24
  1. 启动NTP服务并同步测试
    [root@controller ~]# systemctl enable chronyd.service
    [root@controller ~]# systemctl start chronyd.service
    [root@controller ~]# chronyc sources

其他节点进行以下操作:

  1. 安装NTP并设置向controller进行时间同步 [root@controller ~]# yum install chrony
    [root@controller ~]# vim /etc/chrony.conf
server controller iburst
  1. 启动服务并验证同步 [root@controller ~]# systemctl enable chronyd.service
    [root@controller ~]# systemctl start chronyd.service
    [root@controller ~]# chronyc sources

安装数据库

  1. 安装并编辑配置文件
    [root@controller ~]# yum install mariadb mariadb-server python2-PyMySQL
    [root@controller ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 172.16.80.10
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
skip_name_resolve = 1
  1. 启动数据库
    [root@controller ~]# systemctl enable mariadb.service
    [root@controller ~]# systemctl start mariadb.service

安装消息中间件

  1. 安装rabbitmq中间件
    [root@controller ~]# yum install rabbitmq-server
  2. 加载rabbitmq_management插件启用图形界面 [root@controller ~]# rabbitmq-plugins enable rabbitmq_management
    [root@controller ~]# systemctl start rabbitmq-server.service
  3. 为openstack创建用户并授权
    [root@controller ~]# rabbitmqctl add_user openstack password1!
    [root@controller ~]# rabbitmqctl set_permissions openstack "." "." ".*"

安装认证缓存

  1. 安装程序包
    [root@controller ~]# yum install memcached python-memcached
  2. 配置并启用程序
    [root@controller ~]# vim /etc/sysconfig/memcached

    [root@controller ~]# systemctl enable memcached.service
    [root@controller ~]# systemctl start memcached.service

安装分布式密钥存储

  1. 下载安装包
    [root@controller ~]# yum install etcd
  2. 编辑配置文件并启动
    [root@controller ~]# vim /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://172.16.80.10:2380"
ETCD_LISTEN_CLIENT_URLS="http://172.16.80.10:2379"
ETCD_NAME="controller"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://172.16.80.10:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://172.16.80.10:2379"
ETCD_INITIAL_CLUSTER="controller=http://172.16.80.10:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"

[root@controller ~]# systemctl enable etcd
[root@controller ~]# systemctl start etcd

至此,openstack安装前准备工作全部完成。