本文共 36274 字,大约阅读时间需要 120 分钟。
基于【国基北盛】云基础架构平台软件搭建先电IaaS平台(先电V2.4版本)
目录
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版本的博客:
4、 配置网络、主机名(controller、compute)
通过xShell
远程连接工具连接【controller
】节点和【compute
】节点,即控制节点和计算节点。
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0 TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesNAME=enp8s0DEVICE=enp8s0ONBOOT=yesIPADDR=192.168.1.10NETMASK=255.255.255.0GATEWAY=192.168.1.1DNS1=192.168.1.1[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp9s0 TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesNAME=enp9s0DEVICE=enp9s0ONBOOT=yesIPADDR=192.168.101.10NETMASK=255.255.255.0GATEWAY=192.168.101.1DNS1=192.168.101.1[root@controller ~]# [root@controller ~]# ip address1: lo: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 forever2: enp8s0: 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 forever3: enp9s0: 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.comPING 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 ms64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=49 time=8.29 ms64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=49 time=8.34 ms64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=4 ttl=49 time=8.22 ms64 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 4006msrtt 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=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesNAME=enp9s0DEVICE=enp9s0ONBOOT=yesIPADDR=192.168.101.20NETMASK=255.255.255.0GATEWAY=1921.68.101.1DNS1=192.168.101.1[root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0 TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesNAME=enp8s0DEVICE=enp8s0ONBOOT=yesIPADDR=192.168.1.20NETMASK=255.255.255.0GATEWAY=192.168.1.1DNS1=192.168.1.1[root@compute ~]# [root@compute ~]# ping -c 5 www.baidu.comPING 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 ms64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=2 ttl=49 time=9.77 ms64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=3 ttl=49 time=9.79 ms64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=4 ttl=49 time=9.81 ms64 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 4007msrtt 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]# lltotal 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]# lltotal 0drwxr-xr-x. 2 root root 187 Nov 3 10:43 bak[root@controller yum.repos.d]# mv bak /home/[root@controller yum.repos.d]# lltotal 0[root@controller ~]# vi /etc/yum.repos.d/local.repo [root@controller ~]# cat /etc/yum.repos.d/local.repo [centos]name=centosbaseurl=file:///opt/centosgpgcheck=0enabled=1[openstack]name=openstackbaseurl=file:///opt/openstack/iaas-repogpgcheck=0enabled=1[root@controller ~]#
配置【compute节点】的本地YUM源,使用ftp的方式获取controller节点的YUM源。
[root@compute ~]# cd /etc/yum.repos.d/[root@compute yum.repos.d]# lltotal 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]# lltotal 0drwxr-xr-x. 2 root root 187 Nov 3 10:43 bak[root@compute yum.repos.d]# mv bak /home/[root@compute yum.repos.d]# lltotal 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=centosbaseurl=ftp://192.168.1.10/centosgpgcheck=0enable=1[openstack]name=openstackbaseurl=ftp://192.168.1.10/openstack/iaas-repogpgcheck=0enabled=1[root@compute yum.repos.d]#
在控制节点的/opt目录下创建centos
和openstack
目录用来挂载centos镜像和openstack镜像
[root@controller ~]# cd /opt/[root@controller opt]# lltotal 0[root@controller opt]# mkdir centos[root@controller opt]# mkdir openstack[root@controller opt]# lltotal 0drwxr-xr-x. 2 root root 6 Nov 3 10:50 centosdrwxr-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]# lltotal 0drwxr-xr-x. 8 root root 220 Nov 3 11:36 centosdrwxr-xr-x. 4 root root 37 Nov 3 11:39 openstack[root@controller opt]# cd centos/[root@controller centos]# lltotal 320-rw-r--r--. 1 root root 14 Nov 3 11:35 CentOS_BuildTagdrwxr-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 GPLdrwxr-xr-x. 3 root root 57 Nov 3 11:35 imagesdrwxr-xr-x. 2 root root 198 Nov 3 11:35 isolinuxdrwxr-xr-x. 2 root root 43 Nov 3 11:35 LiveOSdrwxr-xr-x. 2 root root 221184 Nov 3 11:36 Packagesdrwxr-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]# lltotal 0drwxr-xr-x. 4 root root 34 Nov 3 11:39 iaas-repodrwxr-xr-x. 2 root root 132 Nov 3 11:39 images
【controller】
测试YUM源是否配置成功。[root@controller ~]# yum clean allLoaded plugins: fastestmirrorCleaning repos: centos openstackCleaning up everythingMaybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos[root@controller ~]# yum repolistLoaded plugins: fastestmirrorDetermining fastest mirrorscentos | 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 statuscentos centos 3,971openstack openstack 3,232repolist: 7,203[root@controller ~]#
在controller节点上安装ftp服务
[root@controller ~]# yum install -y vsftpdLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileResolving Dependencies--> Running transaction check---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================================= Package Arch Version Repository Size=======================================================================================================================================Installing: vsftpd x86_64 3.0.2-22.el7 centos 169 kTransaction Summary=======================================================================================================================================Install 1 PackageTotal download size: 169 kInstalled size: 348 kDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning 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 vsftpdCreated 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.confNov 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 allLoaded plugins: fastestmirrorCleaning repos: centos openstackCleaning up everythingMaybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed reposCleaning up list of fastest mirrors[root@compute ~]# yum repolistLoaded plugins: fastestmirrorDetermining fastest mirrorscentos | 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 statuscentos centos 3,971openstack openstack 3,232repolist: 7,203[root@compute ~]#
7、配置域名解析
【controller】
[root@controller ~]# vi /etc/hosts[root@controller ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.1.10 controller192.168.1.20 compute[root@controller ~]#
【compute】
[root@compute ~]# vi /etc/hosts[root@compute ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.1.10 controller192.168.1.20 compute[root@compute ~]#
8、关闭防火墙和修改SELINUX安全模式
【controller、compute】
以compute节点为例,compute节点进行相同操作即可
关闭防火墙并设置防火墙开机不自启 [root@controller ~]# systemctl stop firewalld;systemctl disable firewalldRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.[root@controller ~]#
修改SELINUX安全模式(临时修改、永久修改)
(准确的来说,permissive
是允许放行通过,即发出警告⚠但不阻止🚫;disabled是关闭SELINUX安全模式,既不发出安全警告,也不阻止。) [root@controller ~]# setenforce 0 #临时关闭SELINUX[root@controller ~]# getenforce # 查询SELINUX模式Permissive[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 ~]#
同理,compute节点进行以上相同操作即可。
9、在【compute】节点上进行空白分区的划分,cinder存储和swift存储。
首先划出一整块磁盘空间,再进行分区。
[root@compute ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 1.7T 0 disk ├─sda1 8:1 0 500M 0 part /boot├─sda2 8:2 0 32G 0 part [SWAP]└─sda3 8:3 0 1T 0 part /[root@compute ~]# fdisk /dev/sdaThe device presents a logical sector size that is smaller thanthe physical sector size. Aligning to a physical sector (or optimalI/O) size boundary is recommended, or performance may be impacted.Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/sda: 1798.8 GB, 1798752436224 bytes, 3513188352 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: dosDisk identifier: 0x000915c2 Device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 68134911 33554432 82 Linux swap / Solaris/dev/sda3 68134912 2215618559 1073741824 83 LinuxCommand (m for help): nPartition type: p primary (3 primary, 0 extended, 1 free) e extendedSelect (default e): pSelected partition 4First sector (2215618560-3513188351, default 2215618560): Using default value 2215618560Last sector, +sectors or +size{ K,M,G} (2215618560-3513188351, default 3513188351): +500GPartition 4 of type Linux and of size 500 GiB is setCommand (m for help): pDisk /dev/sda: 1798.8 GB, 1798752436224 bytes, 3513188352 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: dosDisk identifier: 0x000915c2 Device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 68134911 33554432 82 Linux swap / Solaris/dev/sda3 68134912 2215618559 1073741824 83 Linux/dev/sda4 2215618560 3264194559 524288000 83 LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.[root@compute ~]# partprobe /dev/sda[root@compute ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 1.7T 0 disk ├─sda1 8:1 0 500M 0 part /boot├─sda2 8:2 0 32G 0 part [SWAP]├─sda3 8:3 0 1T 0 part /└─sda4 8:4 0 500G 0 part [root@compute ~]#
再进入到sda4磁盘,进行分区。cinder存储和swift存储。
[root@compute ~]# fdisk /dev/sda4The device presents a logical sector size that is smaller thanthe physical sector size. Aligning to a physical sector (or optimalI/O) size boundary is recommended, or performance may be impacted.Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/sda4: 500.0 GB, 500000882688 bytes, 976564224 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: dosDisk identifier: 0x5a385372 Device Boot Start End Blocks Id System`/dev/sda4p1` 2048 419432447 209715200 83 Linux`/dev/sda4p2` 419432448 838862847 209715200 83 LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 22: Invalid argument.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.[root@compute ~]# partprobe /dev/sda
10、编辑环境变量(controller、compute)
【controller、compute】
[root@controller ~]# yum install -y iaas-xiandian[root@compute ~]# yum install -y iaas-xiandian[root@compute ~]# yum install -y iaas-xiandianLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileResolving Dependencies--> Running transaction check---> Package iaas-xiandian.x86_64 0:2.4-2 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================================= Package Arch Version Repository Size=======================================================================================================================================Installing: iaas-xiandian x86_64 2.4-2 openstack 19 kTransaction Summary=======================================================================================================================================Install 1 PackageTotal download size: 19 kInstalled size: 81 kDownloading packages:iaas-xiandian-2.4-2.x86_64.rpm | 19 kB 00:00:00 Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : iaas-xiandian-2.4-2.x86_64 1/1 Verifying : iaas-xiandian-2.4-2.x86_64 1/1 Installed: iaas-xiandian.x86_64 0:2.4-2 Complete![root@compute ~]#
openrc.sh配置文件如下。
【controller】[root@controller ~]# vi /etc/xiandian/openrc.sh [root@controller ~]# cat /etc/xiandian/openrc.sh #--------------------system Config--------------------###Controller Server Manager IP. example:x.x.x.xHOST_IP=192.168.1.10#Controller HOST Password. example:000000 HOST_PASS=000000#Controller Server hostname. example:controllerHOST_NAME=controller#Compute Node Manager IP. example:x.x.x.xHOST_IP_NODE=192.168.1.20#Compute HOST Password. example:000000 HOST_PASS_NODE=000000#Compute Node hostname. example:computeHOST_NAME_NODE=compute#--------------------Chrony Config-------------------###Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24)network_segment_IP=192.168.1.0/24#--------------------Rabbit Config ------------------###user for rabbit. example:openstackRABBIT_USER=openstack#Password for rabbit user .example:000000RABBIT_PASS=000000#--------------------MySQL Config---------------------###Password for MySQL root user . exmaple:000000DB_PASS=000000#--------------------Keystone Config------------------###Password for Keystore admin user. exmaple:000000DOMAIN_NAME=demoADMIN_PASS=000000DEMO_PASS=000000#Password for Mysql keystore user. exmaple:000000KEYSTONE_DBPASS=000000#--------------------Glance Config--------------------###Password for Mysql glance user. exmaple:000000GLANCE_DBPASS=000000#Password for Keystore glance user. exmaple:000000GLANCE_PASS=000000#--------------------Nova Config----------------------###Password for Mysql nova user. exmaple:000000NOVA_DBPASS=000000#Password for Keystore nova user. exmaple:000000NOVA_PASS=000000#--------------------Neturon Config-------------------###Password for Mysql neutron user. exmaple:000000NEUTRON_DBPASS=000000#Password for Keystore neutron user. exmaple:000000NEUTRON_PASS=000000#metadata secret for neutron. exmaple:000000METADATA_SECRET=000000#Tunnel Network Interface. example:x.x.x.xINTERFACE_IP=192.168.1.10#External Network Interface. example:eth1INTERFACE_NAME=enp9s0#External Network The Physical Adapter. example:providerPhysical_NAME=provider#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101minvlan=1#Last Vlan ID in VLAN RANGE for VLAN Network. example:200maxvlan=200#--------------------Cinder Config--------------------###Password for Mysql cinder user. exmaple:000000CINDER_DBPASS=000000#Password for Keystore cinder user. exmaple:000000CINDER_PASS=000000#Cinder Block Disk. example:md126p3BLOCK_DISK=sda4p1#--------------------Swift Config---------------------###Password for Keystore swift user. exmaple:000000SWIFT_PASS=000000#The NODE Object Disk for Swift. example:md126p4.OBJECT_DISK=sda4p2#The NODE IP for Swift Storage Network. example:x.x.x.x.STORAGE_LOCAL_NET_IP=192.168.1.20#--------------------Heat Config----------------------###Password for Mysql heat user. exmaple:000000HEAT_DBPASS=000000#Password for Keystore heat user. exmaple:000000HEAT_PASS=000000#--------------------Zun Config-----------------------###Password for Mysql Zun user. exmaple:000000ZUN_DBPASS=000000#Password for Keystore Zun user. exmaple:000000ZUN_PASS=000000#Password for Mysql Kuryr user. exmaple:000000KURYR_DBPASS=000000#Password for Keystore Kuryr user. exmaple:000000KURYR_PASS=000000#--------------------Ceilometer Config----------------###Password for Gnocchi ceilometer user. exmaple:000000CEILOMETER_DBPASS=000000#Password for Keystore ceilometer user. exmaple:000000CEILOMETER_PASS=000000#--------------------AODH Config----------------###Password for Mysql AODH user. exmaple:000000AODH_DBPASS=000000#Password for Keystore AODH user. exmaple:000000AODH_PASS=000000#--------------------Barbican Config----------------###Password for Mysql Barbican user. exmaple:000000BARBICAN_DBPASS=000000#Password for Keystore Barbican user. exmaple:000000BARBICAN_PASS=000000[root@controller ~]#
[root@controller ~]# scp /etc/xiandian/openrc.sh 192.168.1.20:/etc/xiandian/openrc.shThe authenticity of host '192.168.1.20 (192.168.1.20)' can't be established.ECDSA key fingerprint is SHA256:Gwi9FGsddkAOsnxzxoJKmgLRFE+ZHKV8HhOfsupYapA.ECDSA key fingerprint is MD5:e6:e9:42:34:5f:b9:57:7c:7c:db:02:60:3b:14:f3:ac.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.1.20' (ECDSA) to the list of known hosts.root@192.168.1.20's password: openrc.sh 100% 3812 1.5MB/s 00:00 [root@controller ~]#
【compute】
将从控制节点传输过来的openrc.sh配置文件进行修改,修改内容如下。#Tunnel Network Interface. example:x.x.x.xINTERFACE_IP=192.168.1.20
11、执行相关脚本安装各个组件服务
(1)通过脚本安装服务
【controller】
[root@controller ~]# iaas-pre-host.sh [root@controller ~]# reboot【compute】
[root@compute ~]# iaas-pre-host.sh [root@compute ~]# reboot(2)通过脚本安装数据库服务
【controller】
[root@controller ~]# iaas-install-mysql.sh【compute】
[root@compute ~]# yum -y install MySQL-python(3)通过脚本安装keystone服务
【controller】
[root@controller ~]# iaas-install-keystone.sh(4)通过脚本安装glance服务
【controller】
[root@controller ~]# iaas-install-glance.sh上传镜像并使用命令查询是否上传成功
[root@controller ~]# cd /opt/openstack/images/[root@controller images]# lltotal 1539152-rw-r--r--. 1 root root 283181056 Nov 3 11:39 CentOS_6.5_x86_64_XD.qcow2-rw-r--r--. 1 root root 381696512 Nov 3 11:39 CentOS7_1804.tar-rw-r--r--. 1 root root 400752640 Nov 3 11:39 CentOS_7.2_x86_64_XD.qcow2-rw-r--r--. 1 root root 510459904 Nov 3 11:39 CentOS_7.5_x86_64_XD.qcow2[root@controller images]# source /etc/keystone/admin-openrc.sh [root@controller images]# glance image-create --name "centos7.5" --disk-format qcow2 --container-format bare --progress < CentOS_7.5_x86_64_XD.qcow2 [=============================>] 100%+------------------+--------------------------------------+| Property | Value |+------------------+--------------------------------------+| checksum | 3d3e9c954351a4b6953fd156f0c29f5c || container_format | bare || created_at | 2020-11-03T06:20:20Z || disk_format | qcow2 || id | d0122867-8ac2-444b-9c9f-556ede05e9f4 || min_disk | 0 || min_ram | 0 || name | centos7.5 || owner | 25e184cdfaf44d29b11d9b435293253f || protected | False || size | 510459904 || status | active || tags | [] || updated_at | 2020-11-03T06:20:23Z || virtual_size | None || visibility | shared |+------------------+--------------------------------------+[root@controller images]# glance image-create --name "centos7.2" --disk-format qcow2 --container-format bare --progress < CentOS_7.2_x86_64_XD.qcow2 [=============================>] 100%+------------------+--------------------------------------+| Property | Value |+------------------+--------------------------------------+| checksum | ea197f4c679b8e1ce34c0aa70ae2a94a || container_format | bare || created_at | 2020-11-03T06:20:40Z || disk_format | qcow2 || id | 428e4940-fc03-484f-96e2-4b8d5310e372 || min_disk | 0 || min_ram | 0 || name | centos7.2 || owner | 25e184cdfaf44d29b11d9b435293253f || protected | False || size | 400752640 || status | active || tags | [] || updated_at | 2020-11-03T06:20:42Z || virtual_size | None || visibility | shared |+------------------+--------------------------------------+[root@controller images]# glance image-create --name "centos6.5" --disk-format qcow2 --container-format bare --progress < CentOS_6.5_x86_64_XD.qcow2 [=============================>] 100%+------------------+--------------------------------------+| Property | Value |+------------------+--------------------------------------+| checksum | 3e565ace16066679ea363dde5411ed25 || container_format | bare || created_at | 2020-11-03T06:20:58Z || disk_format | qcow2 || id | 6a3333a2-0125-4654-bbb3-d9004ace3788 || min_disk | 0 || min_ram | 0 || name | centos6.5 || owner | 25e184cdfaf44d29b11d9b435293253f || protected | False || size | 283181056 || status | active || tags | [] || updated_at | 2020-11-03T06:21:44Z || virtual_size | None || visibility | shared |+------------------+--------------------------------------+[root@controller images]# glance image-list+--------------------------------------+-----------+| ID | Name |+--------------------------------------+-----------+| 6a3333a2-0125-4654-bbb3-d9004ace3788 | centos6.5 || 428e4940-fc03-484f-96e2-4b8d5310e372 | centos7.2 || d0122867-8ac2-444b-9c9f-556ede05e9f4 | centos7.5 |+--------------------------------------+-----------+[root@controller images]# openstack image list+--------------------------------------+-----------+--------+| ID | Name | Status |+--------------------------------------+-----------+--------+| 6a3333a2-0125-4654-bbb3-d9004ace3788 | centos6.5 | active || 428e4940-fc03-484f-96e2-4b8d5310e372 | centos7.2 | active || d0122867-8ac2-444b-9c9f-556ede05e9f4 | centos7.5 | active |+--------------------------------------+-----------+--------+[root@controller images]#
(5)通过脚本安装nova服务
【controller】
[root@controller ~]# iaas-install-nova-controller.sh【compute】
[root@compute ~]# iaas-install-nova-compute.sh(6)通过脚本安装neutron服务
【controller】
[root@controller ~]# iaas-install-neutron-controller.sh【compute】
[root@compute ~]# iaas-install-neutron-compute.sh
注意:使用真实服务器搭建的话,网络模式选择vlan模式;使用虚拟机搭建的话,网络模式选择flat模式。
(7)通过脚本安装dashboard服务
【controller】
[root@controller ~]# iaas-install-dashboard.sh(8)通过脚本安装Cinder服务
【controler】
[root@controller ~]# iaas-install-cinder-controller.sh【compute】
[root@compute ~]# iaas-install-cinder-compute.sh(9)通过脚本安装Swift服务
【controller】
[root@controller ~]# iaas-install-swift-controller.sh【compute】
[root@compute ~]# iaas-install-swift-compute.sh(10)通过脚本安装heat服务
【controller】
[root@controller ~]# iaas-install-heat.sh(11)通过脚本安装Zun服务
【controller】
[root@controller ~]# iaas-install-zun-controller.sh【compute】
[root@compute ~]# iaas-install-zun-compute.sh(12)通过脚本安装Ceilometer服务
【controller】
[root@controller ~]# iaas-install-ceilometer-controller.sh【compute】
[root@compute~]# iaas-install-ceilometer-compute.sh(13)通过脚本安装Aodh服务
【controller】
[root@controller ~]# iaas-install-aodh.sh12、添加控制节点资源到云平台
【controller】
修改openrc.sh 把compute节点的IP地址和主机名改为controller节点的IP和主机名在控制节点运行iaas-install-nova-compute.sh
执行过程中需要确认登录controller节点和输入controller节点root用户密码。修改openrc.sh配置文件
#Compute Node Manager IP. example:x.x.x.xHOST_IP_NODE=192.168.1.10#Compute Node hostname. example:computeHOST_NAME_NODE=controller
[root@controller ~]# iaas-install-nova-compute.shCreated symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.Pseudo-terminal will not be allocated because stdin is not a terminal.The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.ECDSA key fingerprint is SHA256:rX1rbCElY3mREAkrNRYC+yob0sFY+VyQAoUxPHPZucs.ECDSA key fingerprint is MD5:18:11:82:84:98:8b:fd:3d:58:df:18:82:f7:a5:2e:50.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.root@192.168.1.10's password: +----+--------------+------------+------+---------+-------+----------------------------+| ID | Binary | Host | Zone | Status | State | Updated At |+----+--------------+------------+------+---------+-------+----------------------------+| 10 | nova-compute | compute | nova | enabled | up | 2020-11-03T07:34:09.000000 || 11 | nova-compute | controller | nova | enabled | up | 2020-11-03T07:34:09.000000 |+----+--------------+------------+------+---------+-------+----------------------------+Found 2 cell mappings.Skipping cell0 since it does not contain hosts.Getting computes from cell 'cell1': b7e5c36e-d44d-4886-b756-7f37fe2bff2dChecking host mapping for compute host 'controller': a35af4bb-d210-4e8e-a2eb-1ed65fd439d9Creating host mapping for compute host 'controller': a35af4bb-d210-4e8e-a2eb-1ed65fd439d9Found 1 unmapped computes in cell: b7e5c36e-d44d-4886-b756-7f37fe2bff2d
13、登录web界面
输入http://192.168.1.10/dasboard
至此,IaaS搭建完成。转载地址:https://blog.csdn.net/qq_45392321/article/details/109462967 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!