OpenStack Q版本私有云平台搭建

一、基本环境配置

1.实训室局域网需添加路由访问服务器:

route add 192.168.10.0/24 192.168.1.1

2.yum源配置(http)

(1)yum源备份

mv /etc/yum.repos.d/* /opt/

(2)创建repo文件

主备分别创建文件/etc/yum.repos.d/centos.repo。

touch /etc/yum.repos.d/centos.repo
1)控制节点
echo '
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1

[iaas]
name=iaas
baseurl=file:///opt/iaas-repo
gpgcheck=0
enabled=1' > /etc/yum.repos.d/centos.repo
2)计算节点
echo '
[centos]
name=centos
# baseurl=ftp://192.168.10.10/centos
baseurl=http://192.168.10.10/centos
gpgcheck=0
enabled=1

[iaas]
name=iaas
# baseurl=ftp://192.168.10.10/iaas-repo
baseurl=http://192.168.10.10/iaas-repo
gpgcheck=0
enabled=1 ' > /etc/yum.repos.d/centos.repo

(3)挂载iso文件(主)

1)挂载ceontos镜像

需要先上传镜像

cd /root/;
mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt/;
mkdir /opt/centos;
cp -rvf /mnt/* /opt/centos/ && umount /mnt/;

2.挂载iaas镜像
cd /root/;
mount -o loop chinaskills_cloud_iaas.iso /mnt/;
cp -rvf /mnt/* /opt/;
umount /mnt/;

(4)搭建http服务器,开启并设置自启

1)控制节点
yum repolist
yum install -y httpd
vi /etc/httpd/conf/httpd.conf   
	将/var/www  改为/opt
	DocumentRoot "/opt"

	<Directory "/opt">
		AllowOverride None
		# Allow open access:
		Require all granted
	</Directory>

	# Further relax access to the default document root:
	<Directory "/opt">

systemctl restart httpd;
systemctl enable httpd;
systemctl stop firewalld;
systemctl disable firewalld;
netstat -pant;
2)计算节点
yum clean all;
yum repolist;

(5)配置防火墙和selinux(控制/计算节点)

编辑selinux文件

sed  -i 's/SELINUX=enforcing/SELINUX=permissive/g'  /etc/selinux/config

关闭防火墙并设置开机不自启

systemctl stop firewalld.service;
systemctl disable firewalld.service;
yum remove -y NetworkManager firewalld;
yum -y install iptables-services;
systemctl enable iptables;
systemctl restart iptables;
iptables -F;
iptables -X;
iptables -Z;
service iptables save;

(6)清除缓存,验证yum源

【controller/compute】

yum clean all;
yum list;

3.编辑环境变量

在controller和compute节点安装iaas-xiandian包:

yum install iaas-xiandian -y

计算节点创建空白分区:

lsblk:查看哪些盘没有分

创建两个空白磁盘空间

fdisk /dev/sdc
	n,p,回车,回车,+500G
	n,p,回车,回车,+500G
	w

编辑修改配置文件/etc/xiandian.openrc.sh

echo '
##--------------------system Config--------------------##
##Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.10.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.10.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.10.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.10.10/192.168.10.20

##External Network Interface. example:eth1   第二张网卡
INTERFACE_NAME=enp8s0

##External Network The Physical Adapter. example:provider
Physical_NAME=provider

##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=1

##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=2000

##--------------------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=sdc2

##--------------------Swift Config---------------------##
##Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000

##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdc3

##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.10.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
' > /etc/xiandian/openrc.sh

计算节点:

sed  -i 's/#INTERFACE_IP=/INTERFACE_IP=192.168.10.20/g'  /etc/xiandian/openrc.sh

4.通过脚本安装服务(openstack包安装、配置域名解析、安装chrony服务)

控制/计算节点分别执行: (/usr/local/bin/)

iaas-pre-host.sh

ctrl+d退出登录,重新登录服务器。

5.安装数据库服务(mysql、rabbitMQ、memcache、etcd服务安装)

控制节点执行:

iaas-install-mysql.sh

二、安装keystone认证(keystone安装、数据库、令牌、证书等)

控制节点执行:

iaas-install-keystone.sh

三、安装Glance镜像服务(安装glance、创库、用户、节点、启动)

控制节点执行:

iaas-install-glance.sh

上传镜像:

cd /etc/keystone/;
source admin-openrc.sh;
glance image-create --name "CentOS7.5" --disk-format qcow2 --container-format bare --progress< /opt/images/CentOS_7.5_x86_64_XD.qcow2;

四、安装Nova计算服务(nova安装、创库、创用户、启动、配置nova)

控制节点执行:

iaas-install-nova-controller.sh

计算节点执行:

iaas-install-nova-compute.sh

五、安装Neutron网络服务(安装服务、数据库、用户、节点、软件包等)

控制节点执行:

iaas-install-neutron-controller.sh

计算节点执行:

iaas-install-neutron-compute.sh

六、安装Dashboard服务

控制节点执行:

iaas-install-dashboard.sh

七、安装Cinder块存储服务

控制节点:

iaas-install-cinder-controller.sh

计算节点:

iaas-install-cinder-compute.sh

八、安装Swift对象存储服务

控制节点:

iaas-install-swift-controller.sh

计算节点:

iaas-install-swift-compute.sh

九、安装Heat编排服务

控制节点:

iaas-install-heat.sh

十、安装ZUN服务

控制节点:

iaas-install-zun-controller.sh

计算节点:

iaas-install-zun-coumpute.sh

十一、安装Ceilometer监控服务

控制节点:

iaas-install-ceilometer-controller.sh

计算节点:

iaas-install-ceilometer-compute.sh

十二、Aodh监控服务

控制节点:

iaas-install-aodh.sh

十三、添加控制节点资源到云平台???

posted @ 2021-03-26 17:40  休耕  阅读(813)  评论(0编辑  收藏  举报