packestack 部署openstack
一、部署packstack
1.1 简介
对于openstack初学者而言,传统部署openstack流程是在过于繁琐,需要多台虚拟机,packstack完美解决这个问题,可以减少了许多繁琐且容易出错的部署流程,packstack可以选择单节点或双节点部署,本次完美使用单节点部署allinone。
1.2 性能搭配
推荐处理器内核至少3个(i5-8300H四核八线程),尽量按你最大的核心分配,否则正式安装会很慢!!!内存推荐6G(4G应该也没问题)。
1.3 准备工作
1.设置免密与、/etc/hosts
2.关闭防火墙、SElinux、NetManager
3.时间同步
4.更换repo源
关闭防火墙
systemctl disable firewalld &&\
systemctl stop firewalld &&\
systemctl disable NetworkManager &&\
systemctl stop NetworkManager &&\
systemctl enable network &&\
systemctl start network
关闭SElinux
vi /etc/selinux/config
修改SELINUX=disabled=
setenforce 0
同步时间ntpdate
yum install ntpdate -y
ntpdate ntp1.aliyun.com
systemctl enable ntpdate
date
1.4 安装
更换阿里云的repo源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
安装openstack-queens,本质只是下载了Q版的repo源,在/etc/yum.repos.d/可以查看到repo源。
yum update -y
yum install -y centos-release-openstack-stein
正式安装
yum install -y openstack-packstack
正式部署
本机大概用了45分钟,此命令非常占用cpu,八代i5u,1cpu3内核也要45分钟,建议至少是这个配置,内存6G就行。因为我电脑只有4内核,所以没敢全给,之前2内核也是很久很久甚至没有成功。
packstack --allinone
安装成功,如果没有出现下列成功提示,请往下浏览,看看有没有我踩过的坑。
**** Installation completed successfully ******
Additional information:
* A new answerfile was created in: /root/packstack-answers-20230510-184017.txt
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* File /root/keystonerc_admin has been created on OpenStack client host 172.25.254.229. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://172.25.254.229/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
* Because of the kernel update the host 172.25.254.229 requires reboot.
* The installation log file is available at: /var/tmp/packstack/20230510-184016-REJ4An/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20230510-184016-REJ4An/manifests
部署完成后操作:
1. wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
2. glance image-create --name image-s --file /root/cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare
3. 创建虚拟机
二、出现的问题
2.1 安装中断临时文件
/root下会生产多个临时安装文件,如果因为某些原因安装中断,可以使用answer继续上次的安装,嫌麻烦也可以不管,实际没有影响。
packtack --answer-file=packstack-answers-20180529-075406.txt
2.2 提示某个安装包出错
提示python2-qpid-proton-0.22.0-1.el7.x86_64安装包出错
172.25.254.229_controller.pp: [ ERROR ]
Applying Puppet manifests [ ERROR ]
ERROR : Error appeared during Puppet run: 172.25.254.229_controller.pp
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install openstack-keystone' returned 1: Error: Package: python2-qpid-proton-0.22.0-1.el7.x86_64 (centos-openstack-queens)
You will find full trace in log /var/tmp/packstack/20230510-173731-PznIbV/manifests/172.25.254.229_controller.pp.log
Please check log file /var/tmp/packstack/20230510-173731-PznIbV/openstack-setup.log for more information
Additional information:
* A new answerfile was created in: /root/packstack-answers-20230510-173732.txt
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* File /root/keystonerc_admin has been created on OpenStack client host 172.25.254.229. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://172.25.254.229/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
尝试手动yum install安装,解决,如果是其它安装包也是同样的方法。
yum install -y python2-qpid-proton-0.22.0-1.el7.x86_64
2.3 leatherman版本太高
提示 facter: error while loading shared libraries: leatherman_curl.so.1.3.0: cannot open shared object file: No such file or directory,leatherman 1.3 版本过高,可以降为1.10 版本。
Installing:
Clean Up [ DONE ]
Discovering ip protocol version [ DONE ]
Setting up ssh keys [ DONE ]
Preparing servers [ DONE ]
Pre installing Puppet and discovering hosts' details[ ERROR ]
ERROR : Failed to run remote script, stdout:
stderr: Warning: Permanently added '172.25.254.229' (ECDSA) to the list of known hosts.
+ trap t ERR
+ facter -p
facter: error while loading shared libraries: leatherman_curl.so.1.3.0: cannot open shared object file: No such file or directory
++ t
++ exit 127
Please check log file /var/tmp/packstack/20230510-173400-VVUxZW/openstack-setup.log for more information
Additional information:
* A new answerfile was created in: /root/packstack-answers-20230510-173401.txt
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
yum downgrade leatherman命令降级,已解决。
[root@openstack yum.repos.d]# yum list | grep leatherman
leatherman.x86_64 1.10.0-1.el7 @epel
leatherman-devel.x86_64 1.10.0-1.el7 epel
[root@openstack yum.repos.d]# yum downgrade leatherman
[root@openstack yum.repos.d]# yum list | grep leatherman
leatherman.x86_64 1.3.0-9.el7 @centos-openstack-queens
leatherman.x86_64 1.10.0-1.el7 epel
leatherman-devel.x86_64 1.10.0-1.el7 epel
三、安装成功
浏览器 http://192.168.136.56/dashboard/auth/login/ 登录页面,IP根据主机IP更改。
cat /root/keystonerc_admin 查看admin用户密码
cat /root/keystonerc_demo 查看demo用户密码
链接外网
网络连接:NAT模式
OpenStack部署方式:--allinone
目录
1.将OpenStack主机网卡添加到br-ex网桥上
2.调整网络配置
3.为虚拟机实例分配浮动IP地址
4.在linux计算机上通过SSH访问虚拟机实例
1.将OpenStack主机网卡添加到br-ex网桥上
其中ens33是主机网卡,“br”开头的是网桥,以下命令可查看网桥
[root@node-a ~]# ovs-vsctl list-br
br-ex
br-int
br-ex是外部网桥,br-int是集成网桥,以下命令可以查看网桥的端口
[root@node-a ~]# ovs-vsctl list-ports br-ex
patch-provnet-72ad633c-84ad-4053-94dc-b226a1799588-to-br-int
[root@node-a ~]#
目前只有一个br-int的Patch端口,并没有端口连接到OpenStack上的外部接口,因此当前OpenStack云平台上的实例无法与外网通信,这里改用网卡配置来将OpenStack主机上的网卡作为一个端口添加到br-ex网桥上(根据自己的网络环境来替换其中的网卡名称、IP地址和DNS服务器等参数值)
创建与br-ex相关的网络配置文件
对ifcfg-br-ex配置文件进行修改
[root@node-a network-scripts]# vi ifcfg-br-ex
关键修改TYPE,DEVICETYPE,以及NAME、DEVICE的值
TYPE="OVSBridge"
DEVICETYPE=ovs
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="br-ex"
DEVICE="br-ex"
ONBOOT="yes"
IPADDR=192.168.187.128
PREFIX=24
GATEWAY=192.168.187.2
DNS1=114.114.114.114
对ifcfg-ens33配置文件修改
[root@node-a network-scripts]# vi ifcfg-ens33
关键修改TYPE, 添加最后两行定义
TYPE="OVSPort"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="c69819c0-e818-4bf7-9df1-db90a30fa5cc"
DEVICE="ens33"
ONBOOT="yes"
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
重启网络
[root@node-a network-scripts]# systemctl restart network
使用ip命令验证配置更改
再次查看br-ex网桥端口
2.调整网络配置
以admin用户登录OpenStack,在“管理员”仪表板下找到“路由”节点,定义了一个名为“route1”的路由器,这是一个虚拟路由器,用于连接外部网络和内部网络,但不符合实际网络环境,所以需要对现有的网络进行重新配置。
(1)清除现有路由器的网关
(2)配置外部网络
从“管理员”仪表盘中打开网络列表,选择“public”网络打开其详情界面
将外部网络现有的子网删除
再创一个同名的子网
(3)调整路由器配置
以demo用户登录OpenStack,打开路由列表
设置网关
编辑路由,更改路由名称
(4)查看网络拓扑图
3.为虚拟机实例分配浮动IP地址
要使外部网络中其他计算机能访问这些实例,就要为该实例分配浮动IP地址
此时已能与外网互通
查看demo与admin账户上路由的接口
4.在linux计算机上通过SSH访问虚拟机实例
(1)将之前创建实例时下载的密钥传到Linux主机上
(2)给密钥添加可执行权限
(3)使用SSH证书登录
ssh -i 私钥文件 <用户名>@<实例IP地址>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏