學習筆記:openstack實驗環境安裝

linbsoft發表於2018-04-21

學習openstack 安裝實驗環境,經過諸多挫折,順利搭建,記錄如下,以作備忘。

環境: linux ubuntu16.04.3 , 虛擬機器上安裝,openstack是由devstack安裝 版本stable/pike

兩主機,一個是controller控制節點,安裝所有元件,另一臺是compute1計算節點

控制主機三個虛擬網路卡,計算主機兩個虛擬網路卡

首先兩臺電腦安裝 ubuntu16.04.3 server版,controller第一網路卡設定靜態ip:192.168.0.102, 計算節點compute第一個網路卡ip:192.168.0.103,安裝openssh 並設定允許root遠端登入

分別在兩臺主機開始安裝以下步驟:

1.修改apt為國內源

vi /etc/apt/sources.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

2.更新源

apt update

3.取得devstack程式碼

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

4.建立stack使用者

devstack/tools/create-stack-user.sh

5.移動目錄

mv devstack /opt/stack

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

6.切換到 stack 使用者

su – stack

cd devstack

7.編輯local.conf
在 /opt/stack/devstack 目錄下,建立 local.conf,控制節和計算節點分別如下

————–controller節點———————-
[[local|localrc]]
MULTI_HOST=true

management & api network

HOST_IP=192.168.1.102
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

————–compute節點———————-
[[local|localrc]]

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

LIBVIRT_TYPE=kvm

DEST=/opt/stack
LOGFILE=$DEST/logs/stack.sh.log
VERBOSE=True
LOGDAYS=1
LOG_COLOR=True
RECLONE=false
PIP_UPGRADE=Flase
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS=”http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img”
IP_VERSION=4
SERVICE_IP_VERSION=4
ENABLE_IDENTITY_V2=False
DATABASE_TYPE=mysql
SERVICE_HOST=192.168.1.102
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
ADMIN_PASSWORD=admin
MYSQL_PASSWORD=secret
RABBIT_PASSWORD=secret
SERVICE_PASSWORD=secret

Neutron options

NEUTRON_CREATE_INITIAL_NETWORKS=False
MULTI_HOST=1

—————compute node common section

ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,placement-client,n-novnc
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL=”http://$SERVICE_HOST:6080/vnc_auto.html”

—————compute node special section

HOST_IP=192.168.1.103
FLAT_INTERFACE=ens33
VNCSERVER_PROXYCLIENT_ADDRESS=$HOST_IP
VNCSERVER_LISTEN=$HOST_IP

ENABLED_SERVICES+=,c-vol

8.執行安裝指令碼

./stack.sh

如果中途退出 可以再次執行
也可以執行 ./unstack.sh ./clean.sh清理後重新再執行./stack.sh 直至安裝成功

  1. 安裝成功螢幕

DevStack Component Timing

(times are in seconds)

run_process 50
test_with_retry 10
apt-get-update 46
pip_install 673
osc 283
wait_for_service 93
git_timed 1628
dbsync 41

apt-get 286

Unaccounted time 922

Total runtime 4032

This is your host IP address: 192.168.1.102
This is your host IPv6 address: ::1
Horizon is now available at http://192.168.1.102/dashboard
Keystone is serving at http://192.168.1.102/identity/
The default users are: admin and demo
The password: secret

10.可以在瀏覽器登入web管理介面


相關文章