一、环境准备

1、操作系统配置

关闭selinux,并重启系统。

[root@localhost ~]# cat /etc/sysconfig/selinux
SELINUX=disabled

2、安装所需的包

[root@localhost ~]# yum -y install vim git python-setuptools

yum安装的pip包版本不对,安装时会出错,从网上下载pip源码包,源码安装pip包

pip源我们采用系统默认的源就好,安装pip源码

[root@localhost ~]# tar xvzf pip-6.0.8.tar.gz

[root@localhost ~]# cd pip-6.0.8

[root@localhost pip-6.0.8]# python setup.py install

有一个rpm包,yum源里面没有,需要下载下来手工安装,否则安装时会报错,命令如下:

rpm -ivh python-mox-0.5.3-1.3.x86_64.rpm

二、获取源码

[root@localhost pip-6.0.8]# cd /home/
[root@localhost home]# git clone -b stable/icehouse  https://github.com/openstack-dev/devstack.git

创建stack用户

[root@localhost home]# cd devstack/tools/
[root@localhost tools]# ./create-stack-user.sh
Creating a group called stack
Creating a user called stack
Giving stack user passwordless sudo privileges

为home/devstack目录赋给stack用户可执行权限

[root@localhost tools]# chown -R stack:stack /home/devstack/

三、开始安装

[root@localhost ~]# su stack
[stack@localhost root]$ cd /home/devstack/

编辑本目录下的localrc文件,然后执行安装

[stack@localhost devstack]$ ./stack.sh 

我的localrc文件如下:

HOST_IP=*.*.*.*
DATABASE_PASSWORD=123456
ADMIN_PASSWORD=123456
SERVICE_PASSWORD=123456
SERVICE_TOKEN=123456
RABBIT_PASSWORD=123456

# Reclone each time
RECLONE=true
 
# Python enviroments
#OFFLINE=true
 
## For Keystone
KEYSTONE_TOKEN_FORMAT=PKI

# Enable Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs

# Pre-requisite
ENABLED_SERVICES=rabbit,mysql,key

# Horizon (Dashboard UI) - (always use the trunk)
ENABLED_SERVICES+=,horizon
#HORIZON_REPO=https://github.com/openstack/horizon
#HORIZON_BRANCH=master

# Nova - Compute Service
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-novnc,n-cauth
IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"

## Nova Cells
#ENABLED_SERVICES+=,n-cell
 
# Glance - Image Service
ENABLED_SERVICES+=,g-api,g-reg

# Neutron - Networking Service
# If Neutron is not declared the old good nova-network will be used
ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron

## Neutron - Load Balancing
ENABLED_SERVICES+=,q-lbaas
 
## Neutron - ××× as a Service
ENABLED_SERVICES+=,q-***
 
## Neutron - Firewall as a Service
ENABLED_SERVICES+=,q-fwaas

# VLAN configuration - LinuxBridge + VLAN模式
Q_PLUGIN=linuxbridge
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=1:4094
PHYSICAL_NETWORK=default
LB_PHYSICAL_INTERFACE=eth0

# Cinder - Block Device Service
VOLUME_GROUP="cinder-volumes"
ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch

# Apache fronted for WSGI
APACHE_ENABLED_SERVICES+=keystone
#APACHE_ENABLED_SERVICES+=keystone,swift

安装过程中有如下报错:

Loaded plugins: fastestmirror, refresh-packagekit
Using mysql database backend
Traceback (most recent call last):
  File "/home/devstack/tools/outfilter.py", line 24, in
    import argparse
ImportError: No module named argparse
[stack@localhost devstack]$ sudo pip install argparse
You are using pip version 6.0.8, however version 7.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting argparse
  Downloading argparse-1.3.0-py2.py3-none-any.whl
Installing collected packages: argparse

Successfully installed argparse-1.3.0

根据错误提示需要将pip升级到7.0.1版本,升级后重新执行安装脚本
[stack@localhost devstack]$ sudo pip install --upgrade pip

[stack@localhost devstack]$ ./stack.sh

安装过程中可能会遇到各种问题,根据报错信息,一一解决即可

出现下面提示,表示安装完成


Horizon is now available at http://*.*.*.*/
Keystone is serving at http://*.*.*.*:5000/v2.0/
Examples on using novaclient command line is in exercise.sh
The default users are: admin and demo
The password: 123456
This is your host ip: *.*.*.*

然后可以通过horizon登陆系统。