使用VMware Workstation搭建先电IaaS云平台(v2.2版本)
从零开始搭建先电 IaaS云计算平台先电IaaS详细操作流程目录从零开始搭建先电 IaaS云计算平台1、前期准备与规划2、基础环境配置与说明3、安装CentOS7 说明与操作步骤(以controller节点为例)4、配置网络和主机名(controller、compute)5、配置yum源(controller、compute)6、配置域名解析(controller、compute)7、关闭防火墙和
从零开始搭建先电 IaaS云计算平台
先电IaaS详细操作流程目录
1、前期准备与规划
- 使用搭建的软件:
VMware Workstation Pro
VMware Workstation Pro安装教程详细步骤
- 使用搭建的系统:
CentOS-7.2-x86_64-DVD-1511
- 使用搭建的镜像:
XianDian-IaaS-v2.2
- 使用搭建的远程连接工具:
xShell
- 搭建方式:采用双节点搭建,一个节点为controller控制节点,另一个为compute计算节点。
- IP地址规划:
节点 | 外网IP地址 | 内网IP地址 |
---|---|---|
controller | 192.168.100.10 | 192.168.200.10 |
compute | 192.168.100.20 | 192.168.200.20 |
补充说明:外网网卡采用仅主机模式
,内网网卡采用NAT模式
。
2、基础环境配置与说明
IaaS控制节点安装的服务 | IaaS计算节点安装的服务 |
---|---|
Keystone安全认证服务 | |
MySQL数据库 | |
Glance镜像服务 | |
Nova计算控制服务 | Nova Compute计算服务 |
Neutron Server网络服务 | Neutron计算节点网络服务 |
Dashboard管理服务 | |
Cinder存储控制服务 | Cinder Volume存储服务 |
Rabbit消息服务 | |
Swift代理服务 | Swift存储服务 |
Heat编排服务 | |
Ceilometer监控服务 | Ceilometer监控服务 |
说明:存储节点安装操作系统时需划分两个空白分区,作为cinder和swift存储磁盘搭建 ftp服务器作为搭建云平台的yum源。
3、安装CentOS7 说明与操作步骤(以controller节点为例)
【CentOS7版本】
CentOS-7-x86_64-DVD-1511.iso
【空白分区划分】
CentOS7的安装与CentOS6.5的安装有明显的区别。在CentOS7安装过程中,设置分区都需要一个挂载点,这样一来就无法创建两个空白的磁盘分区作为cinder服务和swift服务的存储磁盘了。
所以我们应该在系统安装过程中留下足够的磁盘大小,系统安装完成后,使用命令parted划分新分区,然后使用mkfs.xfs进行文件系统格式化,完成空白分区的划分。
controller控制节点虚拟硬件配置:
compute计算节点虚拟硬件配置:
设置对应的网卡模式和网络地址
通常默认情况下。VMnet0为桥接模式;VMnet1为仅主机模式;VMnet8为NAT模式。
以controller节点安装为例,compute计算节点安装步骤与此相同。(磁盘大小分配有所区别)
选择此选项,代表直接安装系统。使用“↑↓”键进行选择,选择“Install CentOS 7”,敲击回车键,继续下一步。
选择语言,默认,继续。
基本参数设置,如图所示。网络配置等待centos安装完毕,进入系统再进行配置。
分配磁盘。
controller节点的磁盘分配:
compute计算节点磁盘配置:
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
更多推荐
所有评论(0)