部署简介:openstack使用稳定版的rocky版本devstack来部署。部署前准备两台虚机,一台作为compute,一台controller。配置网络使虚机可以连接到外网,停止防火墙,禁止防火墙开机自启,关闭SELINUX。修改配置文件,设为disabled,配置/etc/hostname,/etc/hosts。配置stack用户,新增运行配置文件 local.conf后开启部署。官网参考文档https://docs.openstack.org/devstack/latest/guides/multinode-lab.html
部署详情:
1.增加centos7的虚机,配置ip
2.打开 vi /etc/resolv.conf,增加 nameserver 8.8.8.8
重启网络: service network restart
3.打开 vi /etc/sysconfig/network-scripts/ifcfg-ens160
增加
DNS1=8.8.8.8
重启网络
ifdown ens160
ifup ens160
停止防火墙
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
关闭SELINUX。修改配置文件,设为disabled
vi /etc/selinux/config
SELINUX=disabled
vi /etc/hostname
comtroller 增加rocky-controller
compute增加rocky-compute
vi /etc/hosts
172.22.160.63 rocky-controller
172.22.160.61 rocky-compute
Centos默认的更新源比较慢,换成国内阿里云的源会快很多。
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.backup
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
生成缓存
yum makecache
(3) pip下载超时
修改pip的源为国内的源。
cd ~
mkdir .pip
cd .pip
vim pip.conf
配置内容为
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
/etc/hosts
下载devstack,安全openstack神器(dockey)
yum install git
git clone -b stable/rocky https://git.openstack.org/openstack-dev/devstack
image.png
配置stack用户
devstack/tools/create-stack-user.sh
mv devstack /opt/stack
chown -R stack:stack /opt/stack/devstack
su - stack
cd devstack
新增运行配置文件 local.conf
controller
[[local|localrc]]
HOST_IP=172.22.160.63
FLAT_INTERFACE=ens160
FIXED_RANGE=10.4.128.0/20
FLOATING_RANGE=172.22.160.192/26
FIXED_NETWORK_SIZE=4096
MULTI_HOST=1
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD=admin
DATABASE_PASSWORD=admin
RABBIT_PASSWORD=admin
SERVICE_PASSWORD=admin
GIT_BASE=http://git.trystack.cn
USE_BARBICAN=True
TACKER_BRANCH=stable/rocky
enable_plugin networking-sfc ${GIT_BASE}/openstack/networking-sfc $TACKER_BRANCH
enable_plugin barbican ${GIT_BASE}/openstack/barbican $TACKER_BRANCH
enable_plugin mistral ${GIT_BASE}/openstack/mistral $TACKER_BRANCH
compute配置文件local.conf
[[local|localrc]]
HOST_IP=172.22.160.61 # change this per compute node
FLAT_INTERFACE=ens160
FLOATING_RANGE=172.22.160.192/26
MULTI_HOST=1
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD=admin
DATABASE_PASSWORD=admin
RABBIT_PASSWORD=admin
SERVICE_PASSWORD=admin
DATABASE_TYPE=mysql
SERVICE_HOST=172.22.160.63
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,c-vol,placement-client
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
VNCSERVER_LISTEN=$HOST_IP
VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
开启部署
./stack.sh
问题1 安装过程中报错Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
yum provides '*/applydeltarpm'
yum install deltarpm
问题2 安装过程中报错 SyntaxError: '<' operator not allowed in environment markers
pip install --upgrade pip
pip install --upgrade setuptools
问题3 pip升级后执行./stack.sh又被回退
原因安装检查版本不在范围内,后面又需要高版本。去掉cap-pip.txt 文件中,<10的部分。
Cannot uninstall 'pyOpenSSL'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
问题4 安装过程中报错Cannot uninstall pyOpenSSL. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
pip show pyOpenSSL
cd /usr/lib/python2.7/site-packages
ll | grep 'pyOpenSSL'
将文件改名或删除
问题5 openstack 安装3:mariadb-libs-10.1.20-2.el7.x86_64: [Errno 256] No more mirrors to try.
所有类似的问题在自己电脑下载下来rpm安装包上传到虚机上,手动安装
问题6 安装过程中报错后,都要执行./unstack.sh,再执行./stack.sh,否则会出现一些问题
问题7 会出现一些网速慢导致的报错,修改pip的源为国内的源。
cd ~
mkdir .pip
cd .pip
vim pip.conf
配置内容为
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
vi /opt/stack/devstack/tools/cap-pip.txt
image.png
./stack.sh部署成功后打印如图所示
image.png
虚机关机后自动重启,但是https没有安装成功
image.png
安装成功http://172.22.160.63/dashboard/用户名密码都是admin
关机后重启
service httpd restart
iptables -F(虚机每次重启都要执行)
网友评论