3

OpenStack Ocata 安装 0x00 — Preparation

 2 years ago
source link: https://blog.triplez.cn/posts/openstack-ocata-installation-0x00-preparation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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 ,即可让网卡开机启动。

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 地址。

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

后台启动命令:

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 示例文件:

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 文件可执行。

# chmod +x /etc/rc.d/rc.local

开机启动 rc-local 服务:

# systemctl enable rc-local
# systemctl start rc-local

新建用户#

添加用户组:

# groupadd admin

打开 /etc/sudoers 文件,更改用户组 sudo 权限。在文件末尾添加:

%admin	ALL=(ALL)	ALL

添加用户:

# useradd -g admin triplez

请将 triplez 更改为自己需要的用户名。

更改用户密码:

# passwd triplez

请将 triplez 更改为自己需要的用户名。

Chrony 时间同步服务#

安装 chrony

# yum install chrony

Controller 节点#

更改 /etc/chrony.conf 配置文件。 示例:

# 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 时间同步服务:

# systemctl enable chrony
# systemctl start chrony

查看客户端同步信息:

# chronyc clients

查看时间同步信息:

# chronyc sources -v

其他节点#

更改 /etc/chrony.conf 配置文件,只保留 controllerserver 字段。 示例:

server controller ibust

开机启动 chrony 时间同步服务:

# systemctl enable chrony
# systemctl start chrony

查看时间同步信息:

# chronyc sources -v

安装软件包#

移除 EPEL 源#

当我们使用 RDO 软件源时,使用 EPEL 源容易打破组件间的相容性,出现各种奇怪的问题,因此建议关闭。

# yum remove epel-release

添加 OpenStack 源#

# yum install centos-release-openstack-ocata

升级软件包:

# yum upgrade

安装必备组件#

安装 python-openstackclient, openstack-selinux

# yum install python-openstackclient
# yum install openstack-selinux

下面的组件都只有 controller 才需要安装。

安装数据库 MariaDB#

安装 MariaDB

# yum install mariadb mariadb-server python2-PyMySQL

/etc/my.cnf.d 下新建 openstack.cnf 文件,编写成 :

[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 数据库服务:

# systemctl enable mariadb
# systemctl start mariadb

初始化数据库:

# mysql_secure_installation

安装队列服务 RabbitMQ#

# yum install rabbitmq-server

启动 RabbitMQ 队列服务:

# 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 用户:

# rabbitmqctl add_user openstack RABBIT_PASSWORD

RABBIT_PASSWORD 要替换成自己希望设定的队列服务密码。

openstack 用户设置权限:

# rabbitmqctl set_permissions openstack ".*" ".*" ".*"

emmmm…… 后面那三个 ".*" 什么意义我也不清楚…… 其实就是懒

安装缓存服务 Memcached#

# yum install memcached python-memcached

修改 /etc/sysconfig/memcached 文件,在 OPTIONS 内容中添加 hostname 主机名。

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 0.0.0.0"

启动 Memcached 缓存服务:

# systemctl enable memcached
# systemctl start memcached

至此,我们完成了所有的准备工作,为自己撒花~ :)

总结#

基本按照官方文档的步骤来都没什么问题,除了一些特殊配置之外。由于配置 OpenStack 网络的特殊性,hostnamehosts 这两个文件需要重点关照,并且要多留意 IP 解析问题。


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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK