1、前期准备与说明
使用搭建openstack私用云平台的软件:VMware Workstation
使用的基础镜像:centos7.5.iso
使用搭建的iso镜像包:chinaskills_cloud_iaas.iso
网络模式选择:Flat直连模式
2、controller、compute硬件配置
【controller】
【compute】
3、controller、compute节点IP地址配置情况
主机名 | 内部网络(仅主机模式) | 外部网络(NAT模式) |
controller | 172.16.10.10 | 10.0.0.0/24 GW:10.0.0.1 |
compute | 172.16.10.20 | 10.0.0.0/24 GW:10.0.0.1 |
【controller】
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=ens32 DEVICE=ens32 ONBOOT=yes IPADDR=172.16.10.10 NETMASK=255.255.255.0 GATEWAY=172.168.10.1 [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens34 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=ens34 DEVICE=ens34 ONBOOT=yes [root@controller ~]# systemctl restart network [root@controller ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:a7:1f:53 brd ff:ff:ff:ff:ff:ff inet 172.16.10.10/24 brd 172.16.10.255 scope global noprefixroute ens32 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fea7:1f53/64 scope link valid_lft forever preferred_lft forever 3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:a7:1f:5d brd ff:ff:ff:ff:ff:ff inet6 fe80::20c:29ff:fea7:1f5d/64 scope link valid_lft forever preferred_lft forever
【compute】
[root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=ens32 DEVICE=ens32 ONBOOT=yes IPADDR=172.16.10.20 NETMASK-255.255.255.0 GATEWAY=172.16.10.1 [root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens34 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=ens34 DEVICE=ens34 ONBOOT=yes [root@compute ~]# systemctl restart network [root@compute ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:80:17:9e brd ff:ff:ff:ff:ff:ff inet 172.16.10.20/16 brd 172.16.255.255 scope global noprefixroute ens32 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe80:179e/64 scope link valid_lft forever preferred_lft forever 3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:80:17:a8 brd ff:ff:ff:ff:ff:ff inet6 fe80::20c:29ff:fe80:17a8/64 scope link valid_lft forever preferred_lft forever
4、修改主机名和主机名映射
【controller】
[root@controller ~]# hostnamectl set-hostname controller [root@controller ~]# su [root@controller ~]# hostnamectl Static hostname: controller Icon name: computer-vm Chassis: vm Machine ID: 8ecc4e2d12224707b1d93f7a18706a30 Boot ID: a4973aa4d65940baa24d801bc37c620a Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-862.el7.x86_64 Architecture: x86-64 [root@controller ~]# echo -e "172.16.10.10\tcontroller\\t172.16.10.20\tcompute" /etc/hosts 172.16.10.10 controller 172.16.10.20 compute /etc/hosts [root@controller ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.10.10 controller 172.16.10.20 compute [root@controller ~]# ping compute PING compute (172.16.10.20) 56(84) bytes of data. 64 bytes from compute (172.16.10.20): icmp_seq=1 ttl=64 time=0.444 ms 64 bytes from compute (172.16.10.20): icmp_seq=2 ttl=64 time=2.73 ms ^Z [1]+ Stopped ping compute [root@controller ~]#
【compute】
[root@compute ~]# hostnamectl set-hostname compute [root@compute ~]# su [root@compute ~]# hostnamectl Static hostname: compute Icon name: computer-vm Chassis: vm Machine ID: 8ecc4e2d12224707b1d93f7a18706a30 Boot ID: 8ab9daac3ef8496bb52ee0893f152709 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-862.el7.x86_64 Architecture: x86-64 [root@compute ~]# echo -e "172.16.10.10\tcontroller\\t172.16.10.20\tcompute" /etc/hosts 172.16.10.10 controller 172.16.10.20 compute /etc/hosts [root@compute ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.10.10 controller 172.16.10.20 compute [root@compute ~]# ping controller PING controller (172.16.10.10) 56(84) bytes of data. 64 bytes from controller (172.16.10.10): icmp_seq=1 ttl=64 time=0.222 ms 64 bytes from controller (172.16.10.10): icmp_seq=2 ttl=64 time=1.52 ms ^Z [1]+ Stopped ping controller [root@compute ~]#
5、关闭防火墙和修改SELINUX模式
【controller|compute】
<<以controller为例>>
[root@controller ~]# systemctl stop firewalld [root@controller ~]# systemctl disable firewalld [root@controller ~]# setenforce 0 setenforce: SELinux is disabled [root@controller ~]# sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config [root@controller ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=permissive # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted [root@controller ~]#
6、配置本地YUM源
【controller】
[root@controller ~]# mkdir /opt/{centos,openstack} [root@controller ~]# cd /etc/yum.repos.d/ [root@controller yum.repos.d]# ls bak http.repo [root@controller yum.repos.d]# vi http.repo [root@controller yum.repos.d]# cat http.repo [centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1 [openstack] name=openstack baseurl=file:///opt/openstack/iaas-repo gpgcheck=0 enabled=1 [root@controller yum.repos.d]#
【compute】
[root@compute ~]# cd /etc/yum.repos.d/ [root@compute yum.repos.d]# ll total 4 drwxr-xr-x. 2 root root 187 Nov 14 17:46 bak -rw-r--r--. 1 root root 181 Nov 14 17:46 http.repo [root@compute yum.repos.d]# vi http.repo [root@compute yum.repos.d]# cat http.repo [centos] name=centos baseurl=http://172.16.10.10/opt/centos gpgcheck=0 enabled=1 [openstack] name=openstack baseurl=http://172.16.10.10/opt/openstack/iaas-repo gpgcheck=0 enabled=1 [root@compute yum.repos.d]#