基于先电的openstack云平台部署(IaaS 平台构建)

IaaS 平台构建

1.关闭防火墙,禁止开机自启

systemctl stop firewalld
systemctl disable firewalld

2.设置主机名

hostnamectl set-hostname controller

设置主机名compute

3.设置selinux,permissive

vim /etc/selinux/config

查看selinux状态

getenforce

4.上传镜像(controller节点)

5.创建文件夹/opt/centos,/opt/iaas

6.挂载镜像到两个文件夹

mount -o loop 镜像 opt/centos or iaas

7.使用df -h查看磁盘信息

8.在/etc/yum.repos.d创建centos.repo源文件(controller)

[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1

在/etc/yum.repos.d创建centos.repo源文件(compute)

[centos]
name=centos
baseurl=ftp://192.168.31.14/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.31.14/iaas/iaas-repo
gpgcheck=0
enabled=1

9.通过配置好的本地yum源安装vsftpd(controller)

10.修改ftp配置文件,指定匿名访问位置(controller)

vi /etc/vsftpd/vsftpd.conf
anon_root=/opt/

11.重启ftp服务,添加开机自启

12.安装iaas-xiandian

yum install iaas-xiandian -y

13.按照要求配置openrc.sh,另外,应该在HOST_IP上写上自己的本机ip

14.使用脚本配置ntp

iaas-pre-host.sh

15.安装opnestark(不需要执行,集成在上个脚本中)

yum -y install openstack-utils openstack-selinux python-openstackclient

16.使用脚本安装数据库并查看其默认搜索引擎(controller)

yum update
yum upgrade
iaas-install-mysql.sh

看你的mysql当前默认的存储引擎:

mysql> show variables like '%storage_engine%';

17.使用脚本安装keystone(controller)

iaas-install-keystone.sh

18.注入变量

source /etc/keystone/admin-openrc.sh

19.以已有的domain新建用户

openstack user create --domain demo --password xiandian testuser

20.赋予用户testuser admin权限

openstack role add --project demo(项目名) --user demo(用户名) user(角色名)
openstack role add --project admin --user testuser admin

21.使用脚本安装glance(controller)

iaas-install-glance.sh
安装完成后会报错An unexpected error prevented the server from fulfilling your request. (HTTP 500)
重启两个节点重新执行glance

22.创建镜像

glance image-create --name "examimage" --disk-format qcow2 --container-format bare --progress < /opt/iaas/images/CentOS_6.5_x86_64_XD.qcow2

23.设置镜像标签后查询镜像信息

openstack image set --tag "lastone" examimage
openstack image show examimage

23.安装nova服务(controller)

iaas-install-nova-controller.sh

24.安装nova服务(compute)

计算节点不知道谁是控制节点,所以需要把控制节点的IP写入到hosts文件中,之后再执行脚本
iaas-install-nova-compute.sh

25.查看nova节点使用状况

nova host-describe compute

26.gre网络模式(controller)

iaas-install-neutron-controller.sh 
iaas-install-neutron-controller-gre.sh

27.gre网络模式(compute)

iaas-install-neutron-compute.sh 
iaas-install-neutron-compute-gre.sh

28.配置网络

创建网络要注意云主机外网的网段和虚拟机的ip在同一网段,云主机内网随意。

创建外网

neutron net-create ext-net --provider:network_type=gre --provider:segmentation_id=1 --router:external

创建子网

neutron subnet-create ext-net (自己的内网所在网段)/24 --name ext-subnet --gateway (自己的内网网关)

创建内网

neutron net-create int-net1 --provider:network_type=gre --provider:segmentation_id=2

创建子网

neutron subnet-create int-net1 10.0.0.0/24 --name int-subnet1 --gateway 10.0.0.1

创建内网

neutron net-create int-net2 --provider:network_type=gre --provider:segmentation_id=3

创建子网

neutron subnet-create int-net2 10.0.1.0/24 --name int-subnet2 --gateway 10.0.1.1

创建路由器

neutron router-create ext-router

绑定内外网

neutron router-interface-add ext-router int-subnet1
neutron router-gateway-set ext-router ext-net

查看子网列表

neutron subnet-list

查看子网详细信息

neutron subnet-show int-subnet1

29.安装dashboard面板

iaas-install-dashboard.sh
posted @ 2021-04-28 21:20  只是条咸鱼罢了  阅读(889)  评论(0编辑  收藏  举报