将apt源换位国内源
4.1. 备份:
cp /etc/apt/sources.list /etc/apt/sources.list.bak
4.2. 编辑: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
- 更新
apt update
apt upgrade
- 时间同步
设定时区:dpkg-reconfigure tzdata
选择Asia -> 再选择Shanghai -> OK
同步时间命令:
1. date -s <时间>
或者:
1. sudo apt-get install ntpdate // 安装时间同步工具
2. sudo ntpdate cn.pool.ntp.org // 与网络服务器同步时间
3. date // 查看时间是否已同步
- 安装pip,并配置pip源
mkdir ~/.pip
vi ~/.pip/pip.conf
// 添加:
[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
- 安装git工具
apt install git
pip install -U os-testr
- 下载devstack(ocata版本)到/home目录
// 如果之前下载过,直接解压到/home目录
cd /home
tar -xf devstack.tar.gz
// 如果没有下载过则:
git clone https://git.openstack.org/openstack-dev/devstack -b stable/ocata
- 创建stack用户
cd /home/devstack/tools/
./create-stack-user.sh
chown -R stack:stack /home/devstack
- 切换stack用户
sudo su - stack
- 安装pip,并配置pip源
mkdir ~/.pip
vi ~/.pip/pip.conf
// 添加:
[global]
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
- 修改local.conf,配置IP
cd /home/devstack
// 修改网络
// Credentials 设置密码,
// Branches设置要装的openstack版本
vim /home/devstack/local.conf
// 我的配置
[[local|localrc]]
#Define images to be automatically downloaded during the DevStack built process.
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=password
ADMIN_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
RABBIT_PASSWORD=password
#FLAT_INTERFACE=em1
HOST_IP=192.168.187.130
SERVICE_HOST=192.168.187.130
MYSQL_HOST=192.168.187.130
RABBIT_HOST=192.168.187.130
GLANCE_HOSTPORT=192.168.187.130:9292
##Neutronoptions
Q_USE_SECGROUP=True
FLOATING_RANGE="192.168.187.0/24"
FIXED_RANGE="10.0.0.0/24"
Q_FLOATING_ALLOCATION_POOL=start=192.168.187.3,end=192.168.187.223
PUBLIC_NETWORK_GATEWAY="192.168.187.2"
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
# 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/ocata
#NOVA_BRANCH=stable/ocata
#NEUTRON_BRANCH=stable/ocata
#SWIFT_BRANCH=stable/ocata
#GLANCE_BRANCH=stable/ocata
#CINDER_BRANCH=stable/ocata
#HEAT_BRANCH=stable/ocata
#TROVE_BRANCH=stable/ocata
#HORIZON_BRANCH=stable/ocata
#SAHARA_BRANCH=stable/ocata
#CEILOMETER_BRANCH=stable/ocata
# 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=TrueLOG_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 driverinstance_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
- 修改git_base的协议为https
cd /home/devstack
vim stackrc
修改GIT_BASE如下:
GIT_BASE=${GIT_BASE:-http://git.openstack.org}
- 执行安装
# 在stack用户下执行
cd /home/devstack
./stack.sh
- 安装完成
显示this is your ip等待,代表安装成功。
- 浏览器输入ip,访问openstack
-
注意: 虚拟机重启后openstack服务不会自动运行,
18.1 恢复逻辑卷组
sudo losetup /dev/loop0 /opt/stack/data/stack-volumes-default-backing-file
sudo losetup /dev/loop1 /opt/stack/data/stack-volumes-lvmdriver-1-backing-file
18.2 启动服务
cd /home/devstack
// 启动服务
screen -c stack-screenrc