準備使用devstack安裝openstack N版,搞一套開發環境出來。一連整了4天,遇到各類問題,各類錯誤,一直到第4天下午4點多才算完成。html
在這個過程當中感受到使用devstack搭建openstack環境仍是有難度的,不光對新手來講,對於我手動源碼裝過不少次的人來講也蠻有難度。或者說是我本身學習能力不夠。html5
我的感受使用devstack,要想成功率高的話必定要選對linux版本。前三天使用ubuntu1604-desktop各類失敗和報錯,最後參考一篇博文才成功。python
準備:linux
網卡配置:git
auto eth0 iface eth0 inet static
address 192.168.14.25
gateway 192.168.14.1
netmask 255.255.255.0
dns-nameservers 192.168.14.1 auto eth1 iface eth1 inet manual
虛擬機規格: 6G內存 + 50G磁盤github
安裝過程:ubuntu
1、更換鏡像源。(怕出問題能夠不換,換了速度快)vim
這裏使用阿里鏡像源,匹配16.04的源。編輯/etc/apt/source.list文件,替換內容爲以下,而後更新。apt-get update服務器
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multive
2、安裝必要工具。網絡
使用devstack須要兩個工具軟件:git 和 pip。準備安裝以前下載這兩個軟件。
apt-get install git apt-get install python-pip
3、配置pip源。
推薦使用的pip源是豆瓣的源。
在/root下建立.pip文件夾,而後建立pip.conf文件,填入豆瓣源。
cd /root mkdir .pip vim pip.conf [global] timeout = 6000 index-url = http://pypi.douban.com/simple/ [install] trusted-host = pypi.douban.com
4、從github上拉取openstack newton版本。首先進入到/home目錄下,而後執行git clone命令。(注:如今newton版本可能已經被下架,如失敗能夠到ocata分支)
cd /home git clone http://git.trystack.cn/openstack-dev/devstack.git -b stable/newton
5、建立stack用戶。
執行上一條命令以後,在/home文件夾下會產生一個devstack的文件夾。以root身份進入/home/devstack/tools/,執行create-stack-user.sh腳本。
執行腳本以後會建立一個叫stack的用戶,並賦予了root權限。
6、建立配置文件local.conf。
在/devstack路徑下建立一個local.conf的配置文件,該文件包括了要安裝的openstack的版本,服務,源碼位置,日誌位置等信息。
因爲安裝過程當中要從github上下文件網速很差會下載超時,而後報錯,這裏使用了九州雲的git源。貌似九州雲的鏡像服務器最近不對,鏡像的URL使用了官網的路徑。
[[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 #OFFLINE=True RECLONE=True # Define images to be automatically downloaded during the DevStack built process. DOWNLOAD_DEFAULT_IMAGES=False IMAGE_URLS="http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img" HOST_IP=192.168.14.25(你的虛擬機eth0網卡IP地址) # Credentials DATABASE_PASSWORD=stack2015 ADMIN_PASSWORD=stack2015 SERVICE_PASSWORD=stack2015 SERVICE_TOKEN=stack2015 RABBIT_PASSWORD=stack2015 HORIZON_BRANCH=stable/newton KEYSTONE_BRANCH=stable/newton NOVA_BRANCH=stable/newton NEUTRON_BRANCH=stable/newton GLANCE_BRANCH=stable/newton CINDER_BRANCH=stable/newton #keystone KEYSTONE_TOKEN_FORMAT=UUID #安裝時依賴報錯因此不啓動這個服務 disable_service tempest ## Swift SWIFT_BRANCH=stable/newton ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account SWIFT_REPLICAS=1 SWIFT_HASH=011688b44136573e209e # Enabling Neutron (network) Service 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 ## Neutron options
#注掉網絡建立命令,成功率會增高。 Q_USE_SECGROUP=True #FLOATING_RANGE="201.0.0.0/24" #FIXED_RANGE="12.0.0.0/24" #Q_FLOATING_ALLOCATION_POOL=start=201.0.0.30,end=201.0.0.39 #PUBLIC_NETWORK_GATEWAY="201.0.0.1" Q_L3_ENABLED=True PUBLIC_INTERFACE=eth1 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 # Logging LOGFILE=/opt/stack/logs/stack.sh.log VERBOSE=True LOG_COLOR=True SCREEN_LOGDIR=/opt/stack/logs
7、修改目錄權限
chown -R stack:stack /home/devstack
chmod -R stack:stack /opt/stack
八 、執行stack.sh腳本。
首先切換到stack用戶,而後進入/home/devstack ,運行./stack.sh。
我在家裏是移動50M帶寬的wifi,第一次成功是60分鐘左右,第二次是45分鐘左右。安裝過程當中順利的話不會報錯,若是報錯超過兩個以上基本上就很難完成。
安裝是一個折磨人的過程,一旦報錯就會錯誤不斷,深有體會。因此若是有童鞋按照個人教程配置運行出錯請隨時留言,避免走彎路。