使用VMware Workstation搭建先电IaaS云平台(v2.2版本)(下)

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 使用VMware Workstation搭建先电IaaS云平台(v2.2版本)

4、配置网络和主机名(controller、compute)


controller节点


主机名:



配置网络


[root@controller ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728 
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777728 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=ddfbd6c9-24c4-4233-a5df-546d911e3647
DEVICE=eno16777728
ONBOOT=yes
IPADDR=192.168.100.10
PREFIX=24
GATEWAY=192.168.100.1
[root@controller ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno33554952 
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno33554952 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno33554952
UUID=6c35fc37-ccb6-4b09-a7e4-91f8d7eb7408
DEVICE=eno33554952
ONBOOT=yes
IPADDR=192.168.200.10
PREFIX=24


compute节点


主机名:



配置网络


[root@compute ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno
ifcfg-eno16777728  ifcfg-eno33554952  
[root@compute ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728 
[root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777728 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=35463c40-248c-4847-b0ea-f3503904d2a1
DEVICE=eno16777728
ONBOOT=yes
IPADDR=192.168.100.20
PREFIX=24
GATEWAY=192.168.100.1
[root@compute ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno33554952 
[root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno33554952 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno33554952
UUID=79eaa8e6-82a7-4d7d-8e74-2ff2236bb4f2
DEVICE=eno33554952
ONBOOT=yes
IPADDR=192.168.200.20
PREFIX=24


5、配置yum源(controller、compute)


(1)使用mv命令移动原yum源至/opt目录下


# mv /etc/yum.repos.d/* /opt/


(2)创建文件夹


[root@controller opt]# mkdir /opt/centos
[root@controller opt]# mkdir /opt/iaas
[root@controller opt]# ll
total 28
drwxr-xr-x. 2 root root    6 Jul 23 17:20 centos
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo
drwxr-xr-x. 2 root root    6 Jul 23 17:20 iaas


(3)创建repo文件


【controller节点】


[root@controller ~]# mv /etc/yum.repos.d/* /opt/
[root@controller ~]# cd /etc/yum.repos.d/
[root@controller yum.repos.d]# ll
total 0
[root@controller yum.repos.d]# vi centos.repo
[root@controller yum.repos.d]# cat centos.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1


【compute节点】


[root@compute ~]# cd /etc/yum.repos.d/
[root@compute yum.repos.d]# vi ftp.repo
[root@compute yum.repos.d]# cat ftp.repo
[centos]
name=centos
baseurl=ftp://controller/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://controller/iaas-repo
gpgcheck=0
enabled=1


(4)在controller节点,上传iso镜像文件




(5)挂载iso文件


挂载CentOS-7-x86_64-DVD-1511.iso


[root@controller ~]# mount -o loop CentOS-7.2-x86_64-DVD-1511.iso /mnt/
[root@controller ~]# cp -rvf /mnt/* /opt/centos/
[root@controller ~]# umount /mnt/


挂载XianDian-IaaS-v2.2.iso


[root@controller ~]# mount -o loop XianDian-IaaS-v2.2.iso /mnt/
mount: /dev/loop0 is write-protected, mounting read-only
[root@controller ~]# cp -rvf /mnt/* /opt/iaas/
[root@controller ~]# umount /mnt/


(6)清除缓存,验证yum源。测试本地yum源是否安装成功。


[root@controller ~]# 
[root@controller ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: centos iaas
Cleaning up everything
[root@controller ~]# yum repolist
Loaded plugins: fastestmirror
centos                                                                                            | 3.6 kB  00:00:00     
iaas                                                                                              | 2.9 kB  00:00:00     
(1/3): centos/group_gz                                                                            | 155 kB  00:00:00     
(2/3): centos/primary_db                                                                          | 2.8 MB  00:00:00     
(3/3): iaas/primary_db                                                                            | 2.3 MB  00:00:00     
Determining fastest mirrors
repo id                                                   repo name                                                status
centos                                                    centos                                                   3,723
iaas                                                      iaas                                                     1,688
repolist: 5,411
[root@controller ~]# 


(7)搭建ftp服务器,开启并设置自启


[root@controller ~]# yum install -y vsftpd



[root@controller ~]# vi /etc/vsftpd/vsftpd.conf 
添加anon_root=/opt/centos
保存退出


开启ftp服务,并设置开机自启动。


[root@controller ~]# systemctl start vsftpd
[root@controller ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.


6、配置域名解析(controller、compute)


修改/etc/hosts添加一下内容


controller节点


[root@controller ~]# vi /etc/hosts
[root@controller ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10  controller
192.168.100.20  compute


compute节点


[root@compute ~]# scp 192.168.100.10://etc/hosts /etc/hosts
The authenticity of host '192.168.100.10 (192.168.100.10)' can't be established.
ECDSA key fingerprint is 32:68:31:bb:4b:c9:2b:e6:73:7f:c0:2b:49:4b:97:c4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.10' (ECDSA) to the list of known hosts.
root@192.168.100.10's password: 
hosts                                                                                  100%  207     0.2KB/s   00:00    
[root@compute ~]# cat /etc/host
cat: /etc/host: No such file or directory
[root@compute ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10  controller
192.168.100.20  compute
[root@compute ~]# 


7、关闭防火墙和SELINUX安全模式(controller、compute)


(1)关闭防火墙并设置开机不自启


[root@controller ~]# systemctl stop firewalld
[root@controller ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.


(2)修改SELINUX模式


[root@controller ~]# vi /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=disabled //将enforcing修改成disabled
# 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 ~]# setenforce 0   //临时修改成permissive
[root@controller ~]# getenforce    //查看SELINUX结果
Permissive
[root@controller ~]# 


保存退出,重启生效


8、划分空白磁盘,cinder存储和swift存储(compute)


[root@compute ~]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0  100G  0 disk 
├─sda1            8:1    0  200M  0 part /boot
└─sda2            8:2    0 99.8G  0 part 
  ├─centos-root 253:0    0 83.8G  0 lvm  /
  └─centos-swap 253:1    0   16G  0 lvm  [SWAP]
sdb               8:16   0   50G  0 disk 
sdc               8:32   0   50G  0 disk 
sr0              11:0    1 1024M  0 rom  


[root@compute ~]# parted /dev/sd
sda   sda1  sda2  sdb   sdc   
[root@compute ~]# parted /dev/sd
sda   sda1  sda2  sdb   sdc   
[root@compute ~]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
(parted) print                                                            
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start  End  Size  File system  Name  Flags
(parted) mkpart cinder 0 51GB
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                     
(parted) print                                                            
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start   End     Size    File system  Name    Flags
 1      17.4kB  51.0GB  51.0GB               cinder
(parted) quit                                                             
Information: You may need to update /etc/fstab.


[root@compute ~]# parted /dev/sdc
GNU Parted 3.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
(parted) print                                                            
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start  End  Size  File system  Name  Flags
(parted) mkpart swift 0 51GB                                              
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                     
(parted) print                                                            
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start   End     Size    File system  Name   Flags
 1      17.4kB  51.0GB  51.0GB               swift
(parted) quit                                                             
Information: You may need to update /etc/fstab.


[root@compute ~]# mkfs.xfs /dev/sdb
mkfs.xfs: /dev/sdb appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.
[root@compute ~]# mkfs.xfs /dev/sdc
mkfs.xfs: /dev/sdc appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.


[root@compute ~]# lsblk 
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0  100G  0 disk 
├─sda1            8:1    0  200M  0 part /boot
└─sda2            8:2    0 99.8G  0 part 
  ├─centos-root 253:0    0 83.8G  0 lvm  /
  └─centos-swap 253:1    0   16G  0 lvm  [SWAP]
sdb               8:16   0   50G  0 disk 
└─sdb1            8:17   0 47.5G  0 part 
sdc               8:32   0   50G  0 disk 
└─sdc1            8:33   0 47.5G  0 part 
sr0              11:0    1 1024M  0 rom  


[root@compute ~]# fdisk -l
#         Start          End    Size  Type            Name
 1           34     99609375   47.5G  Microsoft basic cinder
 1           34     99609375   47.5G  Microsoft basic swift


9、编辑环境变量(controller、compute相同)


[root@controller ~]# yum install -y iaas-xiandian



[root@controller ~]# vi /etc/xiandian/openrc.sh


配置信息如下:


[root@controller ~]# vi /etc/xiandian/openrc.sh 
[root@controller ~]# cat /etc/xiandian/openrc.sh 
##--------------------system Config--------------------##
##Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.100.10
##Controller Server hostname. example:controller
HOST_NAME=controller
##Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.100.20
##Compute Node hostname. example:compute
HOST_NAME_NODE=compute
##--------------------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=domain
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
##External Network Interface. example:eth1
INTERFACE_NAME=eno33554952
##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
#minvlan=101
##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
#maxvlan=200
##--------------------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=sdb1
##--------------------Trove Config--------------------##
##Password for Mysql Trove User. exmaple:000000
TROVE_DBPASS=000000
##Password for Keystore Trove User. exmaple:000000
TROVE_PASS=000000
##--------------------Swift Config---------------------##
##Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000
##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdc1
##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.20
##--------------------Heat Config----------------------##
##Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000
##Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000
##--------------------Ceilometer Config----------------##
##Password for Mysql 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
[root@controller ~]# 


将controller节点的openrc.sh传输至compute节点所放目录下。


[root@compute ~]# scp controller://etc/xiandian/openrc.sh /etc/xiandian/openrc.sh 
The authenticity of host 'controller (192.168.100.10)' can't be established.
ECDSA key fingerprint is 32:68:31:bb:4b:c9:2b:e6:73:7f:c0:2b:49:4b:97:c4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'controller' (ECDSA) to the list of known hosts.
root@controller's password: 
openrc.sh                                                                              100% 3105     3.0KB/s   00:00    
[root@compute ~]# cat /etc/xiandian/openrc.sh 


10、使用脚本安装部署OpenStack平台(controller、compute)


1、双节点执行 iaas-pre-host.sh


[root@controller ~]# iaas-pre-host.sh



重启系统,执行reboot命令


2、在controller节点上执行iaas-install-mysql.sh


[root@controller ~]# iaas-install-mysql.sh



3、在controller节点上安装keystone服务


[root@controller ~]# iaas-install-keystone.sh



4、在controller节点上安装Glance镜像服务


[root@controller ~]# iaas-install-glance.sh



5、分别在controller、compute节点上安装Nova服务。


[root@controller ~]# iaas-install-nova-controller.sh 
[root@compute ~]# iaas-install-nova-compute.sh


6、在controller、compute节点上安装neutron网络服务


[root@controller ~]# iaas-install-neutron-controller.sh  
[root@controller ~]# iaas-install-neutron-controller-gre.sh  
[root@compute ~]# iaas-install-neutron-compute.sh  
[root@compute ~]# iaas-install-neutron-compute-gre.sh


7、在controller节点上安装dashboard服务


[root@controller ~]# iaas-install-dashboard.sh



8、安装cinder块存储服务


controller节点:


[root@controller ~]# iaas-install-cinder-controller.sh


compute节点:


[root@compute ~]# iaas-install-cinder-compute.sh


9、安装swift对象存储服务


controller节点与compute节点:



10、访问Dashboard服务


http://192.168.100.10/dashboard



相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
7月前
|
虚拟化 UED Windows
Vmware workstation 安装教程
Vmware workstation 安装教程
296 1
|
Ubuntu 虚拟化
VMWare Tools没有正确安装或者版本过低导致的
VMWare Tools没有正确安装或者版本过低导致的
607 2
|
8天前
|
Unix Linux 虚拟化
VMware Workstation 17.6.2 发布下载,现在完全免费无论个人还是商业用途
VMware Workstation 17.6.2 发布下载,现在完全免费无论个人还是商业用途
200 15
VMware Workstation 17.6.2 发布下载,现在完全免费无论个人还是商业用途
|
2月前
|
Linux API 虚拟化
VMware WorkStation Pro 15.5(低版本安装) 教学用
VMware WorkStation Pro 15.5(低版本安装) 教学用
254 5
|
3月前
|
运维 虚拟化 Windows
VMware Workstation常见的故障处理
关于VMware Workstation常见故障处理的指南,包括Windows 10开启虚拟机蓝屏问题的解决方案和虚拟机无法开机时的解决方法。
243 21
VMware Workstation常见的故障处理
|
2月前
|
虚拟化 网络虚拟化 网络架构
虚拟机 VMware Workstation 16 PRO 的网络配置
虚拟机 VMware Workstation 16 PRO 的网络配置
93 2
|
3月前
|
虚拟化
VMware Workstation子网划分及bond配置案例
本文主要介绍了如何在VMware Workstation中进行子网划分以及如何添加和配置四块网卡以实现bond模式,并通过配置文件和命令行操作来验证bond模式的有效性。
84 3
VMware Workstation子网划分及bond配置案例
|
7月前
|
Linux 虚拟化
VMware workstation 中centos7虚拟机在nat模式下怎么配置网卡,指定我想要的IP并且可以联网
https://blog.csdn.net/2302_78534730/article/details/132825156?spm=1001.2014.3001.5502
331 0
|
3月前
|
虚拟化
VMware Workstation产品常用的快捷键
文章介绍了VMware Workstation产品中常用的快捷键及其功能,包括对虚拟机的控制、设置、快照管理等操作,同时提供了作者的联系方式和博客链接。
196 15
|
5月前
|
虚拟化
VMware Workstation 16 Pro安装教程
VMware Workstation 16 Pro安装教程
172 1