配置ip地址、配置主机名
controller节点:
网卡1:192.168.100.10
网卡2:192.168.200.10
compute节点:
网卡1:192.168.100.20
网卡2:192.168.200.20
网卡1为仅主机模式,网卡2为NAT模式
cotroller ifcfg-ens33
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=4a667240-2f76-4ddc-b0b1-65bbe67ca7d5 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.100.10 PREFIX=24
|
cotroller ifcfg-ens34
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens34 UUID=3de5461f-2339-4cda-8b46-4df997c74bd5 DEVICE=ens34 ONBOOT=yes IPADDR=192.168.200.10 PREFIX=24 GATEWAY=192.168.200.2
|
compute ifcfg-ens33
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=ef0eaa9c-1330-4616-85d7-9a91ac44a596 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.100.20 PREFIX=24
|
compute ifcfg-ens34
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens34 UUID=fb2363f3-8c7b-4bca-a6e5-5e23827cc644 DEVICE=ens34 ONBOOT=yes IPADDR=192.168.200.20 PREFIX=24 GATEWAY=192.168.200.2
|
配置主机名
[root@controller ~]hostnamectl set-hostname controller [root@compute ~]hostnamectl set-hostname compute
|
磁盘分区
compute节点,添加一块100g硬盘
fdisk /dev/sdb
命令(输入m获取帮助):n Selct(default p):p 分区号:1 起始 扇区(2048-209715199,默认为2058): Last扇区:+10G
命令(输入m获取帮助):n Selct(default p):p 分区号:2 起始 扇区(2048-209715199,默认为2058): Last扇区:+10G
w保存
|
配置本地yum源
【controller】
[root@controller ~]cd /etc/yum.repos.d/ [root@controller ~]mkdir bak [root@controller ~]mv *.repo bak [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-repo gpgcheck=0 enabled=1
|
【compute】
[root@compute ~]cd /etc/yum.repos.d/ [root@compute ~]mkdir bak [root@compute ~]mv *.repo bak [root@compute ~]vi /etc/yum.repos.d/centos.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-repo gpgcheck=0 enabled=1
|
挂载镜像
【controller】
在虚拟机右下角设置CD/DVD
选择CentOS-7-x86_64-DVD-1804.iso镜像,并连接
[root@controller ~]# mount -o loop /dev/cdrom /mnt/ [root@controller ~]# mkdir /opt/centos [root@controller ~]# cp -rvf /mnt/* /opt/centos/ [root@controller ~]# umount /mnt/
|
在虚拟机右下角设置CD/DVD
选择chinaskills_cloud_iaas.iso镜像,并连接
[root@controller ~]# mount -o loop /dev/cdrom /mnt/ [root@controller ~]# cp -rvf /mnt/* /opt/ [root@controller ~]# umount /mnt/
|
搭建ftp服务器,开启并设置自启
[root@controller ~]# yum install vsftpd –y [root@controller ~]# vi /etc/vsftpd/vsftpd.conf 添加 anon_root=/opt/ wq!保存退出 [root@controller ~]# systemctl start vsftpd [root@controller ~]# systemctl enable vsftpd
|
关闭防火墙配置selinux
【controller/compute】
systemctl stop firewalld systemctl disable firewalld
|
清除缓存,验证 yum 源
【controller/compute】
# yum clean all # yum list
|
编辑环境变量
【controller/compute】
# yum install iaas-xiandian -y
|
【controller】
vi /etc/xiandian/openrc.sh
|
##--------------------system Config--------------------## ##Controller Server Manager IP. example:x.x.x.x HOST_IP=192.168.100.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=192.168.100.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=192.168.100.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=192.168.100.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=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
##--------------------Swift Config---------------------## ##Password for Keystore swift user. exmaple:000000 SWIFT_PASS=000000
##The NODE Object Disk for Swift. example:md126p4. OBJECT_DISK=sdb2
##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
##--------------------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】
scp /etc/xiandian/openrc.sh root@192.168.100.20:/etc/xiandian
|
【compute】
vi /etc/xiandian/openrc.sh
|
修改一个地方即可
INTERFACE_IP=192.168.100.20
|
安装openstack包
【controller/compute】
执行脚本命令iaas-pre-host.sh进行安装 # 安装完成后同时重启 [root@controller ~]# reboot
|
安装Mysql数据库服务
[root@controller ~] iaas-install-mysql.sh
|
安装Keystone认证服务
[root@controller ~] iaas-install-keystone.sh
[root@controller ~]# source /etc/keystone/admin-openrc.sh #使环境生效
|
安装Glance镜像服务
[root@controller ~] iaas-install-glance.sh
|
安装Nova计算服务
[root@controller ~] iaas-install-nova-controller.sh
[root@compute ~]iaas-install-nova-compute.sh
|
安装Neutron网络服务
[root@controller ~]iaas-install-neutron-controller.sh
[root@compute ~]iaas-install-neutron-compute.sh
|
安装Dashboard服务
[root@controller ~] iaas-install-dashboard.sh
|
有了上面这些步骤就可以完成基本平台需求了,后面的操作根据需要在安装。
登录OpenStack云平台
在浏览器中输入http://192.168.100.10/dashboard
Domain:demo 用户名:admin 密码:000000
安装Cinder块存储服务
[root@controller ~] iaas-install-cinder-controller.sh
[root@compute ~]iaas-install-cinder-compute.sh
|
安装Swift对象存储服务
[root@controller ~] iaas-install-swift-controller.sh
[root@compute ~] iaas-install-swift-compute.sh
|
安装Heat编配服务
[root@controller ~]iaas-install-heat.sh
|
安装Zun服务
[root@compute ~] iaas-install-zun-compute.sh
|
以CentOS7_1804.tar镜像为例
CentOS7_1804.tar镜像包存放在XianDian-IaaS-v2.4.iso镜像包中。将docker镜像上传到glance中,通过openstack使用镜像启动容器。
[root@controller ~] source /etc/keystone/admin-openrc.sh
[root@controller ~] openstack image create centos7.5 --public --container-format docker --disk-format raw < CentOS7_1804.tar10.14
|
通过glance存储镜像启动容器
[root@controller ~] zun run --image-driver glance centos7.5
[root@controller ~] zun list
|
安装Ceilometer监控服务
[root@controller ~]iaas-install-ceilometer-controller.sh进行安装
[root@compute ~] iaas-install-ceilometer-compute.sh进行安装
|
安装Aodh监控服务
[root@controller ~]iaas-install-aodh.sh
|
添加控制节点资源到云平台
把compute节点的IP和主机名改为controller节点的IP和主机名
[root@controller ~] vi /etc/xiandian/openrc.sh
#Compute Node Manager IP. example:x.x.x.x HOST_IP_NODE=192.168.100.10
#Compute HOST Password. example:000000 HOST_PASS_NODE=000000
#Compute Node hostname. example:compute HOST_NAME_NODE=controller
[root@controller ~] iaas-install-nova-compute.sh
|