OpenStack环境快速搭建

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

提示:这里可以添加本文要记录的大概内容:

例如:OpenStack快速部署

提示:以下是本篇文章正文内容,下面案例可供参考

1.环境搭建

在这里插入图片描述
创建一台虚拟机
在这里插入图片描述
添加一块网卡
在这里插入图片描述
网卡设置成这个模式
在这里插入图片描述
然后在虚拟网络中查看后面用到的IP
在这里插入图片描述

2.安装虚拟机

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

3.配置基础环境

配置网卡

   转到 /etc/sysconfig/network-scripts/,看看网卡情况,也可以用  ip addr 直接查看

在这里插入图片描述

确认网卡后,可以通过,vi /etc/sysconfig/network-scripts/ifg-ens33
在这里插入图片描述
在这里插入图片描述
修改完后通过:wq保存退出

再修改另一张网卡
在这里插入图片描述
最后重启网卡 systemctl restart network

Xshell连接虚拟机

在这里插入图片描述
[root@localhost ~]# systemctl stop firewalld 关闭防火墙
[root@localhost ~]# systemctl disable firewalld 禁用防火墙
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
[root@localhost ~]# vi /etc/selinux/config

在这里插入图片描述
[root@localhost ~]# vi /etc/hosts

在这里插入图片描述
[root@localhost ~]# rm -rf /etc/yum.repos.d/* 删除yum源

关闭虚拟机,克隆一份作为从节点
在这里插入图片描述
在这里插入图片描述
克隆之后的虚拟机更改网卡信息,将上面两张网卡改为20,重启网络,Xshell链接
在这里插入图片描述
这些配置完成之后,发送两个软件包

在这里插入图片描述
配置一下yum源,vi /etc/yum.repos.d/local.repo

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

创建文件夹
[root@localhost ~]# mkdir /opt/centos
[root@localhost ~]# mkdir /opt/iaas
[root@localhost ~]# ls
anaconda-ks.cfg CentOS-7-x86_64-DVD-2009.iso chinaskills_cloud_iaas.iso

compute节点也配置一下yum源
[BEGIN] 2024/11/6 16:11:27
[root@localhost ~]# rm -rf /etc/yum.repos.d/*
[root@localhost ~]# vi /etc/yum.repos.d/ftp.repo

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

将centos镜像临时挂在并复制到文件夹中
[root@localhost ~]# mount -o loop CentOS-7-x86_64-DVD-2009.iso /mnt/
mount: /dev/loop0 写保护,将以只读方式挂载
[root@localhost ~]# cp -rvf /mnt/* /opt/centos/
复制完成后,取消挂载,重新挂载另一个镜像,并复制到对应的文件夹
[root@localhost ~]# umount /mnt/
[root@localhost ~]# ^C
[root@localhost ~]# mount -o loop chinaskills_cloud_iaas.iso /mnt/
mount: /dev/loop0 写保护,将以只读方式挂载
[root@localhost ~]# cp -rvf /mnt/* /opt/iaas/

最后取消挂载,删除镜像
[root@localhost ~]# rm -rf chinaskills_cloud_iaas.iso
[root@localhost ~]# rm -rf CentOS-7-x86_64-DVD-2009.iso
[root@localhost ~]# umount /mnt/
查看yum源是否做好
[root@localhost ~]# yum repolist
下在vsftpd
[root@localhost ~]# yum install vsftpd -y
修改配置
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf

在这里插入图片描述
[root@localhost ~]# systemctl restart vsftpd
[root@localhost ~]# systemctl enable vsftpd

下载软件包,俩个节点都要下载
[root@localhost ~]# yum install iaas-xiandian -y
[root@localhost ~]# vi /etc/xiandian/openrc.sh

在这里插入图片描述
修改配置文件,开始通过ctrl+v G d,取消注释 以及通过这个修改密码:%s/PASS=/PASS=201706/g

[root@localhost ~]# vi /etc/xiandian/openrc.sh
[root@localhost ~]# cat /etc/xiandian/openrc.sh
#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.102.10

#Controller HOST Password. example:000000
HOST_PASS=201706

#Controller Server hostname. example:controller
HOST_NAME=controller

#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.102.20

#Compute HOST Password. example:000000
HOST_PASS_NODE=201706

#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.0.0/16

#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack

#Password for rabbit user .example:000000
RABBIT_PASS=201706

#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=201706

#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=201706
DEMO_PASS=201706

#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=201706

#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=201706

#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=201706

#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=201706

#Password for Keystore nova user. exmaple:000000
NOVA_PASS=201706

#--------------------Neturon Config-------------------##
#Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=201706

#Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=201706

#metadata secret for neutron. exmaple:000000
METADATA_SECRET=201706

#Tunnel Network Interface. example:x.x.x.x
INTERFACE_IP=192.168.235.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=1

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

#--------------------Cinder Config--------------------##
#Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=201706

#Password for Keystore cinder user. exmaple:000000
CINDER_PASS=201706

#Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb

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

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

#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.102.20

#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=201706

#Password for Keystore heat user. exmaple:000000
HEAT_PASS=201706

#--------------------Zun Config-----------------------##
#Password for Mysql Zun user. exmaple:000000
ZUN_DBPASS=201706

#Password for Keystore Zun user. exmaple:000000
ZUN_PASS=201706

#Password for Mysql Kuryr user. exmaple:000000
KURYR_DBPASS=201706

#Password for Keystore Kuryr user. exmaple:000000
KURYR_PASS=201706

#--------------------Ceilometer Config----------------##
#Password for Gnocchi ceilometer user. exmaple:000000
CEILOMETER_DBPASS=201706

#Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=201706

#--------------------AODH Config----------------##
#Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=201706

#Password for Keystore AODH user. exmaple:000000
AODH_PASS=201706

#--------------------Barbican Config----------------##
#Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=201706

#Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=201706
配置文件编写完成后,传送至另一个节点
[root@localhost ~]# scp /etc/xiandian/openrc.sh root@192.168.102.20:/etc/xiandian/
The authenticity of host ‘192.168.102.20 (192.168.102.20)’ can’t be established.
ECDSA key fingerprint is SHA256:FUb7Ac05C3dxzzwbFU513Q9sNM/MGvmh6ZS/7V2T6QA.
ECDSA key fingerprint is MD5:d0:3f:92:a1:a1:92:1a:e1:fd:1f:d3:f5:b3:03🇩🇪e7.
Are you sure you want to continue connecting (yes/no)? yewHsH
Please type ‘yes’ or ‘no’: yes
Warning: Permanently added ‘192.168.102.20’ (ECDSA) to the list of known hosts.
root@192.168.102.20’s password:
openrc.sh 100% 3813 1.5MB/s 00:00
传送文件完成后,进行初始化
[root@localhost ~]# iaas-pre-host.sh
初始化完成之后进行组件的安装,先安装MySQL
在这里插入图片描述
主节点要跑的脚本
[root@compute ~]# iaas-install-mysql.sh
[root@compute ~]# iaas-install-keystone.sh
[root@compute ~]# iaas-install-glance.sh
[root@compute ~]# iaas-install-nova-controller.sh
[root@compute ~]# iaas-install-neutron-controller.sh
[root@compute ~]# iaas-install-dashboard.sh

从节点需要跑的脚本
[root@compute ~]# iaas-install-nova-compute.sh
[root@compute ~]# iaas-install-neutron-compute.sh

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值