一、系统和openstack信息
Liunx系统:ubuntu16.04 server 64位
openstack版本:stable/ocata
二、VMware配置
1.处理器:数量1,核心数量2,虚拟化IntelVT-x/EPT开启;
2.内存配置:4G
3.硬盘容量:40G
4.网卡:双网卡(必须能连接互联网),ens33配置成桥接(连接INTERNET),ens34设置成NAT(openstack启动接口);
三、下载ubuntu16.04server.iso并利用VMware安装好系统
镜像链接:
http://releases.ubuntu.com/16.04/ubuntu-16.04.6-server-amd64.iso 参考系统安装过程: javascript:void(0)
四、openstack安装过程详解
前提:必须保持网络畅通无阻,安装openstack需要大量下载第三方软件;
1.ubuntu16.04server仓库源设置
更换apt源为阿里源,提高软件下载速度;
mv /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list
更换为如下内容
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
**切记:**ubuntu16的仓库源代号为xenial,sources.list不能含有其他系统版本代号的仓库源,否则会产生一些列依赖包的问题。
- Ubuntu 14.04 (LTS)代号为trusty
- Ubuntu 15.04 代号为vivid
- Ubuntu 15.10 代号为wily
- Ubuntu 16.04 (LTS)代号为xenial
- Ubuntu 18.04 (LTS)代号为bionic
2.更新ubuntu16server软件
apt-get update
apt-get upgrade
3.新建stack用户
useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
4.设置pip仓库源
设置pip仓库源为国内仓库源,提高python相关库的下载速度;
在stack和root的目录下创建.pip文件夹,并创建pip.conf文件;
执行如下命令:
cd ~
mkdir .pip
vim .pip/pip.conf
pip.conf的内容为如下:
[global]
trusted-host = pypi.douban.com
index-url = http://pypi.douban.com/simple
5.安装基础软件和时区设置
apt-get install ssh
sed -i "s/prohibit-password/yes/g" /etc/ssh/sshd_config //需要设置允许root登录
apt-get install vim
apt-get install git
apt-get install python-pip
pip install --upgrade pip
pip install -U os-testr
设定时区:sudo dpkg-reconfigure tzdata
选择Asia -> 在选择Shanghai -> OK
同步时间命令:
apt-get install ntpdate // 安装时间同步工具
ntpdate cn.pool.ntp.org // 与网络服务器同步时间
date // 查看时间是否已经同步
6.下载devstack项目,版本为stable/ocata
注意:
不能下载最新的版本,因为需要python3.6及其他高版本软件的支持,而ubuntu16 server支持python3.5版本;
在root用户下执行如下命令:
git clone https://github.com/openstack-dev/devstack -b stable/ocata
mv devstack /opt/stack/
chown -R stack:stack /opt/stack/devstack
su - stack
7.配置openstack配置文件local.conf
su stack
cd ~/devstack
vim local.conf
配置内容如下,注意HOST_IP要改为网卡二的地址;
[[local|localrc]]
MULTI_HOST=true
# management & api network
HOST_IP=192.168.12.130
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=openvswitch
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=https://github.com
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git
HORIZON_BRANCH=stable/ocata
KEYSTONE_BRANCH=stable/ocata
NOVA_BRANCH=stable/ocata
NEUTRON_BRANCH=stable/ocata
GLANCE_BRANCH=stable/ocata
CINDER_BRANCH=stable/ocata
SWIFT_BRANCH=stable/ocata
enable_service placement-api
enable_service placement-client
8.执行脚本
这是最关键的一步,由于git网站在国外,所以国内访问国外网站是相当的慢。。。
归结起来,寡人遇到的所有问题基本是网络连接问题。。。
cd ~/devstack
FORCE=yes ./stack.sh
等待很长一段时间,根据的网络情况而定,当出现如下图片是,表示已经成功安装,可以开香槟庆祝了。。。但是,openstack的漫长道路现在才刚开始,一大推的坑在等着你们。。。坚持就是胜利!
五、遇到的问题
1.git clone https://git.openstack.org/openstack/neutron.git /opt/stack/neutron --branch stable/ocata无反应?
尝试用git clone --branch stable/ocata https://git.openstack.org/openstack/neutron.git /opt/stack/neutron命令。
2.依赖库问题
apt-get update
apt-get upgrade
3.If you wish to run this script anyway run with FORCE=yes?
在执行脚本前面添加FORCE=yes,即FORCE=yes ./stack.sh
4.提示pip版本9.0.1过低需要升级到20.0.2版本
执行pip install --upgrade pip
5.遇到软件的版本不对应问题时,应该是apt的仓库源设置错了,记得检查