1、前期准备与节点规划
- 使用搭建的操作系统是:
CentOS-7-x86_64-DVD-1804.iso
- 使用搭建的镜像是:
chinaskills_cloud_iaas.iso
- 使用远程连接的工具是:
xshell
- 搭建方式:使用两台先电云计算服务器进行搭建,一个作为控制节点。另一个作为计算节点。
- 节点网络规划
节点 | 内网IP地址 | 外网IP地址 |
controller | 192.168.1.10 | 192.168.101.10 |
compute | 192.168.1.20 | 192.168.101.20 |
注意:IP地址根据实际组网情况进行填写配置
2、基础环境配置与说明
云计算IaaS控制节点 | 云计算IaaS计算节点 |
Keystone安全认证服务 | |
Glance镜像服务 | |
Nova计算控制服务 | Nova Compute计算服务 |
Dashboard管理界面 | |
Neutron Server网络服务 | Neutron节点网络服务 |
Cinder存储控制服务 | Cinder Volume存储服务 |
Rabbit消息服务 | |
Mysql数据库 |
Swift 代理服务 | Swift 存储服务 |
Heat编配服务 | |
Ceilometer 监控服务 | Ceilometer监控代理 |
说明:存储节点安装操作系统时需划分两个空白分区,作为cinder和swift存储磁盘搭建 ftp服务器作为搭建云平台的yum源。
3、安装centos7.5操作系统与说明
参考之前搭建先电v2.2版本的博客:
安装CentOS7 说明与操作步骤(以controller节点为例)
4、 配置网络、主机名(controller、compute)
通过xShell
远程连接工具连接【controller
】节点和【compute
】节点,即控制节点和计算节点。
【controller】
配置网络信息。修改相关参数信息。
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=enp8s0 DEVICE=enp8s0 ONBOOT=yes IPADDR=192.168.1.10 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=192.168.1.1 [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp9s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=enp9s0 DEVICE=enp9s0 ONBOOT=yes IPADDR=192.168.101.10 NETMASK=255.255.255.0 GATEWAY=192.168.101.1 DNS1=192.168.101.1 [root@controller ~]# [root@controller ~]# ip address 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: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 0c:c4:7a:7c:6d:16 brd ff:ff:ff:ff:ff:ff inet 192.168.1.10/24 brd 192.168.1.255 scope global noprefixroute enp8s0 valid_lft forever preferred_lft forever inet6 fe80::ec4:7aff:fe7c:6d16/64 scope link valid_lft forever preferred_lft forever 3: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 0c:c4:7a:7c:6d:17 brd ff:ff:ff:ff:ff:ff inet 192.168.101.10/24 brd 192.168.101.255 scope global noprefixroute enp9s0 valid_lft forever preferred_lft forever inet6 fe80::ec4:7aff:fe7c:6d17/64 scope link valid_lft forever preferred_lft forever [root@controller ~]# [root@controller ~]# ping -c 5 www.baidu.com PING www.a.shifen.com (180.101.49.11) 56(84) bytes of data. 64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=49 time=8.34 ms 64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=49 time=8.29 ms 64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=49 time=8.34 ms 64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=4 ttl=49 time=8.22 ms 64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=5 ttl=49 time=8.18 ms --- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 8.184/8.278/8.348/0.132 ms [root@controller ~]#
配置控制节点的主机名
[root@controller ~]# hostnamectl set-hostname controller [root@controller ~]# bash [root@controller ~]# hostnamectl Static hostname: controller Icon name: computer-desktop Chassis: desktop Machine ID: 03ea1deb7ce84827b40dcc0cad6deba0 Boot ID: 73599f8a282c461bb30037e90d8f1702 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 ~]#
【compute】
修改计算节点的主机名
[root@localhost ~]# hostnamectl set-hostname compute [root@localhost ~]# bash [root@compute ~]# hostnamectl Static hostname: compute Icon name: computer-desktop Chassis: desktop Machine ID: 91753e2724514eeeae458d545bba8b0d Boot ID: 1be1aa57d5e8436bba0ad7d1333e099f 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 ~]#
配置计算节点的网络。并修改相关信息。
[root@compute ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp8s0 [root@compute ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp9s0 [root@compute ~]# systemctl restart network [root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp9s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=enp9s0 DEVICE=enp9s0 ONBOOT=yes IPADDR=192.168.101.20 NETMASK=255.255.255.0 GATEWAY=1921.68.101.1 DNS1=192.168.101.1 [root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=enp8s0 DEVICE=enp8s0 ONBOOT=yes IPADDR=192.168.1.20 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=192.168.1.1 [root@compute ~]# [root@compute ~]# ping -c 5 www.baidu.com PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data. 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=1 ttl=49 time=10.3 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=2 ttl=49 time=9.77 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=3 ttl=49 time=9.79 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=4 ttl=49 time=9.81 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=5 ttl=49 time=9.74 ms --- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4007ms rtt min/avg/max/mdev = 9.740/9.884/10.302/0.236 ms [root@compute ~]#
5、上传镜像并配置本地YUM源(controller、compute)
【controller】
配置【controller节点】的本地YUM源
[root@controller yum.repos.d]# ll total 32 -rw-r--r--. 1 root root 1664 Apr 29 2018 CentOS-Base.repo -rw-r--r--. 1 root root 1309 Apr 29 2018 CentOS-CR.repo -rw-r--r--. 1 root root 649 Apr 29 2018 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 Apr 29 2018 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Apr 29 2018 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Apr 29 2018 CentOS-Sources.repo -rw-r--r--. 1 root root 4768 Apr 29 2018 CentOS-Vault.repo [root@controller yum.repos.d]# mkdir bak [root@controller yum.repos.d]# mv CentOS-* bak/ [root@controller yum.repos.d]# ll total 0 drwxr-xr-x. 2 root root 187 Nov 3 10:43 bak [root@controller yum.repos.d]# mv bak /home/ [root@controller yum.repos.d]# ll total 0 [root@controller ~]# vi /etc/yum.repos.d/local.repo [root@controller ~]# cat /etc/yum.repos.d/local.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 ~]#
配置【compute节点】的本地YUM源,使用ftp的方式获取controller节点的YUM源。
[root@compute ~]# cd /etc/yum.repos.d/ [root@compute yum.repos.d]# ll total 32 -rw-r--r--. 1 root root 1664 Apr 29 2018 CentOS-Base.repo -rw-r--r--. 1 root root 1309 Apr 29 2018 CentOS-CR.repo -rw-r--r--. 1 root root 649 Apr 29 2018 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 Apr 29 2018 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Apr 29 2018 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Apr 29 2018 CentOS-Sources.repo -rw-r--r--. 1 root root 4768 Apr 29 2018 CentOS-Vault.repo [root@compute yum.repos.d]# mkdir bak [root@compute yum.repos.d]# mv CentOS-* bak/ [root@compute yum.repos.d]# ll total 0 drwxr-xr-x. 2 root root 187 Nov 3 10:43 bak [root@compute yum.repos.d]# mv bak /home/ [root@compute yum.repos.d]# ll total 0 [root@compute yum.repos.d]# vi /etc/yum.repos.d/ftp.repo [root@compute yum.repos.d]# cat /etc/yum.repos.d/ftp.repo [centos] name=centos baseurl=ftp://192.168.1.10/centos gpgcheck=0 enable=1 [openstack] name=openstack baseurl=ftp://192.168.1.10/openstack/iaas-repo gpgcheck=0 enabled=1 [root@compute yum.repos.d]#
在控制节点的/opt目录下创建centos
和openstack
目录用来挂载centos镜像和openstack镜像
【controller】
[root@controller ~]# cd /opt/ [root@controller opt]# ll total 0 [root@controller opt]# mkdir centos [root@controller opt]# mkdir openstack [root@controller opt]# ll total 0 drwxr-xr-x. 2 root root 6 Nov 3 10:50 centos drwxr-xr-x. 2 root root 6 Nov 3 10:50 openstack [root@controller opt]#
6、挂载本地YUN源
【controller】
[root@controller ~]# ll total 8075368 -rw-------. 1 root root 1463 Nov 3 09:23 anaconda-ks.cfg -rw-r--r--. 1 root root 4470079488 Nov 3 11:04 CentOS-7-x86_64-DVD-1804.iso -rw-r--r--. 1 root root 3799093248 Nov 3 11:01 chinaskills_cloud_iaas.iso [root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt/ mount: /dev/loop0 is write-protected, mounting read-only [root@controller ~]# cp -rvf /mnt/* /opt/centos/
[root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso /mnt/ mount: /dev/loop0 is write-protected, mounting read-only [root@controller ~]# cp -rvf /mnt/* /opt/openstack/
查看是否安装在指定的目录下。
[root@controller ~]# cd /opt/ [root@controller opt]# ll total 0 drwxr-xr-x. 8 root root 220 Nov 3 11:36 centos drwxr-xr-x. 4 root root 37 Nov 3 11:39 openstack [root@controller opt]# cd centos/ [root@controller centos]# ll total 320 -rw-r--r--. 1 root root 14 Nov 3 11:35 CentOS_BuildTag drwxr-xr-x. 3 root root 35 Nov 3 11:35 EFI -rw-r--r--. 1 root root 227 Nov 3 11:35 EULA -rw-r--r--. 1 root root 18009 Nov 3 11:35 GPL drwxr-xr-x. 3 root root 57 Nov 3 11:35 images drwxr-xr-x. 2 root root 198 Nov 3 11:35 isolinux drwxr-xr-x. 2 root root 43 Nov 3 11:35 LiveOS drwxr-xr-x. 2 root root 221184 Nov 3 11:36 Packages drwxr-xr-x. 2 root root 4096 Nov 3 11:36 repodata -rw-r--r--. 1 root root 1690 Nov 3 11:36 RPM-GPG-KEY-CentOS-7 -rw-r--r--. 1 root root 1690 Nov 3 11:36 RPM-GPG-KEY-CentOS-Testing-7 -r--r--r--. 1 root root 2883 Nov 3 11:36 TRANS.TBL [root@controller centos]# cd .. [root@controller opt]# cd openstack/ [root@controller openstack]# ll total 0 drwxr-xr-x. 4 root root 34 Nov 3 11:39 iaas-repo drwxr-xr-x. 2 root root 132 Nov 3 11:39 images
【controller】
测试YUM源是否配置成功。
[root@controller ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: centos openstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos [root@controller ~]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors centos | 3.6 kB 00:00:00 openstack | 2.9 kB 00:00:00 (1/3): centos/group_gz | 166 kB 00:00:00 (2/3): openstack/primary_db | 1.4 MB 00:00:00 (3/3): centos/primary_db | 3.1 MB 00:00:00 repo id repo name status centos centos 3,971 openstack openstack 3,232 repolist: 7,203 [root@controller ~]#
在controller节点上安装ftp服务
[root@controller ~]# yum install -y vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================= Installing: vsftpd x86_64 3.0.2-22.el7 centos 169 k Transaction Summary ======================================================================================================================================= Install 1 Package Total download size: 169 k Installed size: 348 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : vsftpd-3.0.2-22.el7.x86_64 1/1 Verifying : vsftpd-3.0.2-22.el7.x86_64 1/1 Installed: vsftpd.x86_64 0:3.0.2-22.el7 Complete! [root@controller ~]# vi /etc/ Display all 175 possibilities? (y or n) [root@controller ~]# vi /etc/vsftpd/vsftpd.conf [root@controller ~]# systemctl start vsftpd;systemctl enable vsftpd Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service. [root@controller ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2020-11-03 11:51:05 CST; 50s ago Main PID: 10038 (vsftpd) CGroup: /system.slice/vsftpd.service └─10038 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf Nov 03 11:51:05 controller systemd[1]: Starting Vsftpd ftp daemon... Nov 03 11:51:05 controller systemd[1]: Started Vsftpd ftp daemon. [root@controller ~]#
【compute】
[root@compute ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: centos openstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors [root@compute ~]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors centos | 3.6 kB 00:00:00 openstack | 2.9 kB 00:00:00 (1/3): centos/group_gz | 166 kB 00:00:00 (2/3): openstack/primary_db | 1.4 MB 00:00:00 (3/3): centos/primary_db | 3.1 MB 00:00:00 repo id repo name status centos centos 3,971 openstack openstack 3,232 repolist: 7,203 [root@compute ~]#