美文网首页
OpenStack Devstack安装

OpenStack Devstack安装

作者: TEYmL | 来源:发表于2020-09-02 13:37 被阅读0次

    环境准备

    Ubuntu 18.04虚拟机 8G RAM 100G存储

    下载pip

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

    更换pip源

    mkdir .pip
    vi .pip/pip.conf
    #写入以下内容
    [global]
    index-url = http://pypi.douban.com/simple/
    trusted-host = pypi.douban.com
    

    root用户下修改pip源

    #需要先为su设置初始密码
    sudo passwd
    #输入密码
    su - #切换到root用户,并使用root的环境变量,如果不加“-”,则会使用原用户的工作目录和环境变量
    #更改pip源
    mkdir .pip
    vi .pip/pip.conf
    #写入以下内容
    [global]
    index-url = http://pypi.douban.com/simple/
    trusted-host = pypi.douban.com
    

    更换apt源

    mv /etc/apt/sources.list /etc/apt/sources.list.bak
    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-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
    #这是国内的阿里云源,也可以自行更换其他
    
    apt-get update
    apt-get upgrade
    

    如果遇到以下报错

    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) 
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? 
    

    执行以下命令再进行更新

    rm /var/lib/dpkg/lock-frontend
    

    Devstack安装OpenStack

    下载devstack(可以选择切换到稳定分支)

    sudo apt-get install git
    git clone https://github.com/openstack-dev/devstack
    cd devstack
    git checkout remotes/origin/stable/stein
    git checkout -b stein
    

    创建配置文件

    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=password
    ADMIN_PASSWORD=password
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    #FLAT_INTERFACE=enp0s3
    
    HOST_IP="your vm ip"
    

    进入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
    wget -c https://github.com/coreos/etcd/releases/download/v3.3.12/etcd-v3.3.12-linux-amd64.tar.gz
    wget https://bootstrap.pypa.io/get-pip.py
    

    回到devstack目录执行安装脚本

    cd ..
    ./stack.sh
    

    出现g-api service not start的问题

    image.png

    尝试手动systemctl start g-api,之后再执行./stack.sh,问题依旧存在

    最后通过执行./unstack.sh,./clean.sh再执行./stack.sh,问题没有再出现

    参考链接:https://stackoverflow.com/questions/46088665/devstack-glance-error-at-installation

    OpenStack安装成功

    image.png

    相关文章

      网友评论

          本文标题:OpenStack Devstack安装

          本文链接:https://www.haomeiwen.com/subject/xdtwsktx.html