天天看點

Ubuntu16搭建devstack

環境準備

1. Ubuntu16 配置網絡,管理節點三塊網卡分别為橋接模式、内部網絡、Host-Only(參考VBox),計算節點分别為橋接模式、内部網絡。

# vi /etc/network/interfaces
# reboot
           

管理節點:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).


source /etc/network/interfaces.d/*


# The loopback network interface
auto lo
iface lo inet loopback


# The primary network interface
#auto enp0s3
#iface enp0s3 inet dhcp


auto enp0s3
iface enp0s3 inet static
address 192.168.1.113
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1


auto enp0s8
iface enp0s8 inet manual


auto enp0s9
iface enp0s9 inet manual
           

計算節點:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).


source /etc/network/interfaces.d/*


# The loopback network interface
auto lo
iface lo inet loopback


# The primary network interface
#auto enp0s3
#iface enp0s3 inet dhcp


auto enp0s3
iface enp0s3 inet static
address 192.168.1.115
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1


auto enp0s8
iface enp0s8 inet manual
           

2. 安裝pip和git

apt-get install python-pip
           

3. 使用阿裡的apt源

vi /etc/apt/source.list
           
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
           

部署步驟

1. 擷取devstack的最新穩定版本

# git clone https://git.openstack.org/openstack-dev/devstack -b stable/pike
           

devstack版本位址:http://git.openstack.org/cgit/openstack-dev/devstack/

2. 建立stack使用者

# devstack/tools/create-stack-user.sh
           

3. 為友善起見,将devstack目錄放到/opt/stack下,并設定權限

# mv devstack /opt/stack
# chown -R stack:stack /opt/stack/devstack
           

4. 設定pip的鏡像源

分别為root和stack使用者設定使用國内的pip源:

# mkdir ~/.pip
# vi ~/.pip/pip.conf
           
su - stack
$ mkdir ~/.pip
$ vi ~/.pip/pip.conf
           

pip.conf内容如下:

[global]
index-url = https://pypi.douban.com/simple
download_cache = ~/.cache/pip
[install]
use-mirrors = true
mirrors = http://pypi.douban.com/
           

5. 切換到stack使用者,并在devstack目錄下建立一個local.conf的配置檔案,用于告訴devstack如何在這台伺服器上部署openstack。

# su - stack
$ pwd
$ cd /devstack
$ vi local.conf
           

以下分别是管理節點和計算節點的local.conf内容:

[[local|localrc]]


MULTI_HOST=true


# management & api network
HOST_IP=192.168.1.113                    ##這裡填寫目前伺服器的IP位址
LOGFILE=/opt/stack/logs/stack.sh.log


# Credentials
ADMIN_PASSWORD=admin
MYSQL_PASSWORD=secret
RABBIT_PASSWORD=secret
SERVICE_PASSWORD=secret
SERVICE_TOKEN=abcdefghijklmnopqrstuvwxyz


# enable neutron-ml2-vlan
disable_service n-net
enable_service q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron,q-lbaas,q-fwaas
Q_AGENT=linuxbridge
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=3001:4000
PHYSICAL_NETWORK=default


LOG_COLOR=True
LOGDIR=$DEST/logs
SCREEN_LOGDIR=$LOGDIR/screen


# 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
           
[[local|localrc]]


MULTI_HOST=true
# management & api network
HOST_IP=192.168.1.115             ##這裡填寫目前伺服器的IP位址


# Credentials
ADMIN_PASSWORD=admin
MYSQL_PASSWORD=secret
RABBIT_PASSWORD=secret
SERVICE_PASSWORD=secret
SERVICE_TOKEN=abcdefghijklmnopqrstuvwxyz


# Service information
SERVICE_HOST=192.168.1.113             ##這裡填寫管理節點的IP
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
Q_HOST=$SERVICE_HOST
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST


ENABLED_SERVICES=n-cpu,q-agt,neutron
Q_AGENT=linuxbridge
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=3001:4000
PHYSICAL_NETWORK=default


# vnc config
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
VNCSERVER_LISTEN=$HOST_IP
VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN


LOG_COLOR=True
LOGDIR=$DEST/logs
SCREEN_LOGDIR=$LOGDIR/screen


# 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
           

6. 開始部署devstack

# su - stack
$ cd /devstack
$ ./stack.sh
           

(參考http://cloudman.cc/)

繼續閱讀