一、配置主机名及hosts和防火墙(只演示一台,其他机器配置方式一样)
vim /etc/hosts 加入
10.10.11.11 controller
10.10.11.12 compute1
10.10.11.13 neutron
10.10.11.14 cinder
修改主机名
hostnamectl set-hostname controller
hostnamectl set-hostname compute1
hostnamectl set-hostname neutron
hostnamectl set-hostname cinder
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
关闭网络管理NetworkManager
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
关闭selinux
# vim /etc/selinux/config
SELINUX=disabled
二、所有主机配置网卡,这里只演示controller
2.1 配置eth0 (仅限controller)
controller ~]# cd /etc/sysconfig/network-scripts/
controller network-scripts]# vim ifcfg-eth0
DEVICE="eth0"
ONBOOT="yes"
IPV6INIT="no"
IPV4_FAILURE_FATAL="no"
NM_CONTROLLED="no"
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR="10.10.10.11"
PREFIX="24"
GATEWAY="10.10.10.1"
controller network-scripts]# systemctl restart network
controller network-scripts]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.10.11 netmask 255.255.255.0 broadcast 10.10.10.255
inet6 fe80::5054:ff:fec3:e842 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:c3:e8:42 txqueuelen 1000 (Ethernet)
RX packets 1821 bytes 95276 (93.0 KiB)
RX errors 0 dropped 1785 overruns 0 frame 0
TX packets 92 bytes 6164 (6.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.2 配置eth1
controller network-scripts]# cp ifcfg-eth0 ifcfg-eth1
controller network-scripts]# vim ifcfg-eth1
DEVICE="eth1"
ONBOOT="yes"
IPV6INIT="no"
IPV4_FAILURE_FATAL="no"
NM_CONTROLLED="no"
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR="10.10.11.11"
PREFIX="24"
(GATEWAY="10.10.11.1" 非controller节点都要添加,controller不加)
controller network-scripts]# systemctl restart network
controller network-scripts]# ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.11.11 netmask 255.255.255.0 broadcast 10.10.11.255
inet6 fe80::5054:ff:fe21:6a50 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:21:6a:50 txqueuelen 1000 (Ethernet)
RX packets 2505 bytes 132478 (129.3 KiB)
RX errors 0 dropped 2353 overruns 0 frame 0
TX packets 57 bytes 3674 (3.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.3 配置eth2
controller network-scripts]# cp ifcfg-eth1 ifcfg-eth2
controller network-scripts]# vim ifcfg-eth2
DEVICE="eth2"
ONBOOT="yes"
IPV6INIT="no"
IPV4_FAILURE_FATAL="no"
NM_CONTROLLED="no"
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR="10.10.12.11"
PREFIX="24"
controller network-scripts]# systemctl restart network
controller network-scripts]# ifconfig eth2
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.12.11 netmask 255.255.255.0 broadcast 10.10.12.255
inet6 fe80::5054:ff:feaa:a8a prefixlen 64 scopeid 0x20<link>
ether 52:54:00:aa:0a:8a txqueuelen 1000 (Ethernet)
RX packets 2434 bytes 127542 (124.5 KiB)
RX errors 0 dropped 2372 overruns 0 frame 0
TX packets 64 bytes 3648 (3.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.4 查看DNS
controller network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.10.10.1
ping以下百度:证明eth0网卡已启用
controller network-scripts]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=54 time=22.0 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=54 time=22.3 ms
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 22.099/22.201/22.304/0.180 ms
2.5 检查controller网卡:
2.6 所有节点配置完成后,检测节点互通:
三、配置集群yum源
3.1 yum节点网卡配置:
yum ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
ONBOOT="yes"
IPV6INIT="no"
IPV4_FAILURE_FATAL="no"
NM_CONTROLLED="no"
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR="10.10.11.200"
PREFIX="24"
GATEWAY="10.10.11.1"
yum ~]# systemctl restart network
yum ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.11.200 netmask 255.255.255.0 broadcast 10.10.11.255
inet6 fe80::5054:ff:fefa:2719 prefixlen 64 scopeid 0x20<link>
ether 52:54:00:fa:27:19 txqueuelen 1000 (Ethernet)
RX packets 227 bytes 12116 (11.8 KiB)
RX errors 0 dropped 215 overruns 0 frame 0
TX packets 66 bytes 3732 (3.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ping controller节点:
yum ~]# ping 10.10.11.11
PING 10.10.11.11 (10.10.11.11) 56(84) bytes of data.
64 bytes from 10.10.11.11: icmp_seq=1 ttl=64 time=0.339 ms
64 bytes from 10.10.11.11: icmp_seq=2 ttl=64 time=0.255 ms
--- 10.10.11.11 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.255/0.297/0.339/0.042 ms
yum ~]# ping 10.10.11.12
PING 10.10.11.12 (10.10.11.12) 56(84) bytes of data.
64 bytes from 10.10.11.12: icmp_seq=1 ttl=64 time=0.249 ms
--- 10.10.11.12 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.249/0.249/0.249/0.000 ms
3.2 搭建FTP本地yum源:
下载163源到本地 http://mirrors.163.com/centos/7.6.1810/
yum ~]# ls /var/ftp/
dvd every extrals mini pub queens updates
这样,除了pub文件夹之外,其余都是本地yum源了
yum ~]# vim /etc/yum.repos.d/all.repo
[dvd]
name=dvd
baseurl=ftp://10.10.11.200/dvd
gpgcheck=1
enable=0
priority=3
[every]
name=every
baseurl=ftp://10.10.11.200/every
gpgcheck=0
enable=0
priority=3
[mini]
name=mini
baseurl=ftp://10.10.11.200/mini
gpgcheck=0
enable=0
priority=3
[queens]
name=queens
baseurl=ftp://10.10.11.200/queens
gpgcheck=0
enable=0
priority=1
[extrals]
name=extrals
baseurl=ftp://10.10.11.200/extrals
gpgcheck=0
enable=0
priority=3
[updates]
name=updates
baseurl=ftp://10.10.11.200/updates
gpgcheck=0
enable=0
priority=2
查看yum:
yum ~]# yum clean all
yum ~]# yum repolist | grep repolist
repolist: 18,246
3.3 其他主机同步yum源
controller ~]# rm -rf /etc/yum.repos.d/*
compute1 ~]# rm -rf /etc/yum.repos.d/*
neutron ~]# rm -rf /etc/yum.repos.d/*
cinder ~]# rm -rf /etc/yum.repos.d/*
yum ~]# cd /etc/yum.repos.d/
yum.repos.d]# ls
all.repo repo RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7
yum.repos.d]# for i in 1 2 3 4
> do
> scp all.repo RPM-GPG-KEY-CentOS-* root@10.10.11.1$i:/etc/yum.repos.d/
> done
登陆其他任何一个节点查看:
neutron ~]# yum clean all
neutron ~]# yum repolist | grep repolist
repolist: 20,097
由于怕yum源冲突及保持openstack queen yum源的优先权,每个节点安装 yum-plugin-priorities
controller ~]# yum -y install yum-plugin-priorities
其他节点也安装.
四、时间同步配置
在所有节点安装chrony
# yum install chrony –y
4.1 配置controller为时间同步服务器
controller ~]# vim /etc/chrony.conf
更新这几处:
server ntp1.aliyun.com iburst
allow 0/0
local stratum 10
controller ~]# systemctl restart chronyd
controller ~]# chronyc sources -v
^* 120.25.115.20
出现 “^*” 表示同步成功。
4.2 配置其他节点同步controller的时间同步服务(以compute为例)
compute1 ~]# vim /etc/chrony.conf
修改为:
server 10.10.11.11 iburst
compute1 ~]# chronyc sources -v
^* controller...
出现 “^*” 表示同步成功。
4.3 将所有节点的chronyd服务设为开机自启(以controller为例)
controller ~]# systemctl enable chronyd
五、安装openstack软件仓库(所有服务器)
yum安装Q版仓库(以controller为例)
controller ~]# yum -y install centos-release-openstack-queens
安装open stack client端:
controller ~]# yum install python-openstackclient -y
安装open stack的selinux(如果关闭了服务器selienx可以不装)
controller ~]# yum install openstack-selinux -y
由于我提前关闭了,所以此处我没有安装。