OpenStack 中模块安装前的准备工作。
环境信息¶
| Item | Distribution / Version |
|---|
| OS | CentOS Linux 7 |
| Kernel | Linux 3.10.0-693.11.1.el7.x86_64 |
| Architecture | x86-64 |
准备工作¶
修改主机名¶
修改 /etc/hostname 内容为目标主机名。
网络配置¶
网卡配置¶
网卡配置文件目录在 /etc/sysconfig/network-scripts/ 下,将文件中的 ONBOOT 项的值改为 yes ,即可让网卡开机启动。
示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s25
UUID=1c3f8cd4-8cae-462b-9c7b-213460086c66 // 不要改
DEVICE=enp0s25
ONBOOT=yes
|
Hosts 文件¶
修改 /etc/hosts ,加入目标主机名及静态 IP 地址。
示例:
1
2
3
| 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 devstack-compute devstack-controller
::1 localhost localhost.localdomain localhost6 localhost6.localdomain
192.168.1.104 compute
|
内网穿透¶
若拥有公网 IP 的壕们可以不看。
通过 frp 实现。
具体步骤参照 Documentation 。
后台启动命令:
1
| nohup /home/xiaoming/frp_0.14.0_linux_amd64/frpc -c /home/xiaoming/frp_0.14.0_linux_amd64/frpc.ini >/home/xiaoming/frp.log &
|
开启 rc-local 服务¶
实现开机启动脚本。
将开机后需要执行的命令写入 /etc/rc.d/rc.local。
rc.local 示例文件:
1
2
| touch /var/lock/subsys/local
nohup /home/xiaoming/frp_0.14.0_linux_amd64/frpc -c /home/xiaoming/frp_0.14.0_linux_amd64/frpc.ini >/home/xiaoming/frp.log &
|
执行以下命令,使 rc.local 文件可执行。
1
| # chmod +x /etc/rc.d/rc.local
|
开机启动 rc-local 服务:
1
2
| # systemctl enable rc-local
# systemctl start rc-local
|
新建用户¶
添加用户组:
打开 /etc/sudoers 文件,更改用户组 sudo 权限。在文件末尾添加:
添加用户:
1
| # useradd -g admin triplez
|
请将 triplez 更改为自己需要的用户名。
更改用户密码:
请将 triplez 更改为自己需要的用户名。
Chrony 时间同步服务¶
安装 chrony :
Controller 节点¶
更改 /etc/chrony.conf 配置文件。
示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| # Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# Allow NTP client access from local network.
allow 192.168.0.0/16
allow 10.0.0.0/8
|
开机启动 chrony 时间同步服务:
1
2
| # systemctl enable chrony
# systemctl start chrony
|
查看客户端同步信息:
查看时间同步信息:
其他节点¶
更改 /etc/chrony.conf 配置文件,只保留 controller 的 server 字段。
示例:
1
| server controller ibust
|
开机启动 chrony 时间同步服务:
1
2
| # systemctl enable chrony
# systemctl start chrony
|
查看时间同步信息:
安装软件包¶
移除 EPEL 源¶
当我们使用 RDO 软件源时,使用 EPEL 源容易打破组件间的相容性,出现各种奇怪的问题,因此建议关闭。
1
| # yum remove epel-release
|
添加 OpenStack 源¶
1
| # yum install centos-release-openstack-ocata
|
升级软件包:
安装必备组件¶
安装 python-openstackclient, openstack-selinux :
1
2
| # yum install python-openstackclient
# yum install openstack-selinux
|
下面的组件都只有 controller 才需要安装。
安装数据库 MariaDB¶
安装 MariaDB :
1
| # yum install mariadb mariadb-server python2-PyMySQL
|
在 /etc/my.cnf.d 下新建 openstack.cnf 文件,编写成 :
1
2
3
4
5
6
7
8
| [mysqld]
bind-address = 192.168.1.105
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
|
bind-address 字段的 IP 值要根据实际情况改写。
启动 MariaDB 数据库服务:
1
2
| # systemctl enable mariadb
# systemctl start mariadb
|
初始化数据库:
1
| # mysql_secure_installation
|
安装队列服务 RabbitMQ¶
1
| # yum install rabbitmq-server
|
启动 RabbitMQ 队列服务:
1
2
| # systemctl enable rabbitmq-server
# systemctl start rabbitmq-server
|
RabbitMQ 启动不成功的解决办法:
错误提示:Failed to start RabbitMQ broker.
错误原因:RabbitMQ Server 在启动时会检查主机的 hostname 是否能够正常解析,若解析错误就无法启动。
解决方案:在 /etc/hosts 中增加 127.0.0.1 your_hostname 。
在 RabbitMQ 中添加 openstack 用户:
1
| # rabbitmqctl add_user openstack RABBIT_PASSWORD
|
RABBIT_PASSWORD 要替换成自己希望设定的队列服务密码。
给 openstack 用户设置权限:
1
| # rabbitmqctl set_permissions openstack ".*" ".*" ".*"
|
emmmm…… 后面那三个 ".*" 什么意义我也不清楚…… 其实就是懒
安装缓存服务 Memcached¶
1
| # yum install memcached python-memcached
|
修改 /etc/sysconfig/memcached 文件,在 OPTIONS 内容中添加 hostname 主机名。
示例:
1
2
3
4
5
| PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 0.0.0.0"
|
启动 Memcached 缓存服务:
1
2
| # systemctl enable memcached
# systemctl start memcached
|
至此,我们完成了所有的准备工作,为自己撒花~ :)
基本按照官方文档的步骤来都没什么问题,除了一些特殊配置之外。由于配置 OpenStack 网络的特殊性,hostname 和 hosts 这两个文件需要重点关照,并且要多留意 IP 解析问题。

本作品采用
知识共享署名-相同方式共享 4.0 国际许可协议进行许可。