700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 使用devstack在单机上安装openstack(stein版本)和zun的踩坑之路

使用devstack在单机上安装openstack(stein版本)和zun的踩坑之路

时间:2021-07-26 18:06:14

相关推荐

使用devstack在单机上安装openstack(stein版本)和zun的踩坑之路

需求

公司已有环境是openstack分布式版本,调试有些麻烦,因此想在单机上安装openstack,即devstack,并安装组件zun及zun-ui,以便对zun组件进行调试开发

环境版本

openstack: stable/stein(公司已有版本为该版本)

zun: stable/stein

操作系统:vmware安装的 ubuntu18.04(stein版本不要用16.04,stein版本的bug会的导致使用python3.5报错),也不要用centos7

python:ubuntu18自带python3.6及自行安装python2.7(apt install python)

apt源及必要软件安装(root用户操作)

更改apt源为国内源

cd /etc/aptmv sources.list sources.list.bakvi /etc/apt/sources.list

添加163源如下所示

deb /ubuntu/ bionic main restricted universe multiversedeb /ubuntu/ bionic-security main restricted universe multiversedeb /ubuntu/ bionic-updates main restricted universe multiversedeb /ubuntu/ bionic-proposed main restricted universe multiversedeb /ubuntu/ bionic-backports main restricted universe multiversedeb-src /ubuntu/ bionic main restricted universe multiversedeb-src /ubuntu/ bionic-security main restricted universe multiversedeb-src /ubuntu/ bionic-updates main restricted universe multiversedeb-src /ubuntu/ bionic-proposed main restricted universe multiversedeb-src /ubuntu/ bionic-backports main restricted universe multiversedeb [arch=amd64] /linux/ubuntu bionic stable# deb-src [arch=amd64] /linux/ubuntu bionic stable

安装必要工具

apt-get install git python-pippip install --upgrade pipapt install vim

更换pip为国内源

注:更换为国内源后速度会大幅提升,但是有可能会遇到错误如下:

Could not install packages due to an EnvironmentError: ("Connection broken: error(104, 'Connection reset by peer')", error(104, 'Connection reset by peer'))

该错误困扰本人很久,后在该文 https://www.oukohou.wang//04/21/reocrds_of_installation_errors_and_operations 看到解释,简单说就是下载太快导致服务端关闭了连接,后将国内源删掉后不再报错

cd ~ mkdir .pipvim .pip/pip.conf

添加内容如下:

# pip 清华源[global]index-url = https://pypi.tuna./simple[install]trusted-host = https://pypi.tuna.

devstack安装

下载devstack

# root用户cd /opt# 注意从国内镜像下载,从github下载太慢,且不要下载zip和tar包来使用git clone /openstack/devstack.git -b stable/stein # 指定stein版本

如果下载zip或tar包,会报错如下:

Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name zun was given, but was not able to be found.error in setup command: Error parsing /opt/stack/zun/setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name zun was given, but was not able to be found.

此问题困扰很久,后在 http://omeranson.github.io/blog//02/22/Installing-with-pip-without-a-version 中最后发现作者提到不要直接下载zip文件,本来我是下载的tar包解压来执行的,因为git clone太慢,结果就是一直报这个错。

创建stack用户

cd /devstack/tools./create-stack-user.sh

创建的stack用户家目录在/opt/stack

将devstack目录移动到/opt/stack中,并设置权限

mv /opt/devstack /opt/stackchown -R stack:stack /opt/stack/devstack

切换至stack用户直至安装完成

su stack

创建配置文件

# stack用户cd ~/devstackvim local.conf

添加如下内容

# 本文内容基于 /zun/latest/contributor/quickstart.html 中生成的local.conf修改而来[[local|localrc]]# 本机ipHOST_IP=192.168.221.129DATABASE_PASSWORD=adminRABBIT_PASSWORD=adminSERVICE_TOKEN=adminSERVICE_PASSWORD=adminADMIN_PASSWORD=admin# 下载插件版本TARGET_BRANCH=stable/stein# 该包指定版本,原因见后边TEMPEST_BRANCH=20.0.0# 定义在 DevStack 构建过程中自动下载的镜像,地址失效了,因此注释掉,会自动从默认位置下载# DOWNLOAD_DEFAULT_IMAGES=False# IMAGE_URLS="/cirros/cirros-0.3.4-x86_64-disk.img"# use TryStack git mirror 使用国内镜像源GIT_BASE=NOVNC_REPO=/kanaka/noVNC.gitSPICE_REPO=/git/spice/sice-html5.git# 需要加载的插件,默认会安装nova、cinder、horizon、neutron、keystone等组件,如果需要安装其他组件,则以插件形式安装。注意地址全是国内源enable_plugin zun /openstack/zun $TARGET_BRANCH# zun-tempest-plugin该组件无分支enable_plugin zun-tempest-plugin /openstack/zun-tempest-plugin#This below plugin enables installation of container engine on Devstack.#The default container engine is Dockerenable_plugin devstack-plugin-container /openstack/devstack-plugin-container $TARGET_BRANCH# In Kuryr, KURYR_CAPABILITY_SCOPE is `local` by default,# but we must change it to `global` in the multinode scenario.KURYR_CAPABILITY_SCOPE=globalKURYR_PROCESS_EXTERNAL_CONNECTIVITY=False# 该组件要指定tag,stein分支已经不存在,3.0.0版本对应的是stein。不指定会报错enable_plugin kuryr-libnetwork /openstack/kuryr-libnetwork 3.0.0# install python-zunclient from git 此组件会下载最新版本,最新版要求python>=3.6,暂时无用,因此注释掉# LIBS_FROM_GIT="python-zunclient"# Optional: uncomment to enable the Zun UI plugin in Horizonenable_plugin zun-ui /openstack/zun-ui $TARGET_BRANCH# Optional: uncomment to enable the Heat plugin for container orchestration# enable_plugin heat /openstack/heat $TARGET_BRANCH

TEMPEST_BRANCH指定版本原因是默认情况下会下载最新版本,然后会出现类似如下错误

Obtaining file:///opt/stack/tempesttempest requires Python '>=3.6' but the running Python is 3.5.2

因此指定版本后解决该问题

进入files目录先下载所需的文件

cd ~/devstack/fileswget -c /coreos/etcd/releases/download/v3.1.10/etcd-v3.1.10-linux-amd64.tar.gzwget -c /coreos/etcd/releases/download/v3.1.7/etcd-v3.1.7-linux-amd64.tar.gzwget -c /coreos/etcd/releases/download/v3.3.12/etcd-v3.3.12-linux-amd64.tar.gzwget https://bootstrap.pypa.io/pip/2.7/get-pip.py # python2mv get-pip.py get-pip.py-py27wget https://bootstrap.pypa.io/get-pip.py # python3

以上内容如果下载太慢,可以在能下载下来的机器上下载完成后,拷贝到files目录中

安装

cd ~/devstack./stack.sh

经过漫长等待后见到如下所示即成功:

This is your host IP address: 192.168.221.129This is your host IPv6 address: ::1Horizon is now available at http://192.168.221.129/dashboardKeystone is serving at http://192.168.221.129/identity/The default users are: admin and demoThe password: adminWARNING: Using lib/neutron-legacy is deprecated, and it will be removed in the futureServices are running under systemd unit files.For more information see: /devstack/latest/systemd.htmlDevStack Version: steinChange: c67e7d3bbd15522fc298ed14803c8eda37c Mark our source trees as safe for git to use as other users -04-20 12:15:55 +0200OS Version: Ubuntu 18.04 bionic

打开浏览器访问如上所示地址并输入用户名密码即可登录成功。

见到如下页面时多日阴霾一扫而空,看似简单的过程,实则安装中的各种问题令人头大,建议想要尝试openstack的直接上最新版本,不要用旧版本

如果遇到了其他问题,欢迎讨论

如果要使用命令行执行openstack命令,还要执行source /opt/stack/devstack/openrc admin admin激活环境变量

卸载

cd ~/devstack./unstack.sh./clean.shpip freeze | grep -v '^\-e' | xargs sudo pip uninstall -y

最后删掉/opt/stack目录下除devstack外的所有内容

之后可以重新安装

参考链接

http://omeranson.github.io/blog//02/22/Installing-with-pip-without-a-version

/cgit

/devstack/stein/

/article/v35tdykox*vow5y9vsge

/qq_41773806/article/details/116561060

/p/654e05034427

/zun/latest/contributor/quickstart.html

https://www.oukohou.wang//04/21/reocrds_of_installation_errors_and_operations

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。