1. 程式人生 > >網上最新的devstack安裝教程【一鍵部署openstack測試環境】

網上最新的devstack安裝教程【一鍵部署openstack測試環境】

這段時間由於測試需要搭建openstack環境,搜遍谷歌百度進行不下30次嘗試...看了陳沙克等前輩的安裝教程,很多配置資訊都已經過期了。不過大致的步驟基本不變,由於最近devstack在github更新頻繁,可能很多功能被新增更新,源軟體連結可能需要更改。下面給出這段時間安裝的步驟(附最新源),希望對有需要進行一鍵部署openstack測試環境的朋友有幫助。

測試版本:Ubuntu 12.04.5 LTS

系統核心:Linux r10f17332.sqa.zmf 3.2.0-60-generic #91-Ubuntu SMP x86_64 x86_64 

更換163源

cd  /etc/apt
cp sources.list etc-apt-source.list
vim sources.list

把源樣本儲存在etc-apt-source.list後清空sources.list並新增163源

deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main


如果遇到如下報錯:

W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192

執行以下命令解決:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192

更新系統源並更新系統

sudo apt-get update
sudo apt-get upgrade

安裝git工具 【已經安裝跳過此步驟】

apt-get install git

設定pip源 【該源經過測試,目前好用】

mkdir ~/.pip
cd ~/.pip
touch pip.cnf
vim pip.cnf
在檔案裡面寫入並儲存
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple

下載devstack 【使用者目錄】

cd /home/xxx
git clone https://github.com/openstack-dev/devstack.git

執行./stack.sh

只能使用非root使用者(這裡我以xxx為例)執行該指令碼

cd /home/xxx/devstack
./stack.sh
過程需要配置5個密碼,按照提示輸入就可以了。

安裝過程請保持良好的網路狀態,整個過程大概需要20分鐘,安裝完畢後會一下提示

This is your host IP address:x.x.x.x

Hroizon is now available at https://x.x.x.x/

Keystone is serving at http://x.x.x.x:5000/

The default users are:admin and demo

The password:<之前你輸入的密碼>

至此,整個安裝 過程就結束了。

訪問host IP,顯示頁面如下


使用管理員賬號進行登入進入主介面


過程中可能會進行的一些操作

安裝pip:http://pip-cn.readthedocs.org/en/latest/installing.html#get-pip
升級python:http://blog.csdn.net/hanshileiai/article/details/43835413
重灌mysql:http://blog.sina.com.cn/s/blog_73000beb01012eh4.html

如有任何疑惑或問題,歡迎留言討論!