由于2020年云计算改革由团队比赛变成个人比赛,原本由三个人,iaas和pass,
bigdata,云应用开发都变成一个人
所有脚本都在/usr/local/bin/
预先准备
2.虚拟机镜像是版本是centos 1804 大小4G左右
第一部分 部署操作
1.更改两个主机的ip地址(我们的网卡名称不一样,我的是eth0,eth1)
controller节点
vi /etc/sysconfig/network-scripts/ifcfg-eth0
设置
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.100.10
PREFIX=24
GATEWAY=192.168.100.1
vi /etc/sysconfig/network-scripts/ifcfg-eth1
设置
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.200.10
PREFIX=24
第二张网卡不配置网关
compute节点的ip地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
设置
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.100.20
PREFIX=24
GATEWAY=192.168.100.1
vi /etc/sysconfig/network-scripts/ifcfg-eth1
设置
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.200.20
PREFIX=24
第二张网卡不配置网关
2.修改防火墙
关闭防火墙
[root@controller ]# systemctl stop firewalld
设置开机不自启
[root@controller ~]# systemctl disable firewalld
关闭防火墙
[root@compute ]# systemctl stop firewalld
设置开机不自启
[root@compute ]# systemctl disable firewalld
3.设置selinux
setenforce 0 //设置selinux的规则为permissive
vi /etc/selinux/config
修改为
SELINUX=permissive
getenforce查看一下状态
4.配置yum源
(1)上传centos,iaas镜像到controller上
(2)挂载到/opt下面的centos.和iaas/下面
挂载
挂载CentOS-7-x86_64-DVD-1804.iso镜像到/mnt目录下并复制所有文件到/opt/centos目录下
[root@controller ~]# mkdir /opt/centos
[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt/
[root@controller ~]# cp -rvf /mnt/* /opt/centos/
卸载CentOS-7-x86_64-DVD-1804.iso镜像
[root@controller ~]# umount /mnt/
挂载XianDian-IaaS-v2.4.iso镜像到/mnt目录下并复制所有文件到/opt/目录下
[root@controller ~]# mount -o loop XianDian-IaaS-V2.4.iso /mnt
[root@controller ~]# cp -rvf /mnt/* /opt/
[root@controller ~]# umount /mnt/
controller
[root@controller ~]# mv /etc/yum.repos.d/* /opt/
[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
[root@controller ~]# yum clean all
[root@controller ~]# yum repolist
compute
cd /etc/yum.repo
rm -rvf *
scp 192.168.100.10://etc/yum.repos.d/* .
复制过来修改为
[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
安装vsftpd服务,并设置开机重启
[root@controller ~]# yum install -y vsftpd
[root@controller ~]# vi /etc/vsftpd/vsftpd.conf
在末行添加
anon_root=/opt/
保存退出
[root@controller ~]# systemctl stop firewalld
[root@controller ~]# systemctl disable firewalld
[root@controller ~]# systemctl enable vsftpd
[root@controller ~]# systemctl start vsftpd
5.设置硬盘(也可以不用做)
给compute节点加两块硬盘用于配置
设置分区
[root@compute ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 49G 0 part
├─centos-root 253:0 0 44G 0 lvm /
└─centos-swap 253:1 0 5G 0 lvm [SWAP]
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
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0xb3bff53e 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):1
起始 扇区 (2048-104857599,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-104857599,默认为 104857599):+20G
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):p
磁盘 /dev/sdb:53.7 GB, 53687091200 字节,104857600 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xb3bff53e
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41945087 20971520 83 Linux
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@compute ~]# p
-bash: p: 未找到命令
[root@compute ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 49G 0 part
├─centos-root 253:0 0 44G 0 lvm /
└─centos-swap 253:1 0 5G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 20G 0 part
sdc 8:32 0 50G 0 disk
sr0 11:0 1 4.2G 0 rom
[root@compute ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x07964c76 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):1
起始 扇区 (2048-104857599,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-104857599,默认为 104857599):+20G
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):p
磁盘 /dev/sdc:53.7 GB, 53687091200 字节,104857600 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x07964c76
设备 Boot Start End Blocks Id System
/dev/sdc1 2048 41945087 20971520 83 Linux
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@compute ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 49G 0 part
├─centos-root 253:0 0 44G 0 lvm /
└─centos-swap 253:1 0 5G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 20G 0 part
sdc 8:32 0 50G 0 disk
└─sdc1 8:33 0 20G 0 part
sr0 11:0 1 4.2G 0 rom
为什么要设置分区是为了脚本中的swift和cinder
修改配置文件
vi /etc/xiandian/openrc.sh
第一步:去除行头的#号
sed -i 's/^#//g' openrc.sh
第二步:设置密码为000000
vi openrc.sh
:%s/PASS=/PASS=000000/g
#--------------------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/192.168.100.20
#External Network Interface. example:eth1
INTERFACE_NAME=eth1
#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=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
#--------------------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
复制到compute节点
scp 192.168.100.10://etc/xiandian/openrc.sh .
两边都执行
iaas-pre-host.sh
第二部分 跑脚本
1.先在controller执行iaas-install-mysql.sh
2.在controller执行iaas-install-keystone.sh
3.在controller执行iaas-install-glance.sh
4.在两个节点都执行iaas-install-nova.sh
controller执行 iaas-install-nova-controller.sh
compute执行 iaas-install-nova-compute.sh
5.在两个节点都执行iaas-install-neutron.sh
controller执行 iaas-install-neutron-controller.sh
compute执行iaas-install-neutron-compute.sh
6.执行iaas-install-dashboard.sh