Ubuntu系统上双节点部署OpenStack

天下之事常成于困约,而败于奢靡。这篇文章主要讲述Ubuntu系统上双节点部署OpenStack相关的知识,希望能为你提供帮助。


??Ubuntu系统上双节点部署OpenStack??



?安装和部署双节点OpenStack?
?介绍:?
1、宿主机:Win10操作系统
2、在VMware下创建两台虚拟机:
devstack-controller:控制节点 + 网络节点 + 块存储节点 + 计算节点
devstack-compute:计算节点
3、方法:利用Devstack部署OpenStack


?前期准备工作:?
1、下载ubuntu镜像,我用的是ubuntu-14.04.5-server-amd64版本
2、下载vmware workstation,我用的是vmware workstation 12版本
3、下载xshell/SecureCRT/Putty,用于ssh连接虚拟机,方便复制代码
4、安装完vmware后,点击编辑,启动虚拟网络编辑器,选择vmnet8,依次设置子网ip、子网掩码、点击NAT设置,修改网关为192.168.213.2(192.168.213.1默认分给宿主机)
?一、安装控制节点:devstack-controller?
步骤:
?1、安装虚拟机和操作系统:?
内存至少6G,硬盘容量至少在40G以上
CPU一定开启虚拟化,一个默认网卡设置成NAT,添加两个网卡,设置成仅主机模式,然后启动虚拟机,安装操作系统。
安装完毕,进入系统
设置root密码:sudo passwd
sudo和su是不一样的,
sudo:输入当前用户的密码 allen
su:输入切换后的用户密码
?2、通过Xshell远程连接虚拟机:SSH(secure shell)协议:安全外壳协议?
注:若连接不成功,修改ssh_config /etc/ssh/




vi /etc/ssh/ssh_config
PemitRootLogin yes

service ssh restart





问题1:没有sshd_config文件,需要安装openssh-server:apt-get install openssh-server
问题2:vi编辑器无法编辑,需要安装vim编辑器:apt-get install vim
3、配置三个网卡:(*)




auto eth0
iface eth0 inet static
address 192.168.213.10
netmask 255.255.255.0
gateway 192.168.213.2
dns-nameserver 114.114.114.114

auto eth1
iface eth1 inet manual

auto eth2
iface eth2 inet manual





4、修改Ubuntu14.04的apt源为国内的阿里云的源:




cp /etc/apt/sources.list /etc/apt/sources.list.back
vi /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse





配置DNS服务器:




vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4





更新软件源和软件:




apt-get update
apt-get upgrade





?5、安装pip并修改pip源:?




apt-get install python-pip
mkdir ~/.pip
vi ~/.pip/pip.conf





添加




[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com





?6、安装git:?




apt-get install git





7、下载devstack:




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





8、创建stack用户:




devstack/tools/create-stack-user.sh
mv devstack /opt/stack
chown -R stack:stack /opt/stack/devstack





9、切换到stack用户并修改pip源:




su stack
mkdir ~/.pip
vi ~/.pip/pip.conf





添加




[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com





10、设置Devstack的配置文件:




[[local|localrc]]

MULTI_HOST=true
HOST_IP=192.168.213.10 # management & api network
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-vpn
Q_AGENT=linuxbridge
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=3001:4000
PHYSICAL_NETWORK=default

LOG_COLOR=False
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





?11、开始部署:?




./stack.sh





?二、安装计算节点:devstack-compute?
步骤:
?1、安装虚拟机和操作系统:?
内存至少4G,硬盘容量至少在40G以上
CPU一定开启虚拟化,一个默认网卡设置成NAT,添加一个网卡,设置成仅主机模式,然后启动虚拟机,安装操作系统。
安装完毕,进入系统
设置root密码:sudo passwd
sudo和su是不一样的,
sudo:输入当前用户的密码 allen
su:输入切换后的用户密码
?2、通过Xshell远程连接虚拟机:SSH(secure shell)协议:安全外壳协议?
注:若连接不成功,修改ssh_config /etc/ssh/




vi /etc/ssh/ssh_config

PemitRootLogin yes

service ssh restart





问题1:没有sshd_config文件,需要安装openssh-server:apt-get install openssh-server
问题2:vi编辑器无法编辑,需要安装vim编辑器:apt-get install vim
?3、配置网卡:?




auto eth0
iface eth0 inet static
address 192.168.213.11
netmask 255.255.255.0
gateway 192.168.213.2
dns-nameserver 114.114.114.114

auto eth1
iface eth1 inet manual





?4、修改Ubuntu14.04的apt源为国内的阿里云的源:?




cp /etc/apt/sources.list /etc/apt/sources.list.back
vi /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse





配置DNS服务器:




vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4





更新软件源和软件:




apt-get update
apt-get upgrade





?5、安装pip并修改pip源:?




apt-get install python-pip
mkdir ~/.pip
vi ~/.pip/pip.conf





添加




[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com





?6、安装git:?




apt-get install git





?7、下载devstack:?




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





?8、创建stack用户:?




devstack/tools/create-stack-user.sh
mv devstack /opt/stack
chown -R stack:stack /opt/stack/devstack





?9、切换到stack用户并修改pip源:?




su stack
mkdir ~/.pip
vi ~/.pip/pip.conf





添加




[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com





?10、设置Devstack的配置文件:?






[[local|localrc]]

MULTI_HOST=true
HOST_IP=192.168.213.11 # management & api network

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

# Service information
SERVICE_HOST=192.168.213.10
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

CEILOMETER_BACKEND=mongodb
DATABASE_TYPE=mysql

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







?11、开始部署:?




./stack.sh





本文为博主原创文章,未经允许不得转载。
【Ubuntu系统上双节点部署OpenStack】

    推荐阅读