云计算运维--先电云计算大赛中iaas平台搭建

创建2台centos7 虚拟机 一台命名为controller 一台命名为compute

一、使用主机名互相通信

1.修改主机名
controller & compute

#hostnamectl set-hostname controller
#bash
#hostnamectl set-hostname compute
#bash

2.配置内网与外网
controller& compute
配置内网:(自行定义IP:内网)

#vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
BOOTPROTO=static
IPADDR=192.168.1.101 (controller)/192.168.1.102(compute)
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes

配置外网:(IP随机分配)

#vi /etc/sysconfig/network-scripts/ifcfg-eno33554960
ONBOOT=yes

重新启动网卡

#systemctl restart network

3.更改配置文件hosts
controller

#vi /etc/hosts
(插入)
192.168.1.101 controller
192.168.1.102 compute
#scp /etc/hosts  root@compute:/etc/hosts	(跨机复制)

4.关闭防火墙
controller & compute

#systemctl stop firewalld && systemctl disable firewalld
#ping control	/#ping compute

systemctl stop firewalld 临时关闭防火墙
systemctl disable firewalld 防火墙开机自动关闭

二、挂载光盘镜像配置本地 yum 源(control )

可以通过CRT上传镜像
需要的镜像有:
CentOS-7-x86_64-DVD-1511.iso
XianDian-IaaS-v2.2.iso

1.挂载centos & iaas

#mkdir /opt/centos && mkdir /opt/iaas
#mount /dev/cdrom  /mnt  
#cp -rvf /mnt/* /opt/centos/
#umount  /mnt/
#mount /dev/cdrom  /mnt/
#cp -rvf /mnt/* /opt/iaas/
#umount  /mnt/

2.yum源备份 controller& compute

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

3.创建controller节点repo文件

[root@controller ~]#vi /etc/yum.repos.d/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
[root@controller ~]#scp /etc/yum.repos.d/centos.repo root@compute:/etc/yum.repos.d/centos.repo

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

[root@controller ~]# yum install vsftpd –y
[root@controller ~]# vi /etc/vsftpd/vsftpd.conf
 添加anon_root=/opt/
[root@controller ~]# systemctl start vsftpd
[root@controller ~]# systemctl enable vsftpd

4.创建compute节点repo文件

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

5.清除缓存验证yum源

#yum clean all(清除缓存)
#yum list(列出软件包)

三、环境配置 与 安装

1.安装先电包,配置环境变量
controller & compute
一定要把 # 去除

[root@controller ~]#yum install iaas-xiandian -y
[root@controller ~]#vi /etc/xiandian/openrc.sh
HOST_IP=192.168.1.101
HOST_NAME=controller
HOST_IP_NODE=192.168.1.102
HOST_NAME_NODE=compute
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_NAME=eth1(外网网卡名)
CINDER_DBPASS=000000
CINDER_PASS=000000
TROVE_DBPASS=000000
TROVE_PASS=000000
BLOCK_DISK=md126p4(空白分区名)
SWIFT_PASS=000000
OBJECT_DISK=md126p5(空白分区名)
STORAGE_LOCAL_NET_IP=192.168.1.102(compute)
HEAT_DBPASS=000000
HEAT_PASS=000000
CEILOMETER_DBPASS=000000
CEILOMETER_PASS=000000
AODH_DBPASS=000000
AODH_PASS=000000

controller & compute

#iaas-pre-host.sh
#reboot(重启)

–controller

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

上传镜像

[root@controller ~]#source /etc/keystone/admin-openrc.sh
[root@controller ~]#glance image-create --name "CentOS7.0" --disk-format qcow2  --container-format bare --progress < /opt/iaas/images/CentOS_7.2_x86_64_XD.qcow2

通过脚本安装服务

【nova服务】

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

【neutron服务】

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

【Neutron网络服务】

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

【dashboard服务】

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

启动服务

[root@controller ~]#systemctl restart httpd.service memcached.service

进入网页:192.168.1.101/dashboard,iaas平台便以搭建完成。

你可能感兴趣的:(先电云计算)