首页 资讯 社群 我的社区 搜索

OpenStack实操-CentOS下安装Rocky版本_01

史丹利复合肥
2018-10-12 17:35:12

本帖结束后,你会完成安装OpenStack前的环境

1.基础环境配置

1.1节点硬件规划

本次参照openstack官方文档(当前为--Rocky版)搭建

使用VMware虚拟出两台Centos虚拟机作为节点

节点类型节点名称cpu内存硬盘系统
控制节点controller48G100GCentOS-7
计算节点compute148G100GCentOS-7

硬件需求:



1.2节点网络规划    

根据硬件需求所示,核心组件controllerNode和conputeNode都需要两块网卡,担任管理网络和隧道网络分别承载系统管理相关功能 和虚拟机间的数据流量使用,本例中管理网络可以连接外网,做软件安装使用


1.2.1虚拟机IP设置

控制节点:

更改第一块网卡配置文件 /etc/sysconfig/network-scripts/ifcfg-INTERFACE_NAME

    IP地址:192.168.75.11

    子网掩码:255.255.255.0

    网关:192.168.75.2

设置第二块网卡(较为特殊,不需要配置IP)

DEVICE=INTERFACE_NAME
TYPE=Ethernet
ONBOOT="yes"
BOOTPROTO="none"

设置主机名:controller

解析/etc/hosts

# controller
192.168.75.11 controller

# compute1
192.168.75.31 compute1

# block1
192.168.75.41 block1

# object1
1 192.168.75.51 object1

# object2
192.168.75.52 object2


计算节点:

基本和控制节点设置一致

更改第一块网卡配置文件 /etc/sysconfig/network-scripts/ifcfg-INTERFACE_NAME

    IP地址:192.168.75.31

    子网掩码:255.255.255.0

    网关:192.168.75.2

设置第二块网卡(较为特殊,不需要配置IP)

DEVICE=INTERFACE_NAME
TYPE=Ethernet
ONBOOT="yes"
BOOTPROTO="none"

设置主机名compute1

解析/etc/hosts

# controller
192.168.75.11 controller

# compute1
192.168.75.31 compute1

# block1
192.168.75.41 block1

# object1
1 192.168.75.51 object1

# object2
192.168.75.52 object2

验证操作:

从控制节点访问Internet

[root@controller ~]# ping -c 4 openstack.org
PING openstack.org (162.242.140.107) 56(84) bytes of data.
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=1 ttl=128 time=205 ms
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=2 ttl=128 time=204 ms
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=3 ttl=128 time=206 ms
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=4 ttl=128 time=204 ms

--- openstack.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 12219ms

验证控制节点连接计算节点

[root@controller ~]# ping -c 4 compute1
PING compute1 (192.168.75.31) 56(84) bytes of data.
64 bytes from compute1 (192.168.75.31): icmp_seq=1 ttl=64 time=0.570 ms
64 bytes from compute1 (192.168.75.31): icmp_seq=2 ttl=64 time=0.480 ms
64 bytes from compute1 (192.168.75.31): icmp_seq=3 ttl=64 time=0.480 ms
64 bytes from compute1 (192.168.75.31): icmp_seq=4 ttl=64 time=0.424 ms

--- compute1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.424/0.488/0.570/0.056 ms

从计算节点访问Internet

[root@compute1 ~]# ping -c 4 openstack.org
PING openstack.org (162.242.140.107) 56(84) bytes of data.
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=1 ttl=128 time=204 ms
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=2 ttl=128 time=204 ms
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=3 ttl=128 time=204 ms
64 bytes from 162.242.140.107 (162.242.140.107): icmp_seq=4 ttl=128 time=204 ms

--- openstack.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 12224ms
rtt min/avg/max/mdev = 204.791/204.913/204.993/0.081 ms

验证计算节点连接控制节点

[root@compute1 ~]# ping -c 4 controller
PING controller (192.168.75.11) 56(84) bytes of data.
64 bytes from controller (192.168.75.11): icmp_seq=1 ttl=64 time=0.402 ms
64 bytes from controller (192.168.75.11): icmp_seq=2 ttl=64 time=0.370 ms
64 bytes from controller (192.168.75.11): icmp_seq=3 ttl=64 time=0.512 ms
64 bytes from controller (192.168.75.11): icmp_seq=4 ttl=64 time=0.405 ms

--- controller ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.370/0.422/0.512/0.055 ms


1.3网络时间协议(NTP)


yum install chrony

编辑如下文件

server NTP_SERVER iburst

allow 192.168.75.0/24

本例中控制节点引用外部时间校准,计算节点引用控制节点,留意设置 

启动NTP服务并开机启动

# systemctl enable chronyd.service
# systemctl start chronyd.service

验证操作:

控制节点

[root@controller ~]# chronyc sources
210 Number of sources = 4
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^+ ntp1.flashdance.cx 2 10 377 24m -16ms[ -16ms] +/- 144ms
^- amy.chl.la 2 9 25 617 -63ms[ -63ms] +/- 238ms
^* 119.28.183.184 2 9 164 27m +37ms[ +34ms] +/- 97ms
^+ 85.199.214.101 1 10 375 690 -45ms[ -45ms] +/- 143ms

计算节点

[root@compute1 ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* controller 3 6 377 56 -15us[ -27us] +/- 107ms

还可以输入:timedatectl,NTP synchronized:yes 说明同步成功

[root@compute1 ~]# timedatectl
Local time: Fri 2018-10-12 17:21:16 CST
Universal time: Fri 2018-10-12 09:21:16 UTC
RTC time: Fri 2018-10-12 09:21:16
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a


 1.4OpenStack包

此操作在所有节点执行

由于本例采用Centos默认启用额外仓库,直接安装包,选择对应的版本,本例安装当前最新的Rocky

the Rocky release, run:
# yum install centos-release-openstack-rocky


the Queens release, run:
# yum install centos-release-openstack-queens



the Pike release, run:
# yum install centos-release-openstack-pike

完成安装,这是一个比较长的升级过程,至此可以稍事休息,后面继续

yum upgrade

安装 OpenStack 客户端:

yum install python-openstackclient

RHEL 和 CentOS 默认启用了 SELinux . 安装 openstack-selinux 软件包以便自动管理 OpenStack 服务的安全策略:

yum install openstack-selinux


用户评论 (1)
  • 史丹利复合肥

    2018-11-13 11:53:50 史丹利复合肥 1#

    不知为何,我的controller节点虚拟机关闭时总是很慢,说碎片多,是通病还是我装的有问题?

    但是整个系统工作起来没发现什么异常的