devstack单节点安装-Rocky版本(all in one)

实验环境

  • VMware Workstation 15.2
  • ubuntu18.04
  • 6G内存
  • 40G硬盘容量

前期准备

虚拟机能访问外网,并添加一条DNS:8.8.8.8或8.8.4.4

更换源

重新编辑源

vi /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-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed 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

更新源列表

sudo apt-get update

更新软件(比较源,更新更高版本的软件)

sudo apt-get upgrade

安装git,升级pip

sudo apt-get install git
sudo apt-get install python-pip
sudo pip install --upgrade pip
sudo pip install -U os-testr

创建stack用户(此后大部分操作都在stack用户目录下执行

sudo useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
sudo su – stack

更换pip源为豆瓣源(root和stack用户都需要)

sudo su
mkdir ~/.pip && vi ~/.pip/pip.conf

更换为以下内容:

[global] 
index-url = https://pypi.douban.com/simple  
download_cache = ~/.cache/pip  
[install] 
use-mirrors = true  
mirrors = http://pypi.douban.com/

在stack用户下再次执行更换豆瓣源

  • sudo su - stack 切换为stack用户
  • mkdir ~/.pip && vi ~/.pip/pip.conf

此处同样更换为豆瓣源

执行下面命令更新pip软件,注意在root和stack下都要更换pip源

sudo pip install --upgrade pip

下载devstack并配置local.conf

首先切换回stack用户下~目录,这里选择下载Rocky版本:

git clone https://github.com/openstack-dev/devstack -b stable/rocky

切换到stack用户的devstack/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

这里的etcd文件会在最后执行stack.sh脚本时用到,用来安装etcd组件。不过etcd的安装包会可能由于网络问题无法成功,大家可以在网上找etcd的安装包,下载后拷贝至/files目录,同样可以成功。(本文底部提供了etcd-v3.2.17版本的资源,自取)

在stack用户的/devstack目录下配置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=192.168.xx.xx

enable_service placement-api
enable_service placement-client

disable_service etcd3

执行./stack.sh脚本

在/stack/devstack目录下执行./stack.sh安装脚本

./stack.sh

安装成功

devstack单节点安装-Rocky版本(all in one)_第1张图片
在这里可以看到web登陆地址,账号和密码。

宿主机浏览器输入http://192.168.XX.XX/dashboard即可登陆openstackdevstack单节点安装-Rocky版本(all in one)_第2张图片

常见问题

1.执行./stack.sh报错:stack.sh failing giving error “g-api did not start”
清理安装再重新安装:

./unstack.sh && ./clean.sh   
./stack.sh

2.执行./stack.sh下载cirrors镜像时连接超时
在网络上找到cirros-0.3.0-x86_64-disk.img镜像文件,下载后拷贝至/opt/stack/devstack/files/目录下(最后有资源)

3./opt/stack 目录权限问题

chmod 777 /opt/stack -R

4.用户权限不足,执行./stack.sh报错:
OSError:[Errno13]Permissiondenied:’/usr/local/lib/python2.7/dist-packages/

sudo chown -R  stack:stack /usr/local/lib/python2.7

5.执行./stack.sh报错:
WARNING: The directory ‘/opt/stack/.cache/pip/http’ or its parent directory is not owned by the curr

sudo chown -R root /opt/stack/.cache/pip/
sudo chown -R root /opt/stack/.cache/pip/http/

6.执行./stack.sh报错:
env: ‘/opt/stack/requirements/.venv/bin/pip’: No such file or directory

在stack用户devstack目录下:

stack@hjc-virtual-machine:~/devstack$  virtualenv ../requirements/.venv/

或stack用户~目录下执行:virtualenv …/requirements/.venv/

7.执行./stack.sh报错:Cannot uninstall ‘psutil’. It is a distutils installed project

sudo pip install qdarkstyle --ignore-installed

参考博客与资源链接

安装过程:
https://blog.csdn.net/weixin_40275691/article/details/102887245?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

https://blog.csdn.net/hunjiancuo5340/article/details/85005995

https://www.cnblogs.com/love9527/p/8298959.html

处理报错:
https://blog.csdn.net/ANXIN997483092/article/details/81365588

https://blog.csdn.net/qq_41241568/article/details/79615314

https://blog.csdn.net/zswang9/article/details/79684764

https://blog.csdn.net/qq_40907977/article/details/103452775

资源:
etcd文件:百度网盘 https://pan.baidu.com/s/12sFTeuUz6WzXs83hI9VaJw 提取码:4dk5,解压为文件夹后拷贝;

cirrors镜像:百度网盘 https://pan.baidu.com/s/1BPoiWR9MgQ2rIUQ4ZwQsVg 提取码:p6a7,直接拷贝。

你可能感兴趣的:(linux)