devstack+ubuntu16.04 desktop版安装openstack S版手册

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fengyun_blog/article/details/86626399

安装步骤

(主要是提前准备内容比较多,准备好后,安装起来还算比较顺利)

1.在virtualbox上新建一台ubuntu16.04的虚拟机

安装时选择更新包方式安装,内存10G, 2CPU,配置要高点,否则最后运行openstack时会出现内存不足的问题

2.添加hostonly网卡

系统安装完后,默认是有一块NAT网卡的,虚机可以直接访问外网,但如果想要主机访问虚拟机,比较方便的方法是添加一块hostonly的网卡2, 用于主机通过ssh来访问这台虚拟机,配置静态IP, 192.168.25.X(hostonly网关内的地址就行)

3.虚拟机上安装ssh服务器

sudo apt-get install openssh-server

4.devstack安装时会出现brctl not found问题,提前安装下即可

sudo apt-get install bridge-utils

5.git安装

devstack会用到git工具,安装命令如下:

sudo apt-get install git

6.vim安装

貌似desktop版的ubuntu没有vim,手动安装下

sudo apt-get install vim

7.devstack安装

devstask官方安装方式

最主要的是要创建一个local.conf文件,我的配置信息如下,供参考:

[[local|localrc]]
# Multi-host settings
MULTI_HOST=False
HOST_IP=192.168.25.5
SERVICE_HOST=$HOST_IP
DATABASE_TYPE=mysql
MYSQL_HOST=$HOST_IP
RABBIT_HOST=$HOST_IP

# Passwords
DATABASE_PASSWORD=123
ADMIN_PASSWORD=123
MYSQL_PASSWORD=123
RABBIT_PASSWORD=123
SERVICE_PASSWORD=123
SERVICE_TOKEN=ADMIN


#FIXED_RANGE=192.168.128.0/24
#IPV4_ADDRS_SAFE_TO_USE=192.168.128.0/24
#GIT_BASE=/opt/git
GIT_BASE=http://git.trystack.cn
disable_service n-net
disable_service tempest
disable_service heat
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron
enable_service n-novnc
enable_plugin cyborg git://git.openstack.org/openstack/cyborg
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
VNCSERVER_LISTEN=0.0.0.0
VNCSERVER_PROXYCLIENT_ADDRESS=$SERVICE_HOST
RECLONE=False
#enable Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
LOGDIR=/opt/stack/logs

8.安装中问题解决

安装1~7的步骤安装,只遇到2个问题:

a. /opt/stack/.cache/ 权限问题
最后通过修改文件夹权限解决。

chmod 777 /opt/stack/.cache/
b. pip安装失败

New python executable in /opt/stack/requirements/.venv/bin/python					
Installing setuptools, pip, wheel...					
					
  Complete output from command /opt/stack/requirements/.venv/bin/python - setuptools pip wheel:					
  The directory '/opt/stack/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.					
The directory '/opt/stack/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.					
Looking in links: /usr/local/lib/python2.7/dist-packages, /usr/local/lib/python2.7/dist-packages/virtualenv_support, /usr/local/lib/python2.7/dist-packages/virtualenv_support					
Collecting setuptools					
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/stack/.cache/pip/wheels/18/f6/74/1ced506fa7d7eae87313c56ce8c0297eb509c34b6cf48c3171'					
Consider using the `--user` option or check the permissions.					
					
----------------------------------------					
...Installing setuptools, pip, wheel...done.					
Traceback (most recent call last):					
  File "/usr/local/bin/virtualenv", line 11, in <module>					
    sys.exit(main())					
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 768, in main					
    symlink=options.symlink,					
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1030, in create_environment					
    install_wheel(to_install, py_executable, search_dirs, download=download)					
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 983, in install_wheel					
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)					
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 861, in call_subprocess					
    raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))					
OSError: Command /opt/stack/requirements/.venv/bin/python - setuptools pip wheel failed with error code 1					
+lib/infra:install_infra:1                 exit_trap					
+./stack.sh:exit_trap:522                  local r=1					
++./stack.sh:exit_trap:523                  jobs -p					
+./stack.sh:exit_trap:523                  jobs=					
+./stack.sh:exit_trap:526                  [[ -n '' ]]					
+./stack.sh:exit_trap:532                  '[' -f '' ']'					
+./stack.sh:exit_trap:537                  kill_spinner					
+./stack.sh:kill_spinner:432               '[' '!' -z '' ']'					
+./stack.sh:exit_trap:539                  [[ 1 -ne 0 ]]					
+./stack.sh:exit_trap:540                  echo 'Error on exit'					
Error on exit					
+./stack.sh:exit_trap:542                  type -p generate-subunit					
+./stack.sh:exit_trap:543                  generate-subunit 1548226547 1021 fail					
+./stack.sh:exit_trap:545                  [[ -z /opt/stack/logs ]]					
+./stack.sh:exit_trap:548                  /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs					
+./stack.sh:exit_trap:557                  exit 1					

解决办法:
>virtualenv /opt/stack/requirements/.venv

9.验证

cd devstack/
source openrc admin admin
openstack user list
看到输出以下结果,即安装成功

+----------------------------------+-----------+				
| ID                               | Name      |				
+----------------------------------+-----------+				
| 2b91d58e6b0948a1b5bcd55bac8c0c1c | glance    |				
| 3a04e9ebaec04201b402199b7568ab47 | admin     |				
| 3d67b19660fa426cb7ae9ecd9ed37b51 | neutron   |				
| 5cd5a7fecd604c268e6754df9d8bf56a | nova      |				
| 688fc5c93b1f47219602ce8ebf1c6df5 | cyborg    |				
| ad04c5214ee14a409592faed07d7f128 | cinder    |				
| c4775f6130ab410c8399c52f9db96f0f | alt_demo  |				
| c6ce492233354e79b2126895d4f2f05e | placement |				
| f04a10221d1e45919151cc251b0de932 | demo      |				
+----------------------------------+-----------+

10. 设置电脑重启后openstack服务再启动(开机自启动)

官方有以下操作说明,通过命令方式可以控制openstack服务的重启,
我重启了下电脑,发现目前最新版的devstack已经支持服务开机自动启动了,所以没有必要做其他额外的设定。如果需要查看各服务状态,可以用以下命令:

sudo systemctl status devstack@n-*

openstack服务启动命令

猜你喜欢

转载自blog.csdn.net/fengyun_blog/article/details/86626399