美文网首页
OpenStack queens 一键安装DevStack

OpenStack queens 一键安装DevStack

作者: Joncc | 来源:发表于2019-10-08 10:18 被阅读0次

    一、DevStack介绍

    Devstack目前是支持Ubuntu16.04和CentOS 7,而且Devstack官方建议使用Ubuntu16.04,所以我们使用Ubuntu 16.04进行安装。

    默认无论是Devstack和OpenStack,都是采用Master的代码进行安装,这样经常会出现,今天安装成功,明天失败,代码时刻在变化。所以我们不仅仅要指定OpenStack的版本,还需要指定Devstack的版本,才能提供安装成功的概率。

    二、DevStack的安装

    1、环境准备

    我使用的操作系统为Ubuntu 16.04的版本,默认的软件包源是国外的,速度相对来说比较慢,所以我们修改文件/etc/apt/sources.list,使用如下命令更改:

    sed -i 's/us.archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list
    sed -i 's/security.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list
    

    更新一下源。

    apt-get update
    

    2、下载devstack

    安装devstack痛苦的其中一个原因,是OpenStack代码,都需要从github下载,这样由于网络的原因,经常导致各种错误,简直让人崩溃,各种错误,目前国内已经提供了完整的OpenStack的github的mirror:http://git.trystack.cn,这样Devstack成功概率会大大提高。

    另外devstack还会下载image,下载的过程也是非常缓慢。trystack也提供大家常用的image下载:http://images.trystack.cn

    目前官方github上面保留着三个稳定的版本,我们这边安装queens版。

    mkdir -p /opt/stack/ && cd /opt/stack
    apt-get install git
    git clone http://git.trystack.cn/openstack-dev/devstack.git -b stable/queens
    

    3、创建stack用户

    目前Devstack脚本已经不支持直接使用root身份运行,你需要创建stack用户运行。

    cd devstack/tools/
    ./create-stack-user.sh
    

    修改devstack目录权限,让stack用户可以运行。

    cd ../..
    chown -R stack:stack /opt/stack
    

    4、配置pip源

    OpenStack很多组件需要从pip源下载,默认是国外的源,我们需要设置为国内的源,以便可以快速的进行配置,在root和stack的加目录下面都配置一下。
    
    首先分别在家目录下面都创建.pip的目录,然后在目录下面创建文件pip.conf,内容如下:
    
    su stack
    mkdir .pip
    cat >> .pip/pip.conf <<EOF
    [global]
    trusted-host =  pypi.douban.com
    index-url = http://pypi.douban.com/simple
    EOF
    

    5、配置文件

    cd devstack
    cp samples/local.conf .
    

    对文件local.conf进行简单修改,如下内容:

    [[local|localrc]]
    ADMIN_PASSWORD=secret
    DATABASE_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    LOGFILE=$DEST/logs/stack.sh.log
    LOGDAYS=2
    SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
    SWIFT_REPLICAS=1
    SWIFT_DATA_DIR=$DEST/data
    
    # 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/spice-html5.git
    

    6、安装

    中途可能会出现多次错误,大部分都是因为网络的原因,重复运行命令即可。

    ./stack.sh
    

    三、验证

    经过长时间的等待之后,根据网络状态,大约1个小时的时间,出现下面的界面即可是安装完成。

    image.png

    然后我们进行登录查看。

    image.png

    可以看到登录成功,服务都运行正常。

    image.png

    附录:

    1、All-In-One Single Machine

    [[local|localrc]]
    FLOATING_RANGE=192.168.1.224/27
    FIXED_RANGE=10.11.12.0/24
    FIXED_NETWORK_SIZE=256
    FLAT_INTERFACE=eth0
    ADMIN_PASSWORD=secret
    DATABASE_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    
    # 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/spice-html5.git
    
    • Set FLOATING_RANGE to a range not used on the local network, i.e. 192.168.1.224/27. This configures IP addresses ending in 225-254 to be used as floating IPs.

    • Set FIXED_RANGE and FIXED_NETWORK_SIZE to configure the internal address space used by the instances.

    • Set FLAT_INTERFACE to the Ethernet interface that connects the host to your local network. This is the interface that should be configured with the static IP address mentioned above.

    • Set the administrative password. This password is used for the admin and demo accounts set up as OpenStack users.

    • Set the MySQL administrative password. The default here is a random hex string which is inconvenient if you need to look at the database directly for anything.

    • Set the RabbitMQ password.

    • Set the service password. This is used by the OpenStack services (Nova, Glance, etc) to authenticate with Keystone.

    2、Multi-Node Lab

    Configure Cluster Controller

    [[local|localrc]]
    HOST_IP=192.168.42.11
    FLAT_INTERFACE=eth0
    FIXED_RANGE=10.4.128.0/20
    FIXED_NETWORK_SIZE=4096
    FLOATING_RANGE=192.168.42.128/25
    MULTI_HOST=1
    LOGFILE=/opt/stack/logs/stack.sh.log
    ADMIN_PASSWORD=secret
    DATABASE_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    
    # 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/spice-html5.git
    

    Configure Compute Nodes

    [[local|localrc]]
    HOST_IP=192.168.42.12    # change this per compute node
    FLAT_INTERFACE=eth0
    FIXED_RANGE=10.4.128.0/20
    FIXED_NETWORK_SIZE=4096
    FLOATING_RANGE=192.168.42.128/25
    MULTI_HOST=1
    LOGFILE=/opt/stack/logs/stack.sh.log
    ADMIN_PASSWORD=secret
    DATABASE_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    DATABASE_TYPE=mysql
    SERVICE_HOST=192.168.42.11
    MYSQL_HOST=$SERVICE_HOST
    RABBIT_HOST=$SERVICE_HOST
    GLANCE_HOSTPORT=$SERVICE_HOST:9292
    ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,c-vol,placement-client
    NOVA_VNC_ENABLED=True
    NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
    VNCSERVER_LISTEN=$HOST_IP
    VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
    
    # 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/spice-html5.git
    

    另外一个模板

    devstack-controller

    [[local|localrc]]
    MULTI_HOST=true 
    HOST_IP=172.18.2.100 # management & api network 
    LOGFILE=/opt/stack/logs/stack.sh.log
    # Credentials 
    ADMIN_PASSWORD=secret
    MYSQL_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    SERVICE_TOKEN=abcdefghijklmnopqrstuvwxyz
    # enable neutron-ml2-vlan 
    disable_service n-net 
    enable_service q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron,q-lbaas,q-fwaas,q-*** 
    Q_AGENT=linuxbridge 
    ENABLE_TENANT_VLANS=True 
    TENANT_VLAN_RANGE=3001:4000 
    PHYSICAL_NETWORK=default
    LOG_COLOR=False 
    LOGDIR=$DEST/logs 
    SCREEN_LOGDIR=$LOGDIR/screen
    # 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/spice-html5.git
    

    devstack-compute

    [[local|localrc]]
    MULTI_HOST=true 
    HOST_IP=172.18.2.101 # management & api network
    # Credentials 
    ADMIN_PASSWORD=secret
    MYSQL_PASSWORD=$ADMIN_PASSWORD
    RABBIT_PASSWORD=$ADMIN_PASSWORD
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    SERVICE_TOKEN=abcdefghijklmnopqrstuvwxyz
    # Service information
    SERVICE_HOST=172.18.2.100
    MYSQL_HOST=$SERVICE_HOST 
    RABBIT_HOST=$SERVICE_HOST 
    GLANCE_HOSTPORT=$SERVICE_HOST:9292 
    Q_HOST=$SERVICE_HOST 
    KEYSTONE_AUTH_HOST=$SERVICE_HOST 
    KEYSTONE_SERVICE_HOST=$SERVICE_HOST
    CEILOMETER_BACKEND=mongodb 
    DATABASE_TYPE=mysql
    ENABLED_SERVICES=n-cpu,q-agt,neutron,placement-api 
    Q_AGENT=linuxbridge 
    ENABLE_TENANT_VLANS=True 
    TENANT_VLAN_RANGE=3001:4000 
    PHYSICAL_NETWORK=default
    # vnc config 
    NOVA_VNC_ENABLED=True 
    NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
    VNCSERVER_LISTEN=$HOST_IP 
    VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
    LOG_COLOR=False 
    LOGDIR=$DEST/logs 
    SCREEN_LOGDIR=$LOGDIR/screen
    # 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/spice-html5.git
    

    相关文章

      网友评论

          本文标题:OpenStack queens 一键安装DevStack

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