ubuntu18.04系统下用devstack安装openstack(最新版)
ubuntu18.04系统下用devstack安装openstack(最新版)
前期准备:
安装git,升级pip,其他
sudo apt-get install git
sudo apt-get install python-pip
sudo pip install --upgrade pip
sudo pip install -U os-testr
开始安装
- 更换apt源为阿里源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list(如果没有权限,请使用命令:sudo vim /etc/apt/sources.list)
将文本替换为:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
注意不同ubuntu版本的系统代号:
- Ubuntu 14.04 (LTS)代号为trusty
- Ubuntu 15.04 代号为vivid
- Ubuntu 15.10 代号为wily
- Ubuntu 16.04 (LTS)代号为xenial
- Ubuntu 18.04 (LTS)代号为bionic
- 1
- 2
- 3
- 4
- 5
- 更新
sudo apt-get update
sudo apt-get upgrade
- 设定时间同步
- 设定时区:sudo dpkg-reconfigure tzdata
- 选择Asia -> 在选择Shanghai -> OK
同步时间命令:
sudo apt-get install ntpdate // 安装时间同步工具
sudo ntpdate cn.pool.ntp.org // 与网络服务器同步时间
date // 查看时间是否已经同步
- pip更换为豆瓣源
mkdir .pip
vi .pip/pip.conf
写入如下内容:
[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
- 1
- 2
- 3
- 下载devstack,这里目录为~,且下载的为最新版本
- 创建stack用户
devstack/tools/create-stack-user.sh
- 将devstack目录放在/opt/stack下,并设置权限
mv devstack /opt/stack
chown -R stack:stack /opt/stack/devstack
- 切换到stack用户,在安装成功前都在stack用户下
sudo su - stack
- 创建local.conf配置文件
vi local.conf
写入如下内容:
[[local|localrc]]
# Define images to be automatically downloaded during the DevStack built process.
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
#FLAT_INTERFACE=enp0s3
HOST_IP="your vm ip"
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
注意:HOST_IP=你自己的vm ip. 使用“sudo ifconfig -a”查询
- 切换到files目录下,执行如下命令
cd files/
wget -c https://github.com/coreos/etcd/releases/download/v3.1.10/etcd-v3.1.10-linux-amd64.tar.gz
wget -c https://github.com/coreos/etcd/releases/download/v3.1.7/etcd-v3.1.7-linux-amd64.tar.gz
一次下载不成功,多执行几次上述命令,知道成功为止
- 切回到/devstack目录下
cd …
- 运行 ./stack.sh
最终成功,我的安装了30-40分钟:
如果遇到其他问题,主要local.conf
然后清理上次错误配置
./unstack.sh
./clean.sh
然后再执行 ./stack.sh。
如果遇到超时错误(time-out),则直接再次执行./stack.sh
打开chrome,登录:http://172.16.177.128/dashboard, 成功!
其他问题:
a). 执行./stack.sh报错:
env: ‘/opt/stack/requirements/.venv/bin/pip’: No such file or directory
解决:
- 在~/devstack/local.conf最后面添加如下两行:
enable_service placement-api
enable_service placement-client
- 1
- 2
然后在stack用户下,执行:
sudo virtualenv ../requirements/.venv/
- 1
b). 卡在“Cloning into ‘/opt/stack/requirements’…
解决:
- 更换阿里源,注意对应ubuntu的版本
Reference:
基本参照如下链接,并结合自己的安装情况和遇到的问题,写下本文,诚谢!
https://www.cnblogs.com/love9527/p/8298959.html
并参考:
https://blog.csdn.net/qiqishuang/article/details/51990662