Ubuntu1804+devstack搭建openstack

終於搭好環境了舒服阿!!

  • 準備工作

安裝git與pip

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

更新apt與pip源

打開/etc/apt/source.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
#這個bionic指的是相應的ubuntu版本,自行百度即可

在主目錄下建立.pip文件夾(隱藏),並寫入文件pip.conf

[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com

下載devstack並且更換位置

git clone https://github.com/openstack-dev/devstack
#要最新版P與O我嘗試過沒成功
devstack/tools/create-stack-user.sh
#運行上述腳本生成stack用戶(注意只運行一次想刪除用戶可以使用ubuntu的用戶管理)
mv devstack /opt/stack
chown -R stack:stack /opt/stack/devstack
#移動文件並授權
#以上操作在root用戶下進行
  • 切換用戶並更新配置

在devstack目錄下建立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=admin
ADMIN_PASSWORD=admin
SERVICE_PASSWORD=admin
SERVICE_TOKEN=admin
RABBIT_PASSWORD=admin
#FLAT_INTERFACE=enp0s3
 
HOST_IP="your vm ip"

再在當前用戶下改變以下pip源

運行./stack.sh即可

  • 玄學操作

要真這麼容易我也沒必要搗鼓這麼長時間了,下面列幾個我遇到的問題

在tempest下可能會告訴你缺乏依賴項,其實就是那些pip包有的安不上或者找不到

解決方法:首先更新pip,然後在添加環境變量(有可能pip3什麼的就不在path裏面)然後在tempest文件夾下pip install那個requirement.txt和test_requirement.txt和那個網址(報錯信息看一下就行),參數什麼--user -c -r我也不知道啥意思,然後pip pip2 pip3.6都運行一次,當然注意linux下python的版本,我弄得是3.6.9這裏就玄學過關了

然後可能會有什麼get-pip.py安不上阿,什麼包的版本信息對不上阿這些自行百度就行比較好找

還有就是下載etcd和cirros的時候會time out, 直接將這兩個文件放入devstack/files/即可

參考連接:https://blog.csdn.net/weixin_33885253/article/details/94613944

ectd與cirros的資源:https://download.csdn.net/download/Asensio_20/12249274

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章