第三章 预配置

  以下配置在所有节点进行,为后面的openstack安装做好准备。
1、配置主机网络
因为我个人使用的事桌面版,系统存在两套网络管理服务,为了避免冲突,在此禁用NetworkManager服务,保留systemd-networkd服务。
systemctl stop NetworkManager # 关闭桌面版的网络管理服务
systemctl disable NetworkManager # 禁止开机启动
systemctl status NetworkManager  # 检查看是否已经停止
# 编辑文件
vim /etc/NetworkManager/nm-system-settings.conf
# 修改以下内容
managed=false
# 设置服务
systemctl restart systemd-networkd # 启用systemd-networkd服务
systemctl enable systemd-networkd # 开机启动
systemctl status NetworkManager  # 检查看是否已经启动

# 以下主机IP地址配置使用netplan来管理,其实底层是调用systemd-networkd服务
# 编辑文件(此以控制节点为例)
vi /etc/netplan/01-network-manager-all.yaml
# 修改内容如下
# Let systemd-networkd manage all devices on this system
network:
  version: 2
  renderer: networkd   # 这里需要记得改改过来
  ethernets:
# API network
    enp1s0f0:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.222.29/24]  # 注意好缩进
# Storage network                    # 此处配置是因为glance放在了控制节点
    enp1s0f1:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.220.29/24]   # 针对需要存储网络的节点配置,计算节点和块节点
# External network
    enp1s0f3:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.44.109/24]
    gateway4:192.168.44.254 # 配置网关,这里根据个人实际情况确定
     nameservers:
        addresses: [192.168.1.244,192.168.1.245] # 配置DNS,这里根据个人实际情况确定其余主机进行一样的操作。

2、配置主机名

hostnamectl set-hostname controller # 设置主机名
reboot                              # 重启生效

# 如果还不能成功,进行一下步骤(可选)
# 编辑文件
vi /etc/cloud/cloud.cfg
# 修改内容如下
preserve_hostname: false
# 再次设置主机名
hostnamectl set-hostname controller               # 设置主机名
reboot                                            # 重启生效

3、编辑hosts文件

# 编辑文件
vi /etc/hosts
# 添加内容如下
192.168.222.29 controller1
192.168.222.26 neutron1
192.168.222.27 compute1
192.168.222.28 compute2
192.168.222.25 cinder1

4、添加apt阿里镜像源

# 编辑文件,先对源文件做好备份
vi /etc/apt/sources.list  
# 修改如下
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# 执行更新
apt-get update 

5、配置时间同步

apt install ntp
# 编辑文件
vi /etc/ntp.conf
# 主要修改如下
# more information.
#pool 0.ubuntu.pool.ntp.org iburst   # 全部注释
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.    #pool ntp.ubuntu.com                    # 注释
restrict 192.168.222.0 mask 255.255.255.0 nomodify notrap  #  允许API网同步
server 127.127.1.0                      # 改成这样
fudge 127.127.1.0 stratum 8        # 改成这样
# 启动服务
systemctl restart ntp    
systemctl enable ntp   # 开机自启动
ntpq -p                        # 检查

其余节点配置:

apt install ntp
# 编辑文件
vi /etc/ntp.conf
# 主要修改如下
# more information.
#pool 0.ubuntu.pool.ntp.org iburst   # 全部注释
#pool 1.ubuntu.pool.ntp.org iburst
#pool 2.ubuntu.pool.ntp.org iburst
#pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp server as a fallback.    #pool ntp.ubuntu.com                    # 注释
server 192.168.222.29 iburst           # 末尾增加
# 启动服务
systemctl restart ntp   
systemctl enable ntp   # 开机自启动
ntpq -p                        # 检查

6、添加openstack源

apt -y install software-properties-common
add-apt-repository cloud-archive:stein  # 添加软件仓库,其余版本可以写stein,rocky,queens
apt update                # 检查更新
apt upgrade -y          # 软件包升级
# 还可进行后台升级
nohup apt upgrade -y &        #放在后台升级,更人性化,推荐做法,不管终端连接终端还是ctrl+C都不会中断,可以killall停止
 

猜你喜欢

转载自www.cnblogs.com/shihongkuan/p/11399075.html