Centos7 的 Open Stack T 版搭建流程 --- (一)主机物理环境和配置环境变量

Centos7 的 Open Stack T 版搭建流程

一、主机物理环境准备

主机名controller
核数4核
硬盘大小60GB及以上
网卡数量双网卡
网卡一NET 模式
网卡二仅主机模式
镜像centos7-1908 以上
主机名compute
核数4核
硬盘大小60GB及以上
网卡数量双网卡
网卡一NET 模式
网卡二仅主机模式
镜像centos7-1908 以上

二、配置主机环境变量

(1)配置网络环境

controller
vi /etc/sysconfig/network-scripts/ifcfg-ens33

注意ifcfg-ens33controller 的网络接口物理设备名称。请根据自己的网络接口物理设备名称选择。

网络配置文件需要修改的地方:

  • 修改为 BOOTPROTO=static
  • 修改为 ONBOOT=yes
  • 添加 IPADDR=192.168.100.10(你自己的 NET 地址中的一个)
  • 添加 NETMASK=255.255.255.0(你自己的 NET 地址的网络掩码)
  • 添加 GATEWAY=192.168.100.2(你自己的 NET 地址的网关)
  • 添加 DNS1=114.114.114.114 (也可以是 8.8.8.8 或都写)

修改后的网络配置如下:

TYPE=Ethernet		# 网络类型。Ethernet 、IPsec 等类型,默认类型为 Ethernet (以太网)
PROXY_METHOD=none		# 配置网络接口代理方法 {none | manual | auto} 
BROWSER_ONLY=no			# 配置网络接口是否只用于浏览器访问 {yes | no}
BOOTPROTO=static		# 网卡获得 ip 地址的方式 {static | dhcp | none | bootp}
DEFROUTE=yes			# 是否使用默认路由 {yes | no}
IPV4_FAILURE_FATAL=no	# 是否开启 IPV4 致命错误检测 {yes | no}
IPV6INIT=yes			# IPV6 是否自动初始化 {yes | no}
IPV6_AUTOCONF=yes		# IPV6 是否自动配置 {yes | no}
IPV6_DEFROUTE=yes	 	# IPV6 是否使用默认路由 {yes | no}
IPV6_FAILURE_FATAL=no	# 是否开启 IPV6 致命错误检测 {yes | no}
IPV6_ADDR_GEN_MODE=stable-privacy			# 配置 IPv6 地址生成模式 
NAME=ens33				# 网络接口的名称
UUID=a670dd6a-1788-4a38-9228-a251c1f49695	# 网络接口的唯一设备 ID
DEVICE=ens33			# 网络接口物理设备名称
ONBOOT=yes				# 系统启动时是否激活网络接口 {yes | no}
IPADDR=192.168.100.10	# 设置静态 IP 地址
NETMASK=255.255.255.0	# 设置网络掩码,可选配置方式: PREFIX=24
GATEWAY=192.168.100.2	# 设置网关地址
DNS1=114.114.114.114	# DNS 地址
DNS2=8.8.8.8			# DNS 地址

重启网络

systemctl restart network

测试连接

ping baidu.com

必须要 ping 通。ping 通结果如下(数字不用管,类似这样就行。)

PING baidu.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=29.8 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=128 time=31.4 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=128 time=64.7 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=4 ttl=128 time=46.8 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=5 ttl=128 time=51.8 ms
compute
vi /etc/sysconfig/network-scripts/ifcfg-ens33

注意ifcfg-ens33controller 的网络接口物理设备名称。请根据自己的网络接口物理设备名称选择。

网络配置文件需要修改的地方:

  • 修改为 BOOTPROTO=static
  • 修改为 ONBOOT=yes
  • 添加 IPADDR=192.168.100.20(你自己的 NET 地址中的一个)
  • 添加 NETMASK=255.255.255.0(你自己的 NET 地址的网络掩码)
  • 添加 GATEWAY=192.168.100.2(你自己的 NET 地址的网关)
  • 添加 DNS1=114.114.114.114 (也可以是 8.8.8.8 或都写)

修改后的网络配置如下:

TYPE=Ethernet								# 网络类型。Ethernet 、IPsec 等类型,默认类型为 Ethernet (以太网)
PROXY_METHOD=none							# 配置网络接口代理方法 {none | manual | auto} 
BROWSER_ONLY=no								# 配置网络接口是否只用于浏览器访问 {yes | no}
BOOTPROTO=static							# 网卡获得 ip 地址的方式 {static | dhcp | none | bootp}
DEFROUTE=yes								# 是否使用默认路由 {yes | no}
IPV4_FAILURE_FATAL=no						# 是否开启 IPV4 致命错误检测 {yes | no}
IPV6INIT=yes								# IPV6 是否自动初始化 {yes | no}
IPV6_AUTOCONF=yes							# IPV6 是否自动配置 {yes | no}
IPV6_DEFROUTE=yes	 						# IPV6 是否使用默认路由 {yes | no}
IPV6_FAILURE_FATAL=no						# 是否开启 IPV6 致命错误检测 {yes | no}
IPV6_ADDR_GEN_MODE=stable-privacy			# 配置 IPv6 地址生成模式 
NAME=ens33									# 网络接口的名称
UUID=a670dd6a-1788-4a38-9228-a251c1f49695	# 网络接口的唯一设备 ID
DEVICE=ens33								# 网络接口物理设备名称
ONBOOT=yes									# 系统启动时是否激活网络接口 {yes | no}
IPADDR=192.168.100.20						# 设置静态 IP 地址
NETMASK=255.255.255.0						# 设置网络掩码,可选配置方式: PREFIX=24
GATEWAY=192.168.100.2						# 设置网关地址
DNS1=114.114.114.114						# DNS 地址
DNS2=8.8.8.8								# DNS 地址

重启网络

systemctl restart network

测试连接

ping baidu.com

必须要 ping 通。ping 通结果如下(数字不用管,类似这样就行。)

PING baidu.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=29.8 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=128 time=31.4 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=128 time=64.7 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=4 ttl=128 time=46.8 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=5 ttl=128 time=51.8 ms

(2)配置安全环境

controller

修改 selinux 的安全策略

setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

关闭防火墙

systemctl stop firewalld && systemctl disable firewalld
compute

修改 selinux 的安全策略

setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

关闭防火墙

systemctl stop firewalld && systemctl disable firewalld

(3)配置主机名

controller
hostnamectl set-hostname controller
compute
hostnamectl set-hostname compute

(4)检查是否有 OpenStack T 版镜像

controller
yum list | grep openstack*

出现 centos-release-openstack-train.noarch 就行

compute
yum list | grep openstack*

出现 centos-release-openstack-train.noarch 就行

(5)配置网络时间协议(NTP)

controller
 yum -y install chrony

修改配置文件

vi /etc/chrony.conf

需要修改的地方

  • 将 4个 server 修改为 阿里云的server
  • #allow 192.168.0.0/16 修改为 allow all 并去掉 #
  • #local stratum 10 去掉 #

修改后的配置文件如下:

# Use public servers from the pool.ntp.org project.							翻译:使用 pool.ntp.org 项目提供的公共服务器。
# Please consider joining the pool (http://www.pool.ntp.org/join.html). 	翻译:请考虑加入该项目(http://www.pool.ntp.org/join.html)
server ntp.aliyun.com iburst		# 	  指定了使用阿里云的 NTP 服务器来同步系统时钟。
									# --- server : 指代 NTP(网络时间协议)服务器,用于提供准确的时间信息给网络上的客户端设备。
									# --- ntp.aliyun.com : 是一个域名,代表一个 NTP 服务器,由阿里云提供。
									# --- iburst : 表示在启动时尝试快速同步时间。

# Record the rate at which the system clock gains/losses time.				翻译:记录系统时钟增加/减少时间的速率。	
driftfile /var/lib/chrony/drift		#     指定了保存系统时钟漂移数据的文件路径为"/var/lib/chrony/drift"。
									# --- driftfile : 表示指定漂移文件的路径。
									
# Allow the system clock to be stepped in the first three updates			翻译:在前三次更新中允许系统时钟进行步进调整。
# if its offset is larger than 1 second.									翻译:如果系统时钟的偏移大于1秒。
makestep 1.0 3						#     是让系统时钟在前三次更新中允许立即调整1.0秒,即如果时钟的偏移超过1.0秒,则会立即进行调整。
									# ---  makestep 后面的参数表示允许立即调整的秒数,而后面的数字 3 则表示前三次更新。

# Enable kernel synchronization of the real-time clock (RTC).				翻译:启用内核对实时时钟(RTC)的同步。
rtcsync								#	  是一个配置指令,用于指示NTP服务器在启动时是否启用内核同步,以提高系统时钟的精确度。

# Enable hardware timestamping on all interfaces that support it.			翻译:在所有支持的接口上启用硬件时间戳功能。
#hwtimestamp *						#	  配置命令,用于启用所有支持硬件时间戳的网络接口的硬件时间戳功能。

# Increase the minimum number of selectable sources required to adjust		翻译:增加调整所需的可选择源的最小数量。
# the system clock.															翻译:系统时钟。
#minsources 2						#	  配置命令,用于设置调整系统时钟所需的最小可用时间源数量。在此情况下,系统需要至少两个可用的时间源才能调整系统时钟。

# Allow NTP client access from local network.								翻译:允许本地网络访问NTP客户端。
allow 0.0.0.0/0						#	  配置命令,用于允许所有主机通过 NTP 协议访问本地的 NTP 服务器。

# Serve time even if not synchronized to a time source.						翻译:即使未与时间源同步,也提供时间服务。
local stratum 10					#	  配置命令,用于指定本地 NTP 服务器的层级(stratum)。
									# --- stratum 10 : 表示本地服务器的时钟源具有一个较高的层级,即在 NTP 网络中属于较低级别的服务器。

# Specify file containing keys for NTP authentication.						翻译:指定包含用于NTP身份验证的密钥的文件。
#keyfile /etc/chrony.keys			#	  配置选项,用于指定用于身份验证的密钥文件的路径。

# Specify directory for log files.											翻译:指定日志文件的目录。
logdir /var/log/chrony				#	  配置选项,用于指定日志文件的目录路径。

# Select which information is logged.										翻译:选择记录的信息。
#log measurements statistics tracking										翻译:记录测量统计跟踪。

重启 chronyd 服务并开机自启动

systemctl restart chronyd && systemctl enable chronyd

检查是否成功

timedatectl 
      Local time: 三 2024-04-17 20:32:25 CST		# 本地时间(北京时间)
  Universal time: 三 2024-04-17 12:32:25 UTC 	# 国际原子时时间
        RTC time: 三 2024-04-17 12:32:25			# RTC(实时时钟)
       Time zone: Asia/Shanghai (CST, +0800)	# 时区: 亚洲/上海
     NTP enabled: yes							# NTP 启用: NTP(网络时间协议)已启用,系统正在使用网络上的时间服务器进行时间同步。
NTP synchronized: yes							# NTP 同步: 系统时间已经与 NTP 服务器同步。
 RTC in local TZ: no							# RTC 是否在本地时区: RTC 时间是否使用本地时区配置,默认为否。
      DST active: n/a							# 夏令时是否激活: 夏令时(DST)目前不适用。

出现双 yes 即为成功。

查看时间同步源

chronyc sources -v
210 Number of sources = 1

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 203.107.6.88                  2   6   373    17   -205us[ -615us] +/-   20ms

出现 ^* 且 Reach 不为零,就成功。

配置hosts文件

echo -e "192.168.100.10 controller\n192.168.100.20 compute" >> /etc/hosts 

检查是否成功

ping compute

出现以下内容即为成功。

PING compute (192.168.100.20) 56(84) bytes of data.
64 bytes from compute (192.168.100.20): icmp_seq=1 ttl=64 time=0.449 ms
64 bytes from compute (192.168.100.20): icmp_seq=2 ttl=64 time=0.298 ms
compute
 yum -y install chrony

配置 hosts 文件

echo -e "192.168.100.10 controller\n192.168.100.20 compute" >> /etc/hosts 

检查是否成功

ping controller

出现以下内容即为成功。

PING controller (192.169.100.10) 56(84) bytes of data.
64 bytes from controller (192.169.100.10): icmp_seq=1 ttl=128 time=390 ms
64 bytes from controller (192.169.100.10): icmp_seq=2 ttl=128 time=368 ms
64 bytes from controller (192.169.100.10): icmp_seq=3 ttl=128 time=385 ms
64 bytes from controller (192.169.100.10): icmp_seq=4 ttl=128 time=409 ms

修改配置文件

vi /etc/chrony.conf

需要修改的地方

  • 将 4 个 sever 修改为 sever 192.168.100.10 iburst

修改后的配置文件如下:

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.100.10 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

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

重启 chronyd 服务并开机自启动

systemctl restart chronyd && systemctl enable chronyd

检查是否成功

chronyc sources -v
210 Number of sources = 1

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 192.168.100.10                3   6     3     1   +835ms[ +835ms] +/-   29ms

出现 ^* 且 Reach 不为零,就成功。

(6)安装 CentOS OpenStack Train 发行版的软件包

controller
yum install centos-release-openstack-train -y
compute
yum install centos-release-openstack-train -y

(7)安装 python-openstackclient 和 OpenStack 服务的策略

controller
yum install python-openstackclient openstack-selinux -y
compute
yum install python-openstackclient openstack-selinux -y
  • 20
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 7.9本(CentOS-7-aarch64-Everything-2009)适用于ARM64 (aarch64),必须集齐9个文件才能一起解压缩使用,9个文件下载地址: CentOS-7-aarch64-Everything-2009.part09.rar https://download.csdn.net/download/weixin_43800734/20419195 CentOS-7-aarch64-Everything-2009.part08.rar https://download.csdn.net/download/weixin_43800734/20419107 CentOS-7-aarch64-Everything-2009.part07.rar https://download.csdn.net/download/weixin_43800734/20419029 CentOS-7-aarch64-Everything-2009.part06.rar https://download.csdn.net/download/weixin_43800734/20418995 CentOS-7-aarch64-Everything-2009.part05.rar https://download.csdn.net/download/weixin_43800734/20418492 CentOS-7-aarch64-Everything-2009.part04.rar https://download.csdn.net/download/weixin_43800734/20418455 CentOS-7-aarch64-Everything-2009.part03.rar https://download.csdn.net/download/weixin_43800734/20418366 CentOS-7-aarch64-Everything-2009.part02.rar https://download.csdn.net/download/weixin_43800734/20418341 CentOS-7-aarch64-Everything-2009.part01.rar https://download.csdn.net/download/weixin_43800734/20418267 CentOS是免费的、开源的、可以重新分发的开源操作系统,CentOS(Community Enterprise Operating System,中文意思是社区企业操作系统)是Linux发行之一。 CentOS Linux发行是一个稳定的,可预测的,可管理的和可复现的平台,源于Red Hat Enterprise Linux(RHEL)依照开放源代码(大部分是GPL开源协议 )规定释出的源码所编译而成。自2004年3月以来,CentOS Linux一直是社区驱动的开源项目,旨在与RHEL在功能上兼容。
CentOS 7.9本(CentOS-7-aarch64-Everything-2009)适用于ARM64 (aarch64),必须集齐9个文件才能一起解压缩使用,9个文件下载地址: CentOS-7-aarch64-Everything-2009.part09.rar https://download.csdn.net/download/weixin_43800734/20419195 CentOS-7-aarch64-Everything-2009.part08.rar https://download.csdn.net/download/weixin_43800734/20419107 CentOS-7-aarch64-Everything-2009.part07.rar https://download.csdn.net/download/weixin_43800734/20419029 CentOS-7-aarch64-Everything-2009.part06.rar https://download.csdn.net/download/weixin_43800734/20418995 CentOS-7-aarch64-Everything-2009.part05.rar https://download.csdn.net/download/weixin_43800734/20418492 CentOS-7-aarch64-Everything-2009.part04.rar https://download.csdn.net/download/weixin_43800734/20418455 CentOS-7-aarch64-Everything-2009.part03.rar https://download.csdn.net/download/weixin_43800734/20418366 CentOS-7-aarch64-Everything-2009.part02.rar https://download.csdn.net/download/weixin_43800734/20418341 CentOS-7-aarch64-Everything-2009.part01.rar https://download.csdn.net/download/weixin_43800734/20418267 CentOS是免费的、开源的、可以重新分发的开源操作系统,CentOS(Community Enterprise Operating System,中文意思是社区企业操作系统)是Linux发行之一。 CentOS Linux发行是一个稳定的,可预测的,可管理的和可复现的平台,源于Red Hat Enterprise Linux(RHEL)依照开放源代码(大部分是GPL开源协议 )规定释出的源码所编译而成。自2004年3月以来,CentOS Linux一直是社区驱动的开源项目,旨在与RHEL在功能上兼容。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值