以前就写过一篇关于DevStack安装OpenStack的文章《 使用 DevStack 快速部署 OpenStack 开发环境 》,时过境迁,现在有更好的方式来实现,想到以前的复杂性,觉得有必要更新一下,免得误人子弟。
首先必须感谢陈沙克老师,他们自己做了git.trystack.cn源,提供OpenStack的所有github的mirror,直接是国内玩DevStack的福利啊!听说他在准备Fuel的国内源,相当敬佩,这才是真正为技术发展做贡献的!
这次是基于国内的trystack.cn源安装,简单易用。沙克老师已经写过两篇相关博文,此文仅是做一个记录。
1.1 网络设置
使用VMware Workstation安装,网络连接使用NAT模式,dhcp获得IP地址192.168.27.128/24。NAT的网关是192.168.27.2。
1.2 安装系统
查看IP地址,编辑SSH允许root用户远程登录。
1
2
3
4
5
6
7
8
9
|
root@devstack:~
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:08:52:99
inet addr:192.168.27.128 Bcast:192.168.27.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe08:5299
/64
Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:70 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9022 (9.0 KB) TX bytes:10704 (10.7 KB)
|
1
2
3
|
root@devstack:~
# vi /etc/ssh/sshd_config
PermitRootLogin
yes
|
1.3 设置Ubuntu的源
把Ubuntu的源改成国内的,速度要快很多,我习惯用阿里。
1
2
3
4
5
6
7
8
9
10
|
deb http:
//mirrors
.aliyun.com
/ubuntu/
trusty main restricted universe multiverse
deb http:
//mirrors
.aliyun.com
/ubuntu/
trusty-security main restricted universe multiverse
deb http:
//mirrors
.aliyun.com
/ubuntu/
trusty-updates main restricted universe multiverse
deb http:
//mirrors
.aliyun.com
/ubuntu/
trusty-proposed main restricted universe multiverse
deb http:
//mirrors
.aliyun.com
/ubuntu/
trusty-backports main restricted universe multiverse
deb-src http:
//mirrors
.aliyun.com
/ubuntu/
trusty main restricted universe multiverse
deb-src http:
//mirrors
.aliyun.com
/ubuntu/
trusty-security main restricted universe multiverse
deb-src http:
//mirrors
.aliyun.com
/ubuntu/
trusty-updates main restricted universe multiverse
deb-src http:
//mirrors
.aliyun.com
/ubuntu/
trusty-proposed main restricted universe multiverse
deb-src http:
//mirrors
.aliyun.com
/ubuntu/
trusty-backports main restricted universe multiverse
|
1.4 更新系统
1
|
apt-get update && apt-get dist-upgrade -y
|
2.1 安装git
1
|
apt-get
install
git
|
2.2 下载DevStack
1
2
|
cd
/home
git clone http:
//git
.trystack.cn
/openstack-dev/devstack
.git
|
2.3 创建stack用户
1
2
|
cd
/home/devstack/tools/
.
/create-stack-user
.sh
|
2.4 修改DevStack目录权限,让stack用户可以运行
1
2
|
chown
-R stack:stack
/home/devstack
chmod
777
/dev/pts/0
|
2.5 切换到stack用户
1
2
|
su
stack
cd
/home/devstack
|
2.6 编辑local.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
[[
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"
#change github to trystack
GIT_BASE=${GIT_BASE:-http:
//git
.trystack.cn}
NOVNC_REPO=${NOVNC_REPO:-http:
//git
.trystack.cn
/kanaka/noVNC
.git}
# Credentials
DATABASE_PASSWORD=123456
ADMIN_PASSWORD=123456
SERVICE_PASSWORD=123456
SERVICE_TOKEN=123456
RABBIT_PASSWORD=123456
#FLAT_INTERFACE=eth0
HOST_IP=192.168.27.128
# only support IP v4
SERVICE_IP_VERSION=4
# Enabling Neutron (network) Service
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service neutron
## Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE=
"192.168.27.0/24"
FIXED_RANGE=
"10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.27.102,end=192.168.27.110
PUBLIC_NETWORK_GATEWAY=
"192.168.27.2"
Q_L3_ENABLED=True
PUBLIC_INTERFACE=eth0
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
# VLAN configuration.
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=1100:2999
# Work offline
#OFFLINE=True
# Reclone each time
RECLONE=
yes
# Logging
# -------
# By default ``stack.sh`` output only goes to the terminal where it runs. It can
# be configured to additionally log to a file by setting ``LOGFILE`` to the full
# path of the destination log file. A timestamp will be appended to the given name.
LOGFILE=
/opt/stack/logs/stack
.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=
/opt/stack/logs
|
2.7 运行
1
|
.
/stack
.sh
|
2.8 完成安装
登录Horizon
参考文档:
《 Ubuntu 14.04 Devstack安装 》:http://www.chenshake.com/install-ubuntu-14-04-devstack/
《 Devstack配置文件local.conf参数说明 》:http://www.chenshake.com/local-conf-devstack-profile-parameter-description/