官網安裝教程連接:https://docs.openstack.org/developer/devstack/ html
我在ubuntu14.04 LTS 桌面版/服務器版都安裝DevStack成功後,在這裏記錄下安裝過程。html5
介紹下安裝環境:python
VMware Workstation Pro 12git
ubuntu14.04 LTS 系統ubuntu
安裝前準備:服務器
一、系統更換ubuntu源 http://blog.csdn.net/u010053463/article/details/49300625,從連接中選擇一個數據源,我選擇的源以下:session
deb http://mirrors.yun-idc.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.yun-idc.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.yun-idc.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.yun-idc.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.yun-idc.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.yun-idc.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.yun-idc.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.yun-idc.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.yun-idc.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.yun-idc.com/ubuntu/ trusty-backports main restricted universe multiverse
二、ubuntu手動配置一個IP,便於在ubuntu系統重啓後,DevStack可以使用。python2.7
三、ubuntu配置一張可以訪問外網的網卡便可。工具
四、因爲安裝環境時會涉及到pip工具,須要把pip源的地址映射到國內:ui
[global] timeout = 6000 index-url = http://pypi.douban.com/simple/ [install] trusted-host = pypi.douban.com
安裝步驟
配置pip源
root@ubuntu:/# mkdir /root/.pip root@ubuntu:/# vi /root/.pip/pip.conf [global] timeout = 6000 index-url = http://pypi.douban.com/simple/ [install] trusted-host = pypi.douban.com
下載DevStack
安裝git工具並下載DevStack
root@ubuntu:/# sudo apt-get install git root@ubuntu:/# cd /home root@ubuntu:/# git clone http://git.trystack.cn/openstack-dev/devstack.git -b stable/mitaka
建立stack用戶
在非root用戶下建立stack
Devstack@ubuntu:~$ cd /home/devstack/tools/
Devstack@ubuntu:~$ sudo ./create-stack-user.sh
爲stack用戶受權
在root用戶下
root@ubuntu:/# vi /etc/sudoers #找到以下一行: root ALL=(ALL:ALL) ALL #添加stack受權: stack ALL=(ALL:ALL) ALL root@ubuntu:/# chown -R stack:stack /home/devstack root@ubuntu:/# chown -R stack:stack /opt/stack
建立local.conf文件
進入/home/devstack目錄下,新建並編輯local.conf文件
root@ubuntu:/# cd /home/devstack
root@ubuntu:/home/devstack# vi local.conf
在local.conf文件中添加以下內容(配置IP根據自身環境修改):
[[local|localrc]] # 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 # CredentialsDATABASE_PASSWORD=pass DATABASE_PASSWORD=pass ADMIN_PASSWORD=pass SERVICE_PASSWORD=pass SERVICE_TOKEN=pass RABBIT_PASSWORD=pass HOST_IP=192.168.28.138 SERVICE_HOST=192.168.28.138 MYSQL_HOST=192.168.28.138 RABBIT_HOST=192.168.28.138 GLANCE_HOSTPORT=192.168.28.138:9292 disable_service n-net enable_service q-svc enable_service q-agt enable_service q-dhcp enable_service q-l3 enable_service q-meta enable_service q-metering enable_service neutron # only support IP v4 SERVICE_IP_VERSION=4 ## Neutron optionsQ_USE_SECGROUP=True FLOATING_RANGE="192.168.28.0/24" FIXED_RANGE="10.0.1.0/24" NETWORK_GATEWAY="10.0.1.254" Q_FLOATING_ALLOCATION_POOL=start=192.168.28.230,end=192.168.28.250 PUBLIC_NETWORK_GATEWAY="192.168.28.2" Q_L3_ENABLED=True PUBLIC_INTERFACE=eth0 Q_USE_PROVIDERNET_FOR_PUBLIC=True OVS_PHYSICAL_BRIDGE=br-ex PUBLIC_BRIDGE=br-ex OVS_BRIDGE_MAPPINGS=public:br-ex # VLAN configuration.Q_PLUGIN=ml2 ENABLE_TENANT_VLANS=True
以stack用戶運行腳本安裝DevStack:
root@ubuntu:/home/devstack# su stack
root@ubuntu:/home/devstack# ./stack.sh
通過如上配置,便可完成安裝。
安裝過程當中會有相關報錯。
錯誤:
解決方法以下:
運行指令:
python import openstack import pbr.version print(pbr.version.VersionInfo('openstacksdk').version_string()) quit() ./unstack.sh ./clean.sh ./stack.sh
如圖所示:
在/usr/local/lib/python2.7/dist-packages/openstack/session.py 第29行中修改「openstacksdk/%s」 爲 「openstacksdk/0.8.1」後,從新安裝。