2.4
openstack搭建笔记
安装前配置
镜像:centos7-1804+iaas2.4
compute硬盘创建cinder和swift存储磁盘分区
虚拟机分区:
[root@compute ~]# parted /dev/sda
(parted)P //查看
(parted)mkpart cinder
起始://按上一个分区的最后
结束://这个分区的结束
ext4
服务器分区:
[root@compute ~]# parted /dev/md126
(parted) mkpart swift 702G 803G
[root@compute ~]# mkfs.xfs /dev/md126p5
一、配置网络
controller节点:
网卡1:192.168.100.10
网卡2:192.168.200.10
compute节点:
网卡1:192.168.100.20
网卡2:192.168.200.20
systelctr restart network
二、关闭防火墙和SElinux
(2个节点都执行 :[root@controller/compute ~])
[root@controller/compute ~]systemctl stop firewalld.service
[root@controller/compute ~]systemctl disable firewalld.service
[root@controller/compute ~]vi /etc/selinux/config
SELINUX=permissive
三、配置名字
[root@controller ~]hostnamectl set-hostname controller
[root@compute ~]hostnamectl set-hostname compute
[root@controller/compute ~]su
四、设置映射
[root@controller/compute ~] vi /etc/hosts
192.168.100.10 contorller
192.168.100.20 compute
五、挂载镜像
#挂载centos
[root@controller ~]mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt/
[root@controller ~]mkdir /opt/centos
[root@controller ~]cp -rvf /mnt/* /opt/centos/
[root@controller ~]umount /mnt/
#挂载iaas
[root@controller ~]mount -o loop XianDian-IaaS-v2.4.iso /mnt/
[root@controller ~]cp -rvf /mnt/* /opt/
[root@controller ~]umount /mnt/
六、配置yum
删除原来的yum
[root@controller/compute ~] rm -rf /etc/yum.repos.d/*
【controller】
[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 ~]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
六、搭建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
测试yum
[root@controller/compute ~]yum clean all
[root@controller/compute ~]yum repolist
八、编辑环境变量
[root@controller/compute ~] yum install iaas-xiandian -y
[root@controller/compute ~] vi /etc/xiandian/openrc.sh
:%s/#
:%s/PASS=/PASS=000000/g
[root@controller ~] scp /etc/xiandian/openrc.sh root@192.168.100.20:/etc/xiandian/
九、安装Openstack包
[root@controller/compute ~] iaas-pre-host.sh
[root@controller/compute ~] reboot
开始搭建:
1、安装Mysql数据库服务
[root@controller ~] iaas-install-mysql.sh
2、安装Keystone认证服务
[root@controller ~] iaas-install-keystone.sh
3、安装Glance镜像服务
[root@controller ~] iaas-install-glance.sh
上传镜像命令
[root@controller ~] source /etc/keystone/admin-openr.sh
[root@controller ~] glance image-create --name "CentOS7.5" --disk-format qcow2 --container-format bare --progress < /opt/images/CentOS_7.5_x86_64_XD.qcow2
4、安装Nova计算服务
[root@controller ~] iaas-install-nova-controller.sh
[root@compute ~]iaas-install-nova-compute.sh
5、安装Neutron网络服务
[root@controller ~]iaas-install-neutron-controller.sh
[root@compute ~]iaas-install-neutron-compute.sh
6、安装Dashboard服务
[root@controller ~] iaas-install-dashboard.sh
创建云主机
(1)管理员->资源管理->云主机类型->创建云主机类型
(2)管理员->网络->网络->创建网络
(3)项目->网络->安全组->管理规则->添加规则(ICMP、TCP、UDP)
(4)路由
(5)项目->资源管理->云主机->创建云主机
7、安装Cinder块存储服务
[root@controller ~] iaas-install-cinder-controller.sh
[root@compute ~]iaas-install-cinder-compute.sh
8、安装Swift对象存储服务
[root@controller ~] iaas-install-swift-controller.sh
[root@compute ~] iaas-install-swift-compute.sh
9、安装Heat编配服务
[root@controller ~]iaas-install-heat.sh
10、安装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
11、安装Ceilometer监控服务
[root@controller ~]iaas-install-ceilometer-controller.sh进行安装
[root@compute ~] iaas-install-ceilometer-compute.sh进行安装
12、安装Aodh监控服务
[root@controller ~]iaas-install-aodh.sh
13、添加控制节点资源到云平台
把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
执行过程中需要确认登录controller节点和输入controller节点root用户密码。