使用VMware Workstation搭建先电IaaS2.4云平台

使用VMware Workstation搭建先电IaaS2.4云平台

实施步骤
  • 使用VMware Workstation搭建先电IaaS2.4云平台
    • 1、前期准备与说明
    • 2、controller、compute硬件配置
    • 3、controller、compute节点IP地址配置情况
    • 4、修改主机名和主机名映射
    • 5、关闭防火墙和修改SELINUX模式
    • 6、配置本地YUM源
    • 7、上传所需镜像文件并进行挂载测试
    • 8、YUM源安装并修改opensrc.sh配置文件
    • 9、执行相关服务部署脚本
    • 10、登录Dashboard管理控制平台
    • 11、可选服务补充搭建

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】

代码语言:javascript
复制
[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】

代码语言:javascript
复制
[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】

代码语言:javascript
复制
[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】

代码语言:javascript
复制
[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为例>>

代码语言:javascript
复制
[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】

代码语言:javascript
复制
[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】

代码语言:javascript
复制
[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]#

7、上传所需镜像文件并进行挂载测试

【controller】

代码语言:javascript
复制
[root@controller ~]# ll
total 8075368
-rw-------. 1 root root 1381 Oct 18 14:22 anaconda-ks.cfg
-rw-r--r--. 1 root root 4470079488 Nov 14 17:53 CentOS-7-x86_64-DVD-1804.iso
-rw-r--r--. 1 root root 3799093248 Nov 14 18:00 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 -rf /mnt/* /opt/centos/
[root@controller ~]# umount /mnt/

[root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso /mnt/
mount: /dev/loop0 is write-protected, mounting read-only
[root@controller ~]# cp -rf /mnt/* /opt/openstack/
[root@controller ~]# umount /mnt/

测试镜像是否设置成功

代码语言:javascript
复制
[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/primary_db | 3.1 MB 00:00:00
(2/3): centos/group_gz | 166 kB 00:00:00
(3/3): openstack/primary_db | 1.4 MB 00:00:00
repo id repo name statuscentos centos 3,971
openstack openstack 3,232
repolist: 7,203
[root@controller ~]#

安装http服务

代码语言:javascript
复制
[root@controller ~]# yum install -y httpd
[root@controller ~]# systemctl start httpd && systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@controller ~]# ln -s /opt/ /var/www/html/
[root@controller ~]# cd /var/www/html/
[root@controller html]# ll
total 0
lrwxrwxrwx 1 root root 5 Nov 15 02:30 opt -> /opt/
[root@controller html]#

在这里插入图片描述


【compute】

代码语言:javascript
复制
[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
[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 statuscentos centos 3,971
openstack openstack 3,232
repolist: 7,203
[root@compute ~]#

8、YUM源安装并修改opensrc.sh配置文件

【controller】
[root@controller ~]# yum install -y iaas-xiandian
[root@controller ~]# vi /etc/xiandian/openrc.sh
在命令模式下执行此命令:%s/^.//g用于删除#
在命令模式下执行此命令:%s/PASS=/PASS=000000/g用于编写PASS
在编辑模式下,按q进入到命令模式

代码语言:javascript
复制
[root@controller ~]# cat /etc/xiandian/openrc.sh
#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=172.16.10.10

#Controller HOST Password. example:000000
HOST_PASS=000000

#Controller Server hostname. example:controller
HOST_NAME=controller

#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=172.16.10.20

#Compute HOST Password. example:000000
HOST_PASS_NODE=000000

#Compute Node hostname. example:compute
HOST_NAME_NODE=compute

#--------------------Chrony Config-------------------##
#Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24)
network_segment_IP=172.16.10.0/24

#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack

#Password for rabbit user .example:000000
RABBIT_PASS=000000

#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=000000

#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000

#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000

#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000

#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000

#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000

#Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000

#--------------------Neturon Config-------------------##
#Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000

#Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000

#metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000

#Tunnel Network Interface. example:x.x.x.x
INTERFACE_IP=172.16.10.10

#External Network Interface. example:eth1
INTERFACE_NAME=ens34

#External Network The Physical Adapter. example:provider
Physical_NAME=provider

#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=1

#Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=2000

#--------------------Cinder Config--------------------##
#Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000

#Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000

#Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb

#--------------------Swift Config---------------------##
#Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000

#The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdc

#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=172.16.10.20

#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000

#Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000

#--------------------Zun Config-----------------------##
#Password for Mysql Zun user. exmaple:000000
ZUN_DBPASS=000000

#Password for Keystore Zun user. exmaple:000000
ZUN_PASS=000000

#Password for Mysql Kuryr user. exmaple:000000
KURYR_DBPASS=000000

#Password for Keystore Kuryr user. exmaple:000000
KURYR_PASS=000000

#--------------------Ceilometer Config----------------##
#Password for Gnocchi ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000

#Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000

#--------------------AODH Config----------------##
#Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000

#Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000

#--------------------Barbican Config----------------##
#Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=000000

#Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000

将controller配置好的openrc.sh通过scp传输至compute相应的文件夹内

代码语言:javascript
复制
[root@controller ~]# scp /etc/xiandian/openrc.sh 172.16.19.20:/etc/xiandian/openrc.sh
ssh: connect to host 172.16.19.20 port 22: No route to host
lost connection
[root@controller ~]# scp /etc/xiandian/openrc.sh 172.16.10.20:/etc/xiandian/openrc.sh
The authenticity of host '172.16.10.20 (172.16.10.20)' can't be established.
ECDSA key fingerprint is SHA256:lDjv6aHOHM9bz6LzO/u3DT4AMGxP56xSw5VGt9YVco0.
ECDSA key fingerprint is MD5:11:8a:16:1d:cb:78:26:35:c7:87:1b:81:d3:fa:e2:fb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.10.20' (ECDSA) to the list of known hosts.
root@172.16.10.20's password:
openrc.sh 100% 3807 1.8MB/s 00:00
[root@controller ~]#

【compute】

代码语言:javascript
复制
[root@compute ~]# vi /etc/xiandian/openrc.sh
[root@compute ~]# cat /etc/xiandian/openrc.sh
#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=172.16.10.10

#Controller HOST Password. example:000000
HOST_PASS=000000

#Controller Server hostname. example:controller
HOST_NAME=controller

#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=172.16.10.20

#Compute HOST Password. example:000000
HOST_PASS_NODE=000000

#Compute Node hostname. example:compute
HOST_NAME_NODE=compute

#--------------------Chrony Config-------------------##
#Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24)
network_segment_IP=172.16.10.0/24

#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack

#Password for rabbit user .example:000000
RABBIT_PASS=000000

#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=000000

#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000

#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000

#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000

#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000

#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000

#Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000

#--------------------Neturon Config-------------------##
#Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000

#Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000

#metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000

#Tunnel Network Interface. example:x.x.x.x
INTERFACE_IP=172.16.10.20

#External Network Interface. example:eth1
INTERFACE_NAME=ens34

#External Network The Physical Adapter. example:provider
Physical_NAME=provider

#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=1

#Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=2000

#--------------------Cinder Config--------------------##
#Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000

#Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000

#Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb

#--------------------Swift Config---------------------##
#Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000

#The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdc

#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=172.16.10.20

#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000

#Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000

#--------------------Zun Config-----------------------##
#Password for Mysql Zun user. exmaple:000000
ZUN_DBPASS=000000

#Password for Keystore Zun user. exmaple:000000
ZUN_PASS=000000

#Password for Mysql Kuryr user. exmaple:000000
KURYR_DBPASS=000000

#Password for Keystore Kuryr user. exmaple:000000
KURYR_PASS=000000

#--------------------Ceilometer Config----------------##
#Password for Gnocchi ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000

#Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000

#--------------------AODH Config----------------##
#Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000

#Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000

#--------------------Barbican Config----------------##
#Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=000000

#Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000

9、执行相关服务部署脚本

【controller| compute】

代码语言:javascript
复制
# iaas-pre-host.sh

reboot

等到controller、compute两个节点同时创建完成后再同时重启centos

Please Reboot or Reconnect the terminal当同时在两个节点看到此提示,即可重启。

【controller】

安装数据库服务
[root@controller ~]# iaas-install-mysql.sh

在这里插入图片描述

安装认证服务 [root@controller ~]# iaas-install-keystone.sh

验证认证服务

代码语言:javascript
复制
[root@controller ~]# source /etc/keystone/admin-openrc.sh 
[root@controller ~]# openstack user list
+----------------------------------+-------+
| ID                               | Name  |
+----------------------------------+-------+
| cac753e558c747338116623b8de8de42 | admin |
| e6a51892258b45c79c28ae7e10127a80 | demo  |
+----------------------------------+-------+

安装镜像服务 [root@controller ~]# iaas-install-glance.sh

验证镜像服务 [root@controller ~]# openstack user list ±---------------------------------±-------+ | ID | Name | ±---------------------------------±-------+ | 7c33302f61cf4b85b09f6cf4d91598e5 | glance | | cac753e558c747338116623b8de8de42 | admin | | e6a51892258b45c79c28ae7e10127a80 | demo | ±---------------------------------±-------+

上传测试镜像

代码语言:javascript
复制
[root@controller ~]# source /etc/keystone/admin-openrc.sh 
[root@controller ~]# glance image-create --name cirros --disk-format qcow2 --container bare --progress < cirros-0.5.1-x86_64-disk.img 
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 1d3062cd89af34e419f7100277f38b2b     |
| container_format | bare                                 |
| created_at       | 2020-11-15T04:06:20Z                 |
| disk_format      | qcow2                                |
| id               | 1fea3777-e5ed-46b7-9dae-2d9a3554bb99 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros                               |
| owner            | b80d6a7fd05641aea59268fc30775ed5     |
| protected        | False                                |
| size             | 16338944                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2020-11-15T04:06:21Z                 |
| virtual_size     | None                                 |
| visibility       | shared                               |
+------------------+--------------------------------------+
[root@controller ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 1fea3777-e5ed-46b7-9dae-2d9a3554bb99 | cirros | active |
+--------------------------------------+--------+--------+

安装计算服务 [root@controller ~]# iaas-install-nova-controller.sh

在这里插入图片描述

验证计算服务

代码语言:javascript
复制
[root@controller ~]# openstack user list
+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| 7c33302f61cf4b85b09f6cf4d91598e5 | glance    |
| 91b70a465e494ad1b438b167d4db6d2a | placement |
| 958fd8e1ba0e427fbab6e149f0a3ea1b | nova      |
| cac753e558c747338116623b8de8de42 | admin     |
| e6a51892258b45c79c28ae7e10127a80 | demo      |
+----------------------------------+-----------+

【compute】 安装计算服务 注意:等待controller控制节点计算服务脚本执行安装完毕后,再执行compute节点的安装。后面的安装亦是如此。 [root@compute ~]# iaas-install-nova-compute.sh

在这里插入图片描述

【controller】 安装网络服务 [root@controller ~]# iaas-install-neutron-controller.sh

【compute】 安装网络服务 [root@compute ~]# iaas-install-neutron-compute.sh

在这里插入图片描述

【controller】 安装Dashboard服务 [root@controller ~]# iaas-install-dashboard.sh

在这里插入图片描述

10、登录Dashboard管理控制平台

在这里插入图片描述
在这里插入图片描述

至此。基础部分搭建完成!

11、可选服务补充搭建

安装块存储服务 【controller】 [root@controller ~]# iaas-install-cinder-controller.sh

安装对象存储服务 [root@controller ~]# iaas-install-swift-controller.sh

【compute】 安装块存储服务 [root@compute ~]# iaas-install-cinder-compute.sh

在这里插入图片描述

安装对象存储服务 [root@compute ~]# iaas-install-swift-compute.sh 注意是否从控制节点中传送过来以下三个压缩包

代码语言:javascript
复制
account.ring.gz                                                                                      100%  728   344.4KB/s   00:00    
container.ring.gz                                                                                    100%  207   121.1KB/s   00:00    
object.ring.gz                                                                                       100%  204   277.6KB/s   00:00 

【controller】 安装编排服务 [root@controller ~]# iaas-install-heat.sh

在这里插入图片描述

【controller】 安装zun服务 [root@controller ~]# iaas-install-zun-controller.sh

在这里插入图片描述

【compute】 安装zun服务 [root@compute ~]# iaas-install-zun-compute.sh

在这里插入图片描述

【controller】 上传容器镜像

代码语言:javascript
复制
[root@controller ~]# source /etc/keystone/admin-openrc.sh 
[root@controller ~]# cd /opt/openstack/images/
[root@controller images]# ls
CentOS_6.5_x86_64_XD.qcow2  CentOS7_1804.tar  CentOS_7.2_x86_64_XD.qcow2  CentOS_7.5_x86_64_XD.qcow2
[root@controller images]# openstack image create centos-zun-7.5 --public --container-format docker --disk-format raw < CentOS7_1804.tar 
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | 438e76cdb677a3ab1156e284f58aa366                     |
| container_format | docker                                               |
| created_at       | 2020-11-15T05:49:51Z                                 |
| disk_format      | raw                                                  |
| file             | /v2/images/0b93bcf3-0acf-4908-89f3-e0cca9e366e1/file |
| id               | 0b93bcf3-0acf-4908-89f3-e0cca9e366e1                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | centos-zun-7.5                                       |
| owner            | b80d6a7fd05641aea59268fc30775ed5                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 381696512                                            |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2020-11-15T05:49:53Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+
[root@controller images]# openstack image list
+--------------------------------------+----------------+--------+
| ID                                   | Name           | Status |
+--------------------------------------+----------------+--------+
| 0b93bcf3-0acf-4908-89f3-e0cca9e366e1 | centos-zun-7.5 | active |
| 1fea3777-e5ed-46b7-9dae-2d9a3554bb99 | cirros         | active |
+--------------------------------------+----------------+--------+

启动容器

代码语言:javascript
复制
[root@controller images]# zun run --image-driver glance centos-zun-7.5
+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property          | Value                                                                                                                                                                                                                     |
+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| addresses         |                                                                                                                                                                                                                           |
| links             | ["{u'href': u'http://controller:9517/v1/containers/dfd250a4-f70e-49dc-ae56-fcbe17df8e6c', u'rel': u'self'}", "{u'href': u'http://controller:9517/containers/dfd250a4-f70e-49dc-ae56-fcbe17df8e6c', u'rel': u'bookmark'}"] |
| image             | centos-zun-7.5                                                                                                                                                                                                            |
| labels            | {}                                                                                                                                                                                                                        |
| disk              | 0                                                                                                                                                                                                                         |
| networks          |                                                                                                                                                                                                                           |
| security_groups   | None                                                                                                                                                                                                                      |
| image_pull_policy | None                                                                                                                                                                                                                      |
| user_id           | cac753e558c747338116623b8de8de42                                                                                                                                                                                          |
| uuid              | dfd250a4-f70e-49dc-ae56-fcbe17df8e6c                                                                                                                                                                                      |
| hostname          | None                                                                                                                                                                                                                      |
| environment       | {}                                                                                                                                                                                                                        |
| memory            | None                                                                                                                                                                                                                      |
| project_id        | b80d6a7fd05641aea59268fc30775ed5                                                                                                                                                                                          |
| status            | Creating                                                                                                                                                                                                                  |
| workdir           | None                                                                                                                                                                                                                      |
| auto_remove       | False                                                                                                                                                                                                                     |
| status_detail     | None                                                                                                                                                                                                                      |
| host              | None                                                                                                                                                                                                                      |
| image_driver      | glance                                                                                                                                                                                                                    |
| task_state        | None                                                                                                                                                                                                                      |
| status_reason     | None                                                                                                                                                                                                                      |
| name              | delta-2-container                                                                                                                                                                                                         |
| restart_policy    | None                                                                                                                                                                                                                      |
| ports             | None                                                                                                                                                                                                                      |
| command           | None                                                                                                                                                                                                                      |
| runtime           | None                                                                                                                                                                                                                      |
| cpu               | None                                                                                                                                                                                                                      |
| interactive       | False                                                                                                                                                                                                                     |
+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

查询容器

代码语言:javascript
复制
[root@controller images]# zun list
+--------------------------------------+-------------------+----------------+---------+------------+-----------+-------+
| uuid                                 | name              | image          | status  | task_state | addresses | ports |
+--------------------------------------+-------------------+----------------+---------+------------+-----------+-------+
| dfd250a4-f70e-49dc-ae56-fcbe17df8e6c | delta-2-container | centos-zun-7.5 | Running | None       | 10.0.0.3  | [22]  |
+--------------------------------------+-------------------+----------------+---------+------------+-----------+-------+

登录容器

代码语言:javascript
复制
[C:\~]$ ssh 10.0.0.3

Connecting to 10.0.0.3:22...
Connection established.
To escape to local shell, press Ctrl+Alt+].

WARNING! The remote SSH server rejected X11 forwarding request.
[root@ce707216eaa8 ~]# ip a
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
8: eth0@if9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether fa:16:3e:49:c4:af brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.0.0.3/24 brd 10.0.0.255 scope global eth0
valid_lft forever preferred_lft forever
[root@ce707216eaa8 ~]#

【controller】
安装Ceilometer监控服务
[root@controller ~]# iaas-install-ceilometer-controller.sh

在这里插入图片描述

【compute】 安装Ceilometer监控服务 [root@compute ~]# iaas-install-ceilometer-compute.sh

在这里插入图片描述

【controller】 [root@controller ~]# iaas-install-aodh.sh

在这里插入图片描述

【controller】 添加控制节点的计算服务资源 修改openrc.sh的配置文件 [root@controller ~]# vi /etc/xiandian/openrc.sh 修改计算节点的主机名和IP地址为控制节点的主机名和IP地址 [root@controller ~]# iaas-install-nova-compute.sh

在这里插入图片描述
在这里插入图片描述