ubuntu16.04 系统下用Devstack部署OpenStack
一、前期准备
设备:win10电脑
软件:VMware Workstation Pro (virtual box)
镜像:ubuntu-16.04.6-desktop-amd64
二、虚拟机配置
内存:4G 处理器:6G
网络适配器:NAT模式
三、安装过程
sudo gedit /etc/apt/sources.list
阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
1、更新
sudo apt-get update
#sudo apt-get upgrade #select keep version in this machine
2、设定时间同步
设定时区
sudo dpkg-reconfigure tzdata
选择Asia -> 在选择Shanghai -> OK
3、首先安装时间同步工具,接下去设置与网络服务器同步时间,最后查看时间是否已经同步
sudo apt-get install ntpdate
sudo ntpdate cn.pool.ntp.org
安装必要的包,ssh要通,git,python-pip ,要提前安装好。
4、下载vim编辑器
sudo apt-get install vim
sudo apt-get install git
sudo apt-get install openssh-server
vim /etc/ssh/sshd_config
在打开的配置文件中找到(or Sadd)PermitRootLogin,将其对应值改为yes。保存退出。
service ssh restart
5、下载安装软件pip
sudo apt-get install python-pip
python -m pip install --upgrade pip
查看pip是否安装成功
pip -V //注意V是大写
pip更换为豆瓣源
cd /root
mkdir .pip
vim pip.conf
插入内容为:
[global]
timeout=6000
index-url=http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
注:很多文档和博客教程,都是配置的豆瓣的pip源,我之前也试过,在安装P版的过程中每次都会报依赖不匹配的错误。后来把pip源注销之后就成功了。
6、下载devstack
cd /opt
two select one, default select the second
git clone https://github.com/openstack-dev/devstack -b stable/pike
git clone http://git.trystack.cn/openstack-dev/devstack -b stable/pike
7、创建stack用户(非root模式下)
首先切换目录:
cd /opt/devstack/tools
sudo ./create-stack-user.sh
echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
将devstack目录放在/opt/stack下,并设置权限
先切换目录:
cd ../../
sudo mv devstack /opt/stack
sudo chown -R stack:stack /opt/stack/devstack
切换到stack用户:
sudo su - stack
查看IP地址:
ip addr
8、创建local.conf文件 在devstack目录下创建的
cd devstack
vim local.conf
插入的内容为:
[[local|localrc]]
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/sice-html5.git
DATABASE_PASSWORD=admin
ADMIN_PASSWORD=admin
SERVICE_PASSWORD=admin
SERVICE_TOKEN=admin
RABBIT_PASSWORD=admin
disable_service etcd3
#etcd3 linux storage service etcd3集群
#download and cp to /devstack/files firstly :reference url :https://blog.csdn.net/chenhaifeng2016/article/details/71122886
https://github.com/coreos/etcd/releases/download/v3.1.7/etcd-v3.1.7-linux-amd64.tar.gz
HOST_IP=192.168.44.131
#此处的HOST_IP为上述步骤中所查看的IP地址
####################################
[[local|localrc]]
Define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img" #maybe you will die here due to network speed question.
#change github to trystack
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
Credentials统一设置登录密码
DATABASE_PASSWORD=admin
ADMIN_PASSWORD=admin
SERVICE_PASSWORD=admin
SERVICE_TOKEN=admin
RABBIT_PASSWORD=admin
#FLAT_INTERFACE=eth0
Branches
KEYSTONE_BRANCH=stable/pike
NOVA_BRANCH=stable/pike
NEUTRON_BRANCH=stable/pike
SWIFT_BRANCH=stable/pike
GLANCE_BRANCH=stable/pike
CINDER_BRANCH=stable/pike
#主机IP,即访问openstack的IP
HOST_IP=192.168.182.113
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 ip网段
FLOATING_RANGE="192.168.182.0/24"
#内网IP段
FIXED_RANGE="10.0.0.0/24"
#可用(可分配)floating IP网段
Q_FLOATING_ALLOCATION_POOL=start=192.168.182.201,end=192.168.182.220
#设置外网的网关(VMware自动默认的)
PUBLIC_NETWORK_GATEWAY="192.168.182.2"
Q_L3_ENABLED=True
#外部网卡(上外网的网卡)
PUBLIC_INTERFACE=eth0
Q_USE_PROVIDERNET_FOR_PUBLIC=True
#设置网桥br-ex以及网络映射
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
VLAN configuration.
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
Work offline
#OFFLINE=True
Reclone each time
RECLONE=yes
Logging
-------
By default stack.sh
output only goes to the terminal where it runs. It can
be configured to additionally log to a file by setting LOGFILE
to the full
path of the destination log file. A timestamp will be appended to the given name.
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
########################
[[local|localrc]]
Define images to be automatically downloaded during the DevStack built process.
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS="http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
#change github to trystack
GIT_BASE=${GIT_BASE:-http://git.trystack.cn}
NOVNC_REPO=${NOVNC_REPO:-http://git.trystack.cn/kanaka/noVNC.git}
Credentials
DATABASE_PASSWORD=000361
ADMIN_PASSWORD=000361
SERVICE_PASSWORD=000361
SERVICE_TOKEN=000361
RABBIT_PASSWORD=000361
#FLAT_INTERFACE=em1
HOST_IP=192.168.1.200
SERVICE_HOST=192.168.1.200
MYSQL_HOST=192.168.1.200
RABBIT_HOST=192.168.1.200
GLANCE_HOSTPORT=192.168.1.200:9292
Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE="192.168.1.0/24"
FIXED_RANGE="10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.1.201,end=192.168.1.220
PUBLIC_NETWORK_GATEWAY="192.168.1.1"
Q_L3_ENABLED=True
PUBLIC_INTERFACE=em1
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
Work offline
#OFFLINE=True
Reclone each time
RECLONE=yes
Branches Now the devstack have bug in keystone and neutron for liberty. so we need use master
#KEYSTONE_BRANCH=stable/liberty
#NOVA_BRANCH=stable/liberty
#NEUTRON_BRANCH=stable/liberty
#SWIFT_BRANCH=stable/liberty
#GLANCE_BRANCH=stable/liberty
#CINDER_BRANCH=stable/liberty
#HEAT_BRANCH=stable/liberty
#TROVE_BRANCH=stable/liberty
#HORIZON_BRANCH=stable/liberty
#SAHARA_BRANCH=stable/liberty
#CEILOMETER_BRANCH=stable/liberty
Logging
-------
By default stack.sh
output only goes to the terminal where it runs. It can
be configured to additionally log to a file by setting LOGFILE
to the full
path of the destination log file. A timestamp will be appended to the given name.
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
the number of days by setting LOGDAYS
.
LOGDAYS=1
Database Backend MySQL
enable_service mysql
RPC Backend RabbitMQ
enable_service rabbit
Enable Keystone - OpenStack Identity Service
enable_service key
Horizon - OpenStack Dashboard Service
enable_service horizon
Enable Swift - Object Storage Service without replication.
enable_service s-proxy s-object s-container s-account
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=1
Enable Glance - OpenStack Image service
enable_service g-api g-reg
Enable Cinder - Block Storage service for OpenStack
#VOLUME_GROUP=“cinder-volumes”
enable_service cinder c-api c-vol c-sch c-bak
Enable Heat (orchestration) Service
#enable_service heat h-api h-api-cfn h-api-cw h-eng
Enable Trove (database) Service
enable_service trove tr-api tr-tmgr tr-cond
Enable Sahara (data_processing) Service
#enable_service sahara
Enable Tempest - The OpenStack Integration Test Suite
enable_service tempest
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 - Load Balancing
#enable_service q-lbaas
Neutron - Firewall as a Service
#enable_service q-fwaas
Neutron - VPN as a Service
#enable_service q-vpn
VLAN configuration.
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
GRE tunnel configuration
#Q_PLUGIN=ml2
#ENABLE_TENANT_TUNNELS=True
VXLAN tunnel configuration
#Q_PLUGIN=ml2
#Q_ML2_TENANT_NETWORK_TYPE=vxlan
Enable Ceilometer - Metering Service (metering + alarming)
enable_service ceilometer-acompute ceilometer-acentral ceilometer-collector ceilometer-api
enable_service ceilometer-alarm-notify ceilometer-alarm-eval
enable_service ceilometer-anotification
Enable NoVNC
enable_service n-novnc
[[post-config|$NOVA_CONF]]
[DEFAULT]
Ceilometer notification driver
instance_usage_audit=True
instance_usage_audit_period=hour
notify_on_state_change=vm_and_task_state
notification_driver=nova.openstack.common.notifier.rpc_notifier
notification_driver=ceilometer.compute.nova_notifier
版权声明:本文为CSDN博主「吾名」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_29985391/article/details/78690270
运行
FORCE=yes ./stack.sh
四、结果
打开火狐浏览器输入http://192.168.44.131/dashboard
出现以下界面则成功
用户名:admin
密码:你设置的密码
登录之后的界面
出错的话:清除然后再运行
./unstack.sh
./clean.sh
安装过程中出错的话基本都是因为网络问题引起的,重新运行一下就可以了。
原文链接:https://blog.csdn.net/m0_43455210/article/details/102965043
转载:https://blog.csdn.net/qq_43618136/article/details/106108809