学习笔记:openstack 实验环境安装

学习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管理界面

你可能感兴趣的:(学习笔记:openstack 实验环境安装)