有的错误也可以参考:Ubuntu16.4安装Devstack报错的解决办法
①修改yum源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
vi /etc/yum.repos.d/CentOS-Base.repo
文件内容改为:
# CentOS-Base.repo
[base]
releasever=7
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
清空并更新缓存:
yum clean all
yum makecache
②修改pip源:
安装并更新pip:
sudo yum -y install epel-release
sudo yum -y install python-pip
sudo pip install --upgrade pip
修改配置文件(默认没有,要自己新建,在root用户下):
cd ~
mkdir .pip
vi ~/.pip/pip.conf
写入如下内容:
[global]
timeout = 6000
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
新安装的centos7需要安装以下部分:
yum provides '*/applydeltarpm'
yum install deltarpm -y
在stack用户下下载并选择版本:
sudo useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
su - stack
git clone https://git.openstack.org/openstack-dev/devstack
cd devstack
git checkout stable/stein
在devstack目录下编写local.conf文件,文件内容见文末尾
然后使用命令开始安装:
. /stack.sh
修改以下文件的内容为pip!=8:
vi /opt/stack/devstack/tools/cap-pip.txt
为了防止运行过程中内核死锁:
echo 20 > /proc/sys/kernel/watchdog_thresh
更新setuptools:
pip install --upgrade setuptools
解决办法:通过以下命令强制更新
sudo pip install --ignore-installed virtualenv
遇到其他类似的如ippaddr等,都通过以上命令强制更新到最新,然后重新安装。
centos7一般会遇到 virtualenv ,ply, ipaddress,enum34的需。
pip install pycodestyle==2.0
PS:如果发现报错依赖的某个包的版本不对,你安装的正确版本后,./stack.sh开始安装,但是版本又回退到错误的版本上去了,就需要修改以下文件:
/opt/stack/requirements/upper-constraints.txt
在这个文件中找到要改版本的哪一行,将后面的版本改正确。
注2:安装完成后是在浏览器中是无法进入的,需要开放端口并保存:
iptables -I INPUT -p tcp --dport 6080 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save
如果还无法进入的话,看下httpd服务是否启动:
systemctl status httpd
如果没有启动的话,start启动一下
附录:local.conf配置文件
local.conf 配置文件(后半部分不用,那是TAAS需要的,可以没有):
[[local|localrc]]
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/sice-html5.git
# Credentials
DATABASE_PASSWORD=admin
ADMIN_PASSWORD=admin
SERVICE_PASSWORD=admin
SERVICE_TOKEN=admin
RABBIT_PASSWORD=admin
HOST_IP= 你的ip
# after is the plugins of tap-service
Q_ML2_PLUGIN_EXT_DRIVERS=port_security
enable_plugin tap-as-a-service https://opendev.org/x/tap-as-a-service
enable_service taas TAAS_SERVICE_DRIVER=TAAS:TAAS:neutron_taas.services.taas.service_drivers.taas_rpc.TaasRpcDriver:default
enable_plugin tap-as-a-service-dashboard https://opendev.org/x/tap-as-a-service-dashboard
enable_plugin tap-as-a-service-tempest-plugin https://opendev.org/x/tap-as-a-service-tempest-plugin