1. 系统准备
vmware虚拟机,2C4G,minimum安装,安装Developmen Groups,关selinux,关firewalld,校对系统时间
# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
# 关闭selinux
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
2. 创建stack用户,下载devstack
sudo useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
git clone https://git.openstack.org/openstack-dev/devstack
3. 安装rhel-epel、python-pip,git,配置豆瓣pip源
yum install epel-release
yum install -y python-pip
yum install -y git
mkdir /opt/stack/.pip
cat > /opt/stack/.pip/pip.conf << EOF
[global]
index-url = https://pypi.douban.com/simple/
EOF
4. 修改local.conf配置文件
复制/opt/stack/devstack/samples
里面的local.conf到/opt/stack/devstack/
,修改第一段设置统一的密码,添加第二段设置devstack的下载源为国内的trystack.cn
# 修改密码
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
# 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
5. 手工下载etcd
原先的github下载地址不可用了,安装过程会报错,自己手工下载一个放到/opt/stack/devstack/files
下,下载地址https://storage.googleapis.com/etcd/v3.2.17/etcd-v3.2.17-linux-amd64.tar.gz
6. 安装devstack
/opt/stack/devstack/stack.sh
7. 报错处理
Obtaining file:///opt/stack/cinder
Complete output from command python setup.py egg_info:
Marker evaluation failed, see the following error. For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markers
ERROR:root:Error parsing
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pbr/core.py", line 96, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "/usr/lib/python2.7/site-packages/pbr/util.py", line 258, in cfg_to_args
kwargs = setup_cfg_to_setup_kwargs(config, script_args)
File "/usr/lib/python2.7/site-packages/pbr/util.py", line 456, in setup_cfg_to_setup_kwargs
if pkg_resources.evaluate_marker('(%s)' % env_marker):
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1364, in evaluate_marker
return interpret(parser.expr(text).totuple(1)[1])
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1342, in interpret
return op(nodelist)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1307, in atom
return interpret(nodelist[2])
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1342, in interpret
return op(nodelist)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1324, in comparison
raise SyntaxError(repr(cop)+" operator not allowed in environment markers")
SyntaxError: '<' operator not allowed in environment markers
error in setup command: Error parsing /opt/stack/cinder/setup.cfg: SyntaxError: '<' operator not allowed in environment markers
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /opt/stack/cinder/
You are using pip version 9.0.3, however version 19.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
解决方法:升级setuptools
sudo pip install -U setuptools
1832 static files copied to '/opt/stack/horizon/static'.
+lib/horizon:init_horizon:155 DJANGO_SETTINGS_MODULE=openstack_dashboard.settings
+lib/horizon:init_horizon:155 django-admin compress --force
/opt/stack/devstack/lib/horizon: line 139: 38834 Killed DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $django_admin compress --force
+lib/horizon:init_horizon:1 exit_trap
+./stack.sh:exit_trap:522 local r=137
++./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 /tmp/tmp.BqUiPadLig ']'
+./stack.sh:exit_trap:533 rm /tmp/tmp.BqUiPadLig
+./stack.sh:exit_trap:537 kill_spinner
+./stack.sh:kill_spinner:432 '[' '!' -z '' ']'
+./stack.sh:exit_trap:539 [[ 137 -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 1550198118 3522 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 137
内存不够,swap都用满了,解决方法,扩内存至4G。
安装完成
cd /opt/stack/devstack
source openrc admin
openstack user list
结果如下:
[stack@devstack devstack]$ openstack user list
+----------------------------------+-----------+
| ID | Name |
+----------------------------------+-----------+
| 376ac8386c744d4cab54b6985548f09b | neutron |
| 4c1efeed5a7544fb91d23d1531185da8 | placement |
| 687dab95e5234e5581892a4507c35d7e | demo |
| 6a2e90f5fdbc4b06b06526940b0f804a | cinder |
| 7035aace0adb458ea26ecd69303a780d | glance |
| c61ba606cdf94a7ca905c7c5dd0537ed | nova |
| e1580de800184ca58bc919983c1e5d71 | admin |
| fdc653e08f08430d848fd71c55392597 | alt_demo |
+----------------------------------+-----------+