將apt源換位國內(nèi)源
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
- 時間同步
設(shè)定時區(qū):dpkg-reconfigure tzdata
選擇Asia -> 再選擇Shanghai -> OK
同步時間命令:
1. date -s <時間>
或者:
1. sudo apt-get install ntpdate // 安裝時間同步工具
2. sudo ntpdate cn.pool.ntp.org // 與網(wǎng)絡(luò)服務(wù)器同步時間
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
- 創(chuàng)建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
// 修改網(wǎng)絡(luò)
// Credentials 設(shè)置密碼誊薄,
// Branches設(shè)置要裝的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的協(xié)議為https
cd /home/devstack
vim stackrc
修改GIT_BASE如下:
GIT_BASE=${GIT_BASE:-http://git.openstack.org}
- 執(zhí)行安裝
# 在stack用戶下執(zhí)行
cd /home/devstack
./stack.sh
- 安裝完成
顯示this is your ip等待履恩,代表安裝成功锰茉。
- 瀏覽器輸入ip,訪問openstack
-
注意: 虛擬機(jī)重啟后openstack服務(wù)不會自動運(yùn)行,
18.1 恢復(fù)邏輯卷組
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 啟動服務(wù)
cd /home/devstack
// 啟動服務(wù)
screen -c stack-screenrc