01.CentOS-Stream-8-packstack安装OpenStack

CentOS-Stream-8-packstack安装OpenStack

前期准备

1、资源清单

CentOS-Stream-8(minimal安装) -CentOS-Stream-8-20240603.0-x86_64-dvd1.iso

https://mirrors.aliyun.com/centos-vault/8-stream/isos/x86_64/CentOS-Stream-8-20240603.0-x86_64-dvd1.iso?spm=a2c6h.25603864.0.0.33e24ee4AiZUTJ

vmware workstation17.5

OpenStack-Victoria

2、虚拟机硬件配置

controller 4CPU 8G内存 1张网卡:NAT 100G系统盘

compute 4CPU 8G内存 1张网卡:NAT 100G系统盘

按照个人情况配置内存

3、网络拓扑

vmware网络设置:

NAT网络,开启DHCP,192.168.108.0/24,网关192.168.108.2,DNS 192.168.108.2

说明:

Windows环境vmware的NAT网络网关为192.168.108.2

Linux环境vmware的NAT网络网关为192.168.108.1

/etc/hosts

192.168.108.10 controller

192.168.108.11 compute

步骤一:准备模板虚拟机

基于CentOS-Stream-8模板制作.md制作的模板,克隆出一个虚拟机(openstack_template),作为openstack模板虚拟机

完整克隆,克隆好后,开机配置

配置yum源

shell 复制代码
[root@localhost ~]# rm -rf /etc/yum.repos.d/*

[root@localhost ~]# cat <<EOF > /etc/yum.repos.d/openstack.repo
[centos-openstack-victoria]
name=CentOS 8 - OpenStack victoria
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/cloud/x86_64/openstack-victoria/
gpgcheck=0
enabled=1
 
[highavailability]
name=CentOS Stream 8 - HighAvailability
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/HighAvailability/x86_64/os/
gpgcheck=0
enabled=1
 
[nfv]
name=CentOS Stream 8 - NFV
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/NFV/x86_64/os/
gpgcheck=0
enabled=1
 
[rt]
name=CentOS Stream 8 - RT
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/RT/x86_64/os/
gpgcheck=0
enabled=1
 
[resilientstorage]
name=CentOS Stream 8 - ResilientStorage
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/ResilientStorage/x86_64/os/
gpgcheck=0
enabled=1
 
[extras-common]
name=CentOS Stream 8 - Extras packages
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/extras/x86_64/extras-common/
gpgcheck=0
enabled=1
 
[extras]
name=CentOS Stream $releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/extras/x86_64/os/
gpgcheck=0
enabled=1
 
[centos-ceph-pacific]
name=CentOS - Ceph Pacific
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/storage/x86_64/ceph-pacific/
gpgcheck=0
enabled=1
 
[centos-rabbitmq-38]
name=CentOS-8 - RabbitMQ 38
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/messaging/x86_64/rabbitmq-38/
gpgcheck=0
enabled=1
 
[centos-nfv-openvswitch]
name=CentOS Stream 8 - NFV OpenvSwitch
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/nfv/x86_64/openvswitch-2/
gpgcheck=0
enabled=1
 
[baseos]
name=CentOS Stream 8 - BaseOS
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/BaseOS/x86_64/os/
gpgcheck=0
enabled=1
 
[appstream]
name=CentOS Stream 8 - AppStream
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/AppStream/x86_64/os/
gpgcheck=0
enabled=1
 
[powertools]
name=CentOS Stream 8 - PowerTools
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/PowerTools/x86_64/os/
gpgcheck=0
enabled=1
EOF

[root@localhost ~]# yum clean all
0 files removed
[root@localhost ~]# yum makecache

安装方便操作环境包及基础软件包

bash 复制代码
[root@localhost ~]# yum install -y bash-completion vim open-vm-tools net-tools chrony.x86_64
[root@localhost ~]# source /usr/share/bash-completion/bash_completion

设置/etc/hosts

bash 复制代码
[root@localhost ~]# echo '192.168.108.10 controller' >> /etc/hosts
[root@localhost ~]# echo '192.168.108.11 compute' >> /etc/hosts

关闭SELinux

bash 复制代码
[root@localhost ~]# sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config

编辑网卡信息

bash 复制代码
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vim ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=ens160
DEVICE=ens160
ONBOOT=yes

清除密钥信息

bash 复制代码
[root@localhost ~]# cd /etc/ssh/
[root@localhost ssh]# rm -rf ssh_host_*

清除Machine ID

bash 复制代码
[root@localhost ~]# cat /dev/null > /etc/machine-id 
[root@localhost ~]# cat /etc/machine-id

关闭操作系统并拍快照。

bash 复制代码
[root@localhost ~]# poweroff 

步骤二:准备openstack节点

克隆虚拟机并修改基础配置

采用完全克隆方法克隆出其他2台虚拟机(openstack-controller , openstack-compute)。

同样的操作克隆计算节点

2节点的CPU需要开启虚拟化支持。

两节点配置不同的IP,主机名

两节点分别开机,做以下配置

配置主机名

controller:

bash 复制代码
[root@localhost ~]# hostnamectl set-hostname controller

compute:

bash 复制代码
[root@localhost ~]# hostnamectl set-hostname compute

配置IP地址

controller:

bash 复制代码
[root@controller ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=none                    #这行从dhcp 变更为 none
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.108.10
NETMASK=255.255.255.0
GATEWAY=192.168.108.2
DNS1=192.168.108.2
[root@controller ~]# nmcli connection reload ens160
[root@controller ~]# nmcli connection down ens160
[root@controller ~]# nmcli connection up ens160

compute:

bash 复制代码
[root@compute ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=none                #这行从dhcp 变更为 none
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.108.11
NETMASK=255.255.255.0
GATEWAY=192.168.108.2
DNS1=192.168.108.2
[root@controller ~]# nmcli connection reload ens160
[root@controller ~]# nmcli connection down ens160
[root@controller ~]# nmcli connection up ens160

配置NTP

controller:

bash 复制代码
[root@controller ~]# vim /etc/chrony.conf
# pool 2.centos.pool.ntp.org iburst
server ntp.aliyun.com iburst

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

#启动服务
[root@controller ~]# systemctl restart chronyd
[root@controller ~]# systemctl enable chronyd

compute:

bash 复制代码
[root@compute ~]# vim /etc/chrony.conf
# pool 2.centos.pool.ntp.org iburst
server controller iburst

#启动服务
[root@compute ~]# systemctl restart chronyd
[root@compute ~]# systemctl enable chronyd

重启下操作系统

controller:

bash 复制代码
[root@controller ~]# reboot

compute:

bash 复制代码
[root@compute ~]# reboot

此处建议关机拍摄快照

步骤三:安装OpenStack和测试

控制节点安装packstack

controller:

bash 复制代码
[root@controller ~]# yum install -y openstack-packstack

生成应答文件

controller:

baSH 复制代码
[root@controller ~]# packstack --gen-answer-file=answers.txt
Packstack changed given value  to required value /root/.ssh/id_rsa.pub
Additional information:
 * Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS plugin. Geneve will be used as the encapsulation method for tenant networks

更改应答文件

controller:

bash 复制代码
[root@controller ~]# sed -i '/^CONFIG_COMPUTE_HOSTS=/cCONFIG_COMPUTE_HOSTS=192.168.8.200,192.168.8.201,192.168.8.202' answers.txt
[root@controller ~]# sed -i '/^CONFIG_PROVISION_DEMO=/cCONFIG_PROVISION_DEMO=n' answers.txt
[root@controller ~]# sed -i '/^CONFIG_HEAT_INSTALL=/cCONFIG_HEAT_INSTALL=y' answers.txt
[root@controller ~]# sed -i '/^CONFIG_NEUTRON_OVN_BRIDGE_IFACES=/cCONFIG_NEUTRON_OVN_BRIDGE_IFACES=br-ex:ens33' answers.txt
[root@controller ~]# sed -i.bak -r 's/(.+_PW)=[0-9a-z]+/\1=huawei/g' answers.txt

关闭NetworkManager

controller:

bash 复制代码
[root@controller ~]# systemctl stop NetworkManager; systemctl disable NetworkManager; systemctl mask NetworkManager

compute:

bash 复制代码
[root@compute ~]# systemctl stop NetworkManager; systemctl disable NetworkManager; systemctl mask NetworkManager

CentOS 8 版本默认使用 NetworkManager 管理网络,但它会和 openstack 网络组件产生冲突,从而导致告警或错误

根据应答文件配置安装openstack

controller:

bash 复制代码
[root@controller ~]# packstack --answer-file=answers.txt
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20240920-102825-fai6j5rg/openstack-setup.log

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
root@192.168.108.10's password:huawei
root@192.168.108.11's password:huawei
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries                        [ DONE ]
Setting up CACERT                                    [ DONE ]
Preparing AMQP entries                               [ DONE ]
Preparing MariaDB entries                            [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries                           [ DONE ]
Preparing Glance entries                             [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries                             [ DONE ]
Preparing Nova API entries                           [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Preparing Nova Compute entries                       [ DONE ]
Preparing Nova Scheduler entries                     [ DONE ]
Preparing Nova VNC Proxy entries                     [ DONE ]
Preparing OpenStack Network-related Nova entries     [ DONE ]
Preparing Nova Common entries                        [ DONE ]
Preparing Neutron API entries                        [ DONE ]
Preparing Neutron L3 entries                         [ DONE ]
Preparing Neutron L2 Agent entries                   [ DONE ]
Preparing Neutron DHCP Agent entries                 [ DONE ]
Preparing Neutron Metering Agent entries             [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Preparing OpenStack Client entries                   [ DONE ]
Preparing Horizon entries                            [ DONE ]
Preparing Swift builder entries                      [ DONE ]
Preparing Swift proxy entries                        [ DONE ]
Preparing Swift storage entries                      [ DONE ]
Preparing Heat entries                               [ DONE ]
Preparing Heat CloudFormation API entries            [ DONE ]
Preparing Gnocchi entries                            [ DONE ]
Preparing Redis entries                              [ DONE ]
Preparing Ceilometer entries                         [ DONE ]
Preparing Aodh entries                               [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 192.168.108.10_controller.pp
Testing if puppet apply is finished: 192.168.108.10_controller.pp  [ | ]

安装过程中,会在Testing if ...controller.pp步骤停留很长时间,预计40-50分钟,其他步骤很快。

安装完成

登录测试

开启network服务

controller:

bash 复制代码
[root@controller ~]# systemctl start network
[root@controller ~]# systemctl enable network
network.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable network

compute:

bash 复制代码
[root@compute ~]# systemctl start network
[root@compute ~]# systemctl enable network
network.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable network

配置OpenStack命令补全

bash 复制代码
#将命令写入到/etc/bash_completion.d/,路径一定要写正确
[root@controller ~]# openstack complete >> /etc/bash_completion.d/complete
The 'openstack bgp speaker show dragents' CLI is deprecated and will be removed in the future. Use 'openstack bgp dragent list' CLI instead.

关机拍快照

openstack_controller和openstack_compute两个拍摄快照

至此安装结束

ting: /usr/lib/systemd/systemd-sysv-install enable network

复制代码
### 配置OpenStack命令补全

```bash
#将命令写入到/etc/bash_completion.d/,路径一定要写正确
[root@controller ~]# openstack complete >> /etc/bash_completion.d/complete
The 'openstack bgp speaker show dragents' CLI is deprecated and will be removed in the future. Use 'openstack bgp dragent list' CLI instead.

关机拍快照

openstack_controller和openstack_compute两个拍摄快照

外链图片转存中...(img-euhNGvlr-1779065814189)

至此安装结束

相关推荐
qingfeng154157 小时前
企业微信消息监听实战:如何实时接收客户消息回调?
人工智能·python·自动化·企业微信
砺星Leetx7 小时前
砺星伺服压机整线18台落地某头部新能源车企电驱动产线,轴承压装CT从13秒降至8秒
机器人·自动化·汽车·制造
xiaoye-duck7 小时前
《Linux系统编程》Linux基础开发工具 (二):详解自动化构建 make / Makefile
linux
cui_ruicheng7 小时前
Linux网络编程(五):基于UDP实现DictServer
linux·服务器·网络·udp
Terasic友晶科技8 小时前
答疑解惑|为DE25-Nano开发板配置Linux kernel时.config文件没有起作用是什么原因?
linux·服务器·fpga开发·linux kernel·de25-nano
爱写代码的小朋友8 小时前
基于多约束遗传算法的中小学排座位优化模型研究
linux·人工智能·算法
ccice018 小时前
硬核实战:调用Gemini多模态管道,直击办公中的图表解析、发票识别与自动化脚本生成(国内镜像免费方案)
运维·自动化
DFT计算杂谈8 小时前
VASP新手入门: IVDW 色散修正参数
linux·运维·服务器·python·算法
楼兰公子9 小时前
《深入理解Linux网络技术内幕》配套学习大纲 + 源码Demo + 进阶实战实例
linux·arm开发·学习