ubuntu 18.04安装S版devstack

2020-02-19 10:42:33 阅读量:


虚拟机准备

虚拟机规格4U5G(越大越好),30G磁盘(建议LVM,空间可灵活调整),网卡静态NAT可上网,系统ubuntu 18.04 live-server。系统安装比较简单,不懂可自行百度。

官方安装方法

https://docs.openstack.org/devstack/latest/
按照官方给出的方法,安装过程可能存在一些问题,下面按照我的方法来吧。


安装过程

登录后,切换到root用户:
sudo su - root
 
更换为清华源(尝试过阿里源,多次失败):
mv /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list

 
填入以下内容:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

 
更新:
apt update
apt upgrade

 
设定时区:
dpkg-reconfigure tzdata
选择Asia -> 在选择Shanghai -> OK

 
pip更换为国内的豆瓣源提升速度:
mkdir .pip
vi .pip/pip.conf

 
填入以下内容:
[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com

 
升级pip,其他:
apt install python-pip
pip install --upgrade pip
pip install -U os-testr

 
通过国内站点下载S版devstack,官方站点下载较慢,-b stable/ 可指定版本
git clone http://git.trystack.cn/openstack-dev/devstack.git -b stable/stein
 
通过脚本创建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.4.0/cirros-0.4.0-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
 
#密码可以根据实际需求修改
ADMIN_PASSWORD=123456
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=$ADMIN_PASSWORD
 
#虚拟机IP根据实际情况修改
HOST_IP=xxx.xxx.xxx.xxx
 
enable_service placement-api
enable_service placement-client

 
手工下载 etcd,cirros,网络原因下载较慢,建议手动下载放入/opt/stack/devstack/files
cd files/
wget -c https://github.com/coreos/etcd/releases/download/v3.3.12/etcd-v3.3.12-linux-amd64.tar.gz
wget -c http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img

 
回到/devstack目录下:
cd /opt/stack/devstack
 
开始正式安装:
./stack.sh
 
如果顺利无报错,根据网络速度,整个过程持续30-60分钟。安装成功界面如下:

\


\

遇到的问题

1、报错env:‘/opt/stack/requirements/.venv/bin/pip’: No such file or directory在~/devstack/local.conf最后面添加如下两行:
enable_service placement-api
enable_service placement-client

 
2、/dev/ubuntu-vg/ubuntu-lv 默认是4G,空间不足,手动调整为10G。sudo lvresize -L 10G -r /dev/ubuntu-vg/ubuntu-lv

3、报错error: command 'x86_64-linux-gnu-gcc' failed with exit status 1sudo apt install python3.6-dev

4、如果遇到其他问题,主要是local.conf的问题,查看并解决报错后,清理上次错误配置
./unstack.sh
./clean.sh
然后再执行 ./stack.sh。
如果遇到超时错误(time-out),则直接再次执行./stack.sh