ubuntu14.0.4.3 devstack 安装openstack

参考网址:

http://www.chenshake.com/install-ubuntu-14-04-devstack/

现在装完一切正常,就是不能重启,一旦重启VM,会导致给br-ex设置的IP地址丢失,正在想办法解决。

在虚拟机安装完成后,可以使用快照保存,下次使用时恢复即可。物理机没有办法。

网络环境

vmware workstation,安装ubuntu 14.04 虚拟机,记住,最小化安装,仅仅安装ssh server服务就可以。

虚拟机使用NAT网络,虚拟机默认通过dhcp获得的IP地址是

192.168.27.128/24

auto eth0
iface eth0 inet static
address 192.168.27.128
netmask 255.255.255.0
network 192.168.27.0
broadcast 192.168.27.255
gateway 192.168.27.2
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 114.114.114.114
dns-search test.com

vmware workstation默认设置分配的IP地址池是128开始分配。所以我的

Floating Ip是:192.168.27.102到192.168.27.110

网关是:192.168.27.2

查看网关命令:route -n

ubuntu14.0.4.3 devstack 安装openstack

ubuntu14.0.4.3 devstack 安装openstack

看图,就应该很清楚 http://docs.openstack.org/developer/devstack/guides/neutron.html

ubuntu14.0.4.3 devstack 安装openstack

设置ubuntu源

对于ubuntu的系统,默认安全会从国外的源安装,导致速度比较慢。

sudo gedit /etc/apt/sources.list

deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

允许update

sudo apt-get update

记得同步一下时间

sudo ntpdate ntp.sjtu.edu.cn

安装

sudo apt-get install git

下载devstack

cd /home
git clone http://git.trystack.cn/openstack-dev/devstack.git

目前Devstack脚本已经不支持直接使用root身份运行,你需要创建stack用户运行

cd /home/devstack/tools/
./create-stack-user.sh
sudo passwd stack

修改devstack目录权限,让stack用户可以运行

chown -R stack:stack /home/devstack
chmod /dev/pts/

可以考虑在虚拟机里增加一块磁盘专门给cinder使用,这个需要在运行脚本前创建好。(可选)

pvcreate /dev/sdb
vgcreate stack-volumes-default /dev/sdb

切换的stack用户下

su stack
cd /home/devstack

进入devstack目录下,创建local.conf文件

[[local|localrc]]
# Define images to be automatically downloaded during the DevStack built process.
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=pass
ADMIN_PASSWORD=pass
SERVICE_PASSWORD=pass
SERVICE_TOKEN=pass
RABBIT_PASSWORD=pass
#FLAT_INTERFACE=eth0 HOST_IP=192.168.27.128
SERVICE_HOST=192.168.27.128
MYSQL_HOST=192.168.27.128
RABBIT_HOST=192.168.27.128
GLANCE_HOSTPORT=192.168.27.128: ## 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 # Work offline
#OFFLINE=True
# Reclone each time
RECLONE=yes # Branches Now the devstack have bug in keystone and neutron for liberty. so we need use master
#KEYSTONE_BRANCH=stable/liberty
#NOVA_BRANCH=stable/liberty
#NEUTRON_BRANCH=stable/liberty
#SWIFT_BRANCH=stable/liberty
#GLANCE_BRANCH=stable/liberty
#CINDER_BRANCH=stable/liberty
#HEAT_BRANCH=stable/liberty
#TROVE_BRANCH=stable/liberty
#HORIZON_BRANCH=stable/liberty
#SAHARA_BRANCH=stable/liberty
#CEILOMETER_BRANCH=stable/liberty # 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 # the number of days by setting ``LOGDAYS``.
LOGDAYS=
# Database Backend MySQL
enable_service mysql
# RPC Backend RabbitMQ
enable_service rabbit # Enable Keystone - OpenStack Identity Service
enable_service key
# Horizon - OpenStack Dashboard Service
enable_service horizon
# Enable Swift - Object Storage Service without replication.
enable_service s-proxy s-object s-container s-account
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=
# Enable Glance - OpenStack Image service
enable_service g-api g-reg # Enable Cinder - Block Storage service for OpenStack
#VOLUME_GROUP="cinder-volumes"
enable_service cinder c-api c-vol c-sch c-bak
# Enable Heat (orchestration) Service
#enable_service heat h-api h-api-cfn h-api-cw h-eng
# Enable Trove (database) Service
enable_service trove tr-api tr-tmgr tr-cond
# Enable Sahara (data_processing) Service
#enable_service sahara # Enable Tempest - The OpenStack Integration Test Suite
enable_service tempest # 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 - Load Balancing
#enable_service q-lbaas
## Neutron - Firewall as a Service
#enable_service q-fwaas
## Neutron - VPN as a Service
#enable_service q-vpn
# VLAN configuration.
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True # GRE tunnel configuration
#Q_PLUGIN=ml2
#ENABLE_TENANT_TUNNELS=True
# VXLAN tunnel configuration
#Q_PLUGIN=ml2
#Q_ML2_TENANT_NETWORK_TYPE=vxlan # Enable Ceilometer - Metering Service (metering + alarming)
enable_service ceilometer-acompute ceilometer-acentral ceilometer-collector ceilometer-api
enable_service ceilometer-alarm-notify ceilometer-alarm-eval
enable_service ceilometer-anotification
## Enable NoVNC
enable_service n-novnc [[post-config|$NOVA_CONF]]
[DEFAULT]
# Ceilometer notification driver
instance_usage_audit=True
instance_usage_audit_period=hour
notify_on_state_change=vm_and_task_state
notification_driver=nova.openstack.common.notifier.rpc_notifier
notification_driver=ceilometer.compute.nova_notifier

运行

./stack.sh

看看结果

ubuntu14.0.4.3 devstack 安装openstack

测试

用admin登录Dashbord,为了测试,我们创建一个project:test,给project创建一个用户

ubuntu14.0.4.3 devstack 安装openstack

使用该该账户重新登录Dashboard

大概的步骤

  1. 创建lan,分配内网IP地址段,记得设置dns
  2. 创建router,连接外网,同时连接lan
  3. 创建test安全组,允许tcp,udp,icmp全部访问
  4. 上传秘钥,或者创建秘钥
  5. 创建虚拟机,分配floating IP,验证网络所有功能

我是用vmware workstation做实验,我在我的笔记本上,可以直接ssh到虚拟机上,那么基本所有的问题都解决,最好是使用秘钥的方式,这样基本各种功能都测试了一遍。

参考文章

http://docs.openstack.org/developer/devstack/guides/neutron.html

http://blog.chinaunix.net/uid-13152448-id-2906443.html

关于如何重启服务等相关问题

http://www.unixarena.com/2015/08/how-to-stop-and-start-openstack-on-ubuntu.html

http://zqfan.github.io/openstack/2015/01/10/devstack/

上一篇:Debug技巧


下一篇:AngularJS clone directive 指令复制