1.基本环境配置详情:

怎么搭建Iaas云平台 iaas云平台的搭建_怎么搭建Iaas云平台

2.虚拟机配置:

Controller: 内存 6G+ 处理器4个 + 硬盘(sda)100G + 网卡1(仅主机192.168.100.10)+ 网卡2(NAT 192.168.200.10)

Compute: 内存 6G+ 处理器4个 + 硬盘(sda)100G + 硬盘(sdb 50G)+ 硬盘(sdc 50G)+ 网卡1(仅主机192.168.100.20)+ 网卡2(NAT 192.168.200.20)

3.私有云部署:

注释
1.此处可先不编写hosts文件 + 关闭selinux + 注释swap分区
2.因为在下面执行 iaas-pre-host.sh 脚本时,这些操作都会执行。
3.下面关闭防火墙的操作是为了ftp共享时compute可访问controller节点

以下操作看清主机名分别在哪个主机执行:

3.1修改主机名

hostnamectl set-hostname controller
hostnamectl set-hostname compute

systemctl stop firewalld
systemctl disable firewalld

setenforce 0

3.2挂载镜像文件:

[root@controller ~]# mkdir /opt/centos
[root@controller ~]# mkdir /opt/iaas

[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1804.iso /opt/centos
[root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso /opt/iaas/

3.3配置yum源:

[root@controller ~]# rm -rf /etc/yum.repos.d/*
[root@controller ~]# vim /etc/yum.repos.d/local.repo 
[centos]
name=centos
gpgcheck=0
enabled=1
baseurl=file:///opt/centos
[iaas]
name=iaas
gpgcheck=0
enabled=1
baseurl=file:///opt/iaas/iaas-repo


Compute:
[root@compute ~]# rm -rf /etc/yum.repos.d/*
[root@compute ~]# vim /etc/yum.repos.d/local.repo 
[centos]
name=centos
baseurl=ftp://192.168.100.10/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.100.10/iaas/iaas-repo
gpgcheck=0
enabled=1

3.4配置vsftpd共享

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

[root@controller ~]# vim /etc/vsftpd/vsftpd.conf 
anon_root=/opt

[root@controller ~]# systemctl start vsftpd
[root@controller ~]# systemctl enable vsftpd

3.5配置环境变量:

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

//去除行头的#号
[root@controller ~]# sed -i 's/^#//g' /etc/xiandian/openrc.sh 

[root@controller ~]# vim /etc/xiandian/openrc.sh 
//设置密码为000000
:%s/PASS=/PASS=000000/g

HOST_IP=192.168.100.10
HOST_PASS=000000
HOST_NAME=controller
HOST_IP_NODE=192.168.100.20
HOST_PASS_NODE=000000
HOST_NAME_NODE=compute
network_segment_IP=192.168.100.0/24
RABBIT_USER=openstack
RABBIT_PASS=000000
DB_PASS=000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000
KEYSTONE_DBPASS=000000
GLANCE_DBPASS=000000
GLANCE_PASS=000000
NOVA_DBPASS=000000
NOVA_PASS=000000
NEUTRON_DBPASS=000000
NEUTRON_PASS=000000
METADATA_SECRET=000000
INTERFACE_IP=192.168.100.10		//此处切换成compute或controller节点ip
INTERFACE_NAME=ens34			//外部网卡名称(NAT)
Physical_NAME=provider
minvlan=101
maxvlan=200
CINDER_DBPASS=000000
CINDER_PASS=000000
BLOCK_DISK=sdb1
SWIFT_PASS=000000
OBJECT_DISK=sdc1
STORAGE_LOCAL_NET_IP=192.168.100.20		//计算节点ip
HEAT_DBPASS=000000
HEAT_PASS=000000
ZUN_DBPASS=000000
ZUN_PASS=000000
KURYR_DBPASS=000000
KURYR_PASS=000000
CEILOMETER_DBPASS=000000
CEILOMETER_PASS=000000
AODH_DBPASS=000000
AODH_PASS=000000
BARBICAN_DBPASS=000000
BARBICAN_PASS=000000


复制配置文件到compute节点
[root@controller ~]# scp /etc/xiandian/openrc.sh compute:/etc/xiandian/openrc.sh

修改节点ip
[root@compute ~]# vim /etc/xiandian/openrc.sh  
INTERFACE_IP=192.168.100.20

3.6划分compute节点磁盘

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

[root@compute ~]# fdisk /dev/sdb
Command (m for help): n
Using default response p
Partition number (1-4, default 1): 
First sector (2048-104857599, default 2048): 
Command (m for help): w

[root@compute ~]# fdisk /dev/sdc
Command (m for help): n
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-104857599, default 2048): 
Command (m for help): w

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

4.iaas安装脚本执行顺序:

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

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

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

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

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

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



//此处修改nova.conf的配置文件
//若在虚拟机则要执行,在服务器则省略
[root@compute ~]# crudini --set /etc/nova/nova.conf libvirt virt_type  qemu
[root@compute ~]# systemctl restart openstack-nova-compute

[root@controller ~]# crudini --set /etc/nova/nova.conf libvirt virt_type  qemu
[root@controller ~]# systemctl restart openstack-nova*


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

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

5.创建网络

5.1删除规则:

项目–网络–安全组–管理规则----删除所有规则

怎么搭建Iaas云平台 iaas云平台的搭建_云计算_02

5.2添加规则:

怎么搭建Iaas云平台 iaas云平台的搭建_linux_03

5.3创建网络1(外部网络):

管理员–网络–网络–创建网络

怎么搭建Iaas云平台 iaas云平台的搭建_openstack_04


怎么搭建Iaas云平台 iaas云平台的搭建_云计算_05


怎么搭建Iaas云平台 iaas云平台的搭建_怎么搭建Iaas云平台_06

5.4创建路由:

项目–网络–路由

怎么搭建Iaas云平台 iaas云平台的搭建_linux_07

5.5创建网络2(内部网络vlan/vxlan):

注:在虚拟机中网络模式默认是vxlan,服务器上可改用vlan
因为服务器连接了交换机,会设置接口模式为trunk,放行vlan,虚拟机中无法进行此项操作

在服务器中创建vlan网络需修改配置文件:

[root@controller ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini 
[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vlan

[root@controller ~]# systemctl restart neutron*





项目–网络–创建网络

怎么搭建Iaas云平台 iaas云平台的搭建_openstack_08


怎么搭建Iaas云平台 iaas云平台的搭建_云计算_09


怎么搭建Iaas云平台 iaas云平台的搭建_怎么搭建Iaas云平台_10




5.6将两个网络关联起来:

项目–网络–路由–router–接口–增加接口

怎么搭建Iaas云平台 iaas云平台的搭建_openstack_11

查看网络拓扑

怎么搭建Iaas云平台 iaas云平台的搭建_linux_12

5.7创建云主机:

1.上传测试镜像:

[root@controller ~]# source /etc/keystone/admin-openrc.sh 
[root@controller ~]# glance image-create --name cirros --disk-format=qcow2 --container-format=bare --visibility=public --file cirros-0.4.0-x86_64-disk.img

2.创建云主机类型:

怎么搭建Iaas云平台 iaas云平台的搭建_linux_13


3.创建实例:

项目–资源管理–云主机–创建云主机

怎么搭建Iaas云平台 iaas云平台的搭建_openstack_14


4.绑定浮动ip:

怎么搭建Iaas云平台 iaas云平台的搭建_怎么搭建Iaas云平台_15

5.测试success!!

怎么搭建Iaas云平台 iaas云平台的搭建_云计算_16