原因:html
看IBM的cloudman博客【天天5分鐘玩轉Openstack】學習的時候,有用到devstack,之前也看到devstack,遂想本身也踩踩坑裝一個。html5
天天5分鐘玩轉Openstack地址: https://www.ibm.com/developerworks/community/blogs/132cfa78-44b0-4376-85d0-d3096cd30d3f?lang=zh (2017/07/27 記錄)python
開始:git
找到官方文檔 https://docs.openstack.org/developer/devstack/ubuntu
看到:If you do not have a preference, Ubuntu 16.04 is the most tested, and will probably go the smoothest.swift
因此從裝 Ubuntu 16.04 開始。bash
動手:python2.7
1.安裝系統:ssh
1. 下載ubuntu的桌面系統: https://www.ubuntu.com/download/desktopide
2. 下載好的鏡像刻到U盤中: 用UltraISO【啓動】->寫入硬盤映像 #菜單的第三個,而後第4個。
3. U盤啓動後開始按步驟安裝完畢。
2.設置系統:
1. 系統裝好後發現ssh不了,坑爹的發現竟然默認不裝openssh-server,理解不了,跟公司申請了外網的代理以後。發現 set http_proxy=10.167.129.21:8080的方式不行。
2. 參照其餘的解決方案,直接設置到 /etc/apt/apt.conf , 內容以下:
Acquire::http::proxy "http://10.167.129.21:8080/"; Acquire::ftp::proxy "ftp://10.167.129.21:8080/"; Acquire::https::proxy "https://10.167.129.21:8080/";
3. pip 的安裝的時候使用代理的方式爲: sudo pip install --upgrade pip --proxy=10.167.129.21:8080
4. 設置了下源爲阿里雲的,直接修改 /etc/apt/sources.list , 內容以下:
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
5. 更新系統源並更新系統 :
sudo apt-get update sudo apt-get upgrade
3.環境準備:
1. git工具安裝。(devstack須要用到)
apt-get install git
2. pip源的設置。(devstack須要用到)
stack@Jump-DevStack:~$ cat .pip/pip.conf [global] trusted-host=mirrors.aliyun.com index-url=http://mirrors.aliyun.com/pypi/simple
4.開始安裝:
1. stack用戶做成。(devstack須要通常用戶執行)
sudo useradd -s /bin/bash -d /opt/stack -m stack echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack sudo su - stack
2.下載devstack
git clone https://git.openstack.org/openstack-dev/devstack cd devstack
3. 建立local.conf文件,拷貝sample文件/opt/stack/devstack/samples/local.conf 到 /opt/stack/devstack/local.conf,進行修改,我修改的地方以下:
ADMIN_PASSWORD=admin1234 DATABASE_PASSWORD=$ADMIN_PASSWORD RABBIT_PASSWORD=$ADMIN_PASSWORD SERVICE_PASSWORD=$ADMIN_PASSWORD
HOST_IP=193.168.140.127 #本機地址,這個是須要提早改好的
GIT_BASE=http://git.trystack.cn #後面這三個是國內的openstack的源的地址,國外的下載實在太慢了。
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git
你能夠提早下載好全部的openstack源碼,分別須要如下: #能夠直接去官網git clone xxxxx.git的方式弄到本地例如: git clone git://git.openstack.org/openstack/heat.git
nova glance cinder horizon keystone neutron swift heat ceilometer tempest
3. 最後一部開始安裝,官網的給出15-20分鐘,我只能呵呵:
./stack.sh
5.我遇到的問題及解決:
1.錯誤: generate-subunit: command not found
#緣由缺乏相關包
#解決方法:安裝相關包,以下
sudo apt-get install python-pip sudo pip install --upgrade pip sudo pip install -U os-testr
2.錯誤消息以下:
2017-04-26 12:36:39.878 | ++lib/tempest:install_tempest:626 tox -r --notest -efull 2017-04-26 12:36:40.786 | full create: /opt/stack/tempest/.tox/tempest 2017-04-26 12:36:59.998 | full installdeps: -r/opt/stack/tempest/requirements.txt 2017-04-26 12:37:00.002 | ERROR: invocation failed (errno 13), args: ['/opt/stack/tempest/tools/tox_install.sh', 'https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt', '-r/opt/stack/tempest/requirements.txt'], cwd: /opt/stack/tempest 2017-04-26 12:37:00.002 | Traceback (most recent call last): 2017-04-26 12:37:00.003 | File "/usr/local/bin/tox", line 11, in <module> 2017-04-26 12:37:00.003 | sys.exit(cmdline()) ...... 2017-04-26 12:37:00.004 | stdout=stdout, stderr=stderr, env=env) 2017-04-26 12:37:00.004 | File "/usr/lib/python2.7/subprocess.py", line 711, in __init__ 2017-04-26 12:37:00.004 | errread, errwrite) 2017-04-26 12:37:00.004 | File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child 2017-04-26 12:37:00.004 | raise child_exception 2017-04-26 12:37:00.005 | OSError: [Errno 13] Permission denied ...... 2017-04-26 12:37:00.433 | +./stack.sh:exit_trap:507 [[ -z /opt/stack/logs ]] 2017-04-26 12:37:00.437 | +./stack.sh:exit_trap:510 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs 2017-04-26 12:37:00.814 | +./stack.sh:exit_trap:516 exit 1
#緣由: 由於是手動下載到本地的 /opt/stack/tempest/tools/tox_install.sh 這個忘記給執行權限了
#解決方法:添加一下 chmod + x /opt/stack/tempest/tools/tox_install.sh
3.錯誤:/usr/bin/env: 'bash\r': No such file or directory
#緣由:source中有win的字符集。官網clone下來的文件竟然,,我也是醉了
#解決方法: dos2unix /opt/stack/tempest/tools/tox_install.sh
4.錯誤消息以下:
| 2017-04-27 15:24:24.861 INFO keystone.assignment.core [req-efc745a0-8071-4fff-8f64-0db03a3330c7 None None] Creating the default role 9fe2ff9ee4384b1894a90878d3e92bab because it does not exist. | +./stack.sh:main:1076 create_keystone_accounts | +lib/keystone:create_keystone_accounts:328 local admin_project | ++lib/keystone:create_keystone_accounts:329 openstack project show admin -f value -c id | Failed to discover available identity versions when contacting http://193.168.140.127/identity_admin. Attempting to parse version from URL. | Could not determine a suitable URL for the plugin | +lib/keystone:create_keystone_accounts:329 admin_project= | +lib/keystone:create_keystone_accounts:1 exit_trap | +./stack.sh:exit_trap:492 local r=1 | ++./stack.sh:exit_trap:493 jobs -p | +./stack.sh:exit_trap:493 jobs= | +./stack.sh:exit_trap:496 [[ -n '' ]] | +./stack.sh:exit_trap:502 kill_spinner | +./stack.sh:kill_spinner:388 '[' '!' -z '' ']' | +./stack.sh:exit_trap:504 [[ 1 -ne 0 ]] | +./stack.sh:exit_trap:505 echo 'Error on exit' | Error on exit | +./stack.sh:exit_trap:506 generate-subunit 1493276941 946 fail | +./stack.sh:exit_trap:507 [[ -z /opt/stack/logs ]] | +./stack.sh:exit_trap:510 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs | +./stack.sh:exit_trap:516 exit 1