一直想学习下openstakc的源代码,期间用packstack安装成功过,但是devstack一直安装失败,终于在试验了很多次之后,终于成功了!踩坑无数。。。
环境准备:
centos7.3.1611最小化安装(16G内存、60G硬盘、因为直接在服务器上开虚拟机测试的,内存调到比较大,目测4G以上应该都没问题)
devstack版本:newton
openstack版本:newton
安装过程
一、准备工作
1.selinux、firewalld关闭
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2.使用豆瓣pip源
mkdir -p ~/.pip
vi ~/.pip/pip.conf
[global]
index-url = http://pypi.douban.com/simple/
[install]
trusted-host = pypi.douban.com
3.下载并安装EPEL
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
yum repolist ##检查是否已添加至源列表
4.安装工具包
yum install -y Python-pip
pip install --upgrade pip
pip install -U os-testr
yum -y install bridge-utils
yum -y install net-tools
yum install -y git yum-utils
5.更新系统
yum update
二、开始安装
1.下载devstack
git clone https://github.com/openstack-dev/devstack.git -b stable/newton
此处有大坑!注意一定要使用 -b stable/newton 指定devstack版本(与要安装的openstack版本一致),否则基本上不会安装成功!
ps:我一开始下载devstack的时候,没有使用该选项,导致安装到keystone时,调用了未知的参数,一直失败。
2.创建stack用户,并切换至stack用户(devstack默认必须使用stack用户安装)
cd /home/devstack/tools/
./create-stack-user.sh
chown -R stack:stack /home/devstack
chmod 777 /opt/stack -R
su stack
3.创建local.conf文件,这里参考了陈沙克老师博客中的配置。
[[local|localrc]]
DEST=/opt/stack/newton
# 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
#OFFLINE=True
#RECLONE=True
RECLONE=no
# Define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS="http://images.trystack.cn/cirros/cirros-0.3.4-x86_64-disk.img"
HOST_IP=192.168.129.120
# Credentials
DATABASE_PASSWORD=yourpass
ADMIN_PASSWORD=yourpass
SERVICE_PASSWORD=yourpass
SERVICE_TOKEN=yourpass
RABBIT_PASSWORD=yourpass
HORIZON_BRANCH=stable/newton
KEYSTONE_BRANCH=stable/newton
NOVA_BRANCH=stable/newton
NEUTRON_BRANCH=stable/newton
GLANCE_BRANCH=stable/newton
CINDER_BRANCH=stable/newton
#keystone
KEYSTONE_TOKEN_FORMAT=UUID
##Heat
HEAT_BRANCH=stable/newton
enable_service h-eng h-api h-api-cfn h-api-cw
## Swift
SWIFT_BRANCH=stable/newton
ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
SWIFT_REPLICAS=1
SWIFT_HASH=011688b44136573e209e
# Enabling Neutron (network) Service
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service neutron
## Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE="192.168.129.0/24"
FIXED_RANGE="10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.129.200,end=192.168.129.249
PUBLIC_NETWORK_GATEWAY="192.168.129.1"
Q_L3_ENABLED=True
PUBLIC_INTERFACE=eth0
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
# #VLAN configuration.
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
# Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
需要替换的内容是
1)换成你自己的ip地址
HOST_IP=192.168.129.120
2)换成你自己ip地址的网段。
##你ip地址的网段
FLOATING_RANGE="192.168.129.0/24"
##该网段内的一个ip池,自己定一个开始地址和结束地址
Q_FLOATING_ALLOCATION_POOL=start=192.168