在ubuntu16.04上通过devstack一键部署openstack(一)

2017年12月7号 devstack终于成功部署openstack,别人的一小步,我的一大步

网络配置、集群部署基础参考:http://www.aboutyun.com/forum.php?mod=viewthread&tid=6821&extra=page%3D1&page=1&

我是参照陈沙克老师和下面的博文来安装的,其中遇到一些问题,先提出来,之后整理:

0、先做好网络设置,NAT网络,设置好静态IP、网关、浮动IP、DNS

1、在ubuntu16.04上可以安装成功,在14.04上会出现错误:E:unable to locate package libsystemd-dev。

2、注意提前安装好python-pip

3、陈沙克老师的博文链接:http://www.360doc.com/content/16/0407/00/13792507_548464714.shtml

讲解local.conf的链接http://www.chenshake.com/local-conf-devstack-profile-parameter-description/

其中,我的local.conf是按照陈沙克老师的来做的,改动了IP

整个流程按照博文:http://blog.sina.com.cn/s/blog_6ccb47550102w2fu.html

以下是整个博文的内容

经过两天在虚拟机中的摸索,重装系统不下十遍,遇到各种坑,终于成功部署,但是由于笔记本配置原因,导致机器非常卡。今天找了台实验室空置的服务器重新安装。过程主要参考陈沙克老师的技术博客,也有自己改动的地方。


安装步骤如下:

1.虚拟机中安装的是ubuntu14.04桌面版,服务器中装的是ubuntu14.04服务器版本。实验证明都可以。


2.由于单节点部署,所以不需要像官方文档那样,开三个网卡,一个用作管理网,一个用作隧道网络,一个作为外网出口。这里只要一个网卡就可以了,虚拟机中用的NAT方式,服务器的话直接静态设的IP,保证能够从该网卡上网即可。注意虚拟机中,在cpu的设置里,要打开虚拟化的设置,否则在安装过程中,会一直出错,调试一把就得一个小时,我在这里浪费了很多时间。由于服务器,之前部署过完全的openstack,所以已经支持虚拟化,也可以在BIOS中设置。


3.系统安装完首先换源,国外的源太慢,我这里换的是国内的163源,修改/etc/apt/sourcelist即可,具体做法百度。


4.安装必要的包,ssh要通,git,python-pip ,要提前安装好。


5.apt-get update更新系统并reboot重启。


6.我的服务器ip设置为:

auto em1

iface em1 inet static

address 192.168.1.200

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1

# dns-* options are implemented by the resolvconf package, if installed

dns-nameservers 192.168.1.1

因为服务器连接的路由器的lan口是192.168.1.1,所以要在一个网段,保证服务器能够上网。floating-ip我设置在192.168.1.201----192.168.1.220。原因是服务器配置有限,最多只能开个十来台虚拟机,然后路由器的地址分配从100开始,所以我的IP设为200,避免与实验室别的同学冲突。


7. 进入/home目录下

cd /home 

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


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

cd /home/devstack/tools/ 

./create-stack-user.sh

  该命令会创建stack用户并赋予它特权命令执行权限


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

chown -R stack:stack /home/devstack 

chmod 777 /dev/pts/0

10.切换的stack用户下

su stack 

cd /home/devstack

11.进入devstack目录下,创建local.conf文件,目前的自动安装会根据这个配置文件安装,如果需要安装不同版本的openstack或者选择性的安装相应的组件,可以参照官方文档修改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=000361

ADMIN_PASSWORD=000361

SERVICE_PASSWORD=000361

SERVICE_TOKEN=000361

RABBIT_PASSWORD=000361

#FLAT_INTERFACE=em1


HOST_IP=192.168.1.200

SERVICE_HOST=192.168.1.200

MYSQL_HOST=192.168.1.200

RABBIT_HOST=192.168.1.200

GLANCE_HOSTPORT=192.168.1.200:9292


## Neutron options

Q_USE_SECGROUP=True

FLOATING_RANGE="192.168.1.0/24"

FIXED_RANGE="10.0.0.0/24"

Q_FLOATING_ALLOCATION_POOL=start=192.168.1.201,end=192.168.1.220

PUBLIC_NETWORK_GATEWAY="192.168.1.1"

Q_L3_ENABLED=True

PUBLIC_INTERFACE=em1

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=1

# 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=1

# 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-

# 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


12.运行

./stack.sh


13.成功安装的结果:

This is your host IP address: 192.168.1.200

This is your host IPv6 address: ::1

Horizon is now available at http://192.168.1.200/dashboard

Keystone is serving at http://192.168.1.200:5000/

The default users are: admin and demo

The password: 000361

安装过程中会报错,类似于没有网桥,没有br-int,没有br-tun,没有br-ex等,这是因为在启动服务时消息队列顺序可能发生错误,导致有些服务先启动,有些后启动,而openstack组件之间的耦合性非常高,所以出现这种情况,可以重复安装,一般两到三次便可成功安装。


14测试安装

谷歌浏览器登录

http://192.168.1.200/dashboard

登录检查各项功能。



注:在后期实验过程中,执行nova image-list或者制作镜像时,提示ERROR (CommandError): You must provide a username or user ID via --os-username, --os-user-id, env[OS_USERNAME] or env[OS_USER_ID]

需要选择用户,类似于kilo完全部署中的source admin.py 或者source demo.py

这里进入/home/devstack

source openrc admin admin

或者 

source openrc demo demo



我安装时出现的问题:

运行./stack.sh时,出现错误 [ERROR] ./stack.sh:148 If you wish to run this script anyway run with FORCE=yes,解决方法

$ echo "FORCE=yes" > localrc

$ ./stack.sh

参考链接:https://ask.openstack.org/en/question/1888/problem-with-installing-openstack/

你可能感兴趣的:(在ubuntu16.04上通过devstack一键部署openstack(一))