安装 OpenStack
虚拟主机
- CentOS Stream 8
- controller 1 台 4U8G、computer 1 台 4U8G
- 虚拟机的 CPU 需要开启虚拟化选项
基本配置
在 controller 和 computer 上都要设置
# 关闭防火墙
systemctl disable --now firewalld
# 关闭 SELinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# 关闭 SWAP
sed -i "s/^[^#].*swap/#&/g" /etc/fstab
# 重启
reboot
然后 ip a
查看一下本机的 IP 以及相应网卡,ip r
查看本机网关:
通过 nmcli
设置静态 IP,以上图内容为例:
nmcli con mod eth0 \
ipv4.method manual \
ipv4.addresses 10.0.0.251/24 \
ipv4.gateway 10.0.0.1 \
ipv4.dns 114.114.114.114 \
connection.autoconnect yes
nmcli con down eth0
nmcli con up eth0
接着是配置 hosts,我的 computer 主机的 IP 是 10.0.0.252,因此:
echo "10.0.0.251 controller" >> /etc/hosts
echo "10.0.0.252 computer" >> /etc/hosts
接着配置两台机器时钟同步:
yum install -y chrony.x86_64
vi /etc/chrony.conf
systemctl restart chronyd
systemctl enable chronyd
controller上的内容
... ...
# Allow NTP client access from local network.
# 例如,allow 192.168.100.0/24
allow 10.0.0.0/24
... ...
computer上的内容
# Use public servers from the pool.ntp.org project
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# pool 2.centos.pool.ntp.org iburst
server controller iburst
接着配置 YUM 仓库:
yum install -y centos-release-openstack-victoria.noarch
yum config-manager --set-enabled powertools
yum clean all && yum makecache
安装/部署/搭建 OpenStack
在 controller 主机上操作:
yum install -y openstack-packstack
packstack --gen-answer-file=clouds.txt
vi clouds.txt
packstack --answer-file=clouds.txt
clouds.txt
60 CONFIG_HEAT_INSTALL=y
97 CONFIG_COMPUTE_HOSTS=10.0.0.251,10.0.0.252
323 CONFIG_KEYSTONE_ADMIN_PW=123456
909 CONFIG_NEUTRON_OVN_BRIDGE_IFACES=br-ex:eth0
1169 CONFIG_PROVISION_DEMO=n
完成后需要在两台主机上禁用 NetworkManager
服务,并开启 network
服务:
systemctl disable --now NetworkManager
systemctl enable --now network
按照提示访问在浏览器访问 controller,即可看到登陆界面,用户名/密码:admin/123456。