1 更新Ubuntu的源为国内的阿里源
1.1 备份原来的源文件
cd /etc/apt/
sudo cp sources.list sources.list.bak
就是将sources.list备份到sources.list.bak
1.2 替换源
sudo gedit sources.list
打开文件,替换成阿里云的源即可
东北大学源
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted#Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe#Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe#Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse#Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe#Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse
清华大学源
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
阿里云源
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe#Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe#Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates 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 #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe#Added by software-propertiesdeb http://mirrors.aliyun.com/ubuntu/ xenial-security universedeb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
1.3 更新源和软件
sudo apt-get -y update
更新源
1.4 进行更新
sudo apt-get -y upgrade
2 安装git
sudo apt-get -y install git
3 安装devstack
sudo git clone https://github.com/openstack-dev/devstack.git /opt/devstack
4 创建stack用户
cd /opt/devstack/tools
sudo ./create-stack-user.sh
5 更改/opt/devstack的所有者为stack用户
sudo chown -R stack:stack /opt/devstack
6 切换到stack用户
sudo -i -u stack
7 在/opt/devstack/目录下新建local.conf文件
[[local|localrc]]
# 使用trystack来下载镜像
GIT_BASE=http://git.trystack.cn
#用于指定每次是否重新下载文件,注释掉RECLONE第二次部署时可以很快部署
#OFFLINE=True
RECLONE=True
#用于指定本机的IP地址
HOST_IP=192.168.2.167
# Credentials
DATABASE_PASSWORD=pass
ADMIN_PASSWORD=pass
SERVICE_PASSWORD=pass
SERVICE_TOKEN=pass
RABBIT_PASSWORD=pass
#用于指定devstack下载的openstack分支,本文中直接使用master分支无需指定
#HORIZON_BRANCH=stable/mitaka
#KEYSTONE_BRANCH=stable/mitaka
#NOVA_BRANCH=stable/mitaka
#NEUTRON_BRANCH=stable/mitaka
#GLANCE_BRANCH=stable/mitaka
#CINDER_BRANCH=stable/mitaka
# 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
# Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
8 运行stack
./stack.sh
9 执行失败后的操作
./unstack.sh
./clean.sh
reboot
执行完上述命令后重新执行步骤8。
10 openstack安装成功后会显示如下界面
=========================
DevStack Component Timing
(times are in seconds)
=========================
run_process 141
test_with_retry 5
apt-get-update 8
pip_install 76
osc 187
wait_for_service 44
git_timed 5
dbsync 275
apt-get 5
-------------------------
Unaccounted time 1174
=========================
Total runtime 1920
This is your host IP address: 192.168.2.167
This is your host IPv6 address: ::1
Horizon is now available at http://192.168.2.167/dashboard
Keystone is serving at http://192.168.2.167/identity/
The default users are: admin and demo
The password: pass
WARNING:
Using lib/neutron-legacy is deprecated, and it will be removed in the future
Services are running under systemd unit files.
For more information see:
https://docs.openstack.org/devstack/latest/systemd.html
DevStack Version: rocky
Change: 24fa317234a1282478bc22b666d0f026b6cddad6 Merge "Clean up Glance config files" 2018-04-24 15:13:37 +0000
OS Version: Ubuntu 16.04 xenial
stack@henry-desktop:/opt/devstack$
11 Devstack部署完成后启动了那些服务
方式一:ps aux | grep python
stack@henry-desktop:~$ ps aux | grep 'python'
stack 1053 2.0 1.1 572444 44132 ? Ssl 12:07 12:40 /usr/bin/python /usr/local/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf
root 1552 0.0 0.1 211712 7264 ? S 17:39 0:00 /usr/bin/python /usr/local/bin/privsep-helper --config-file /etc/nova/nova-cpu.conf --privsep_context os_brick.privileged.default --privsep_sock_path /tmp/tmpImpIpV/privsep.sock
root 1723 0.0 0.1 138428 7168 ? S 17:39 0:00 /usr/bin/python /usr/local/bin/privsep-helper --config-file /etc/nova/nova-cpu.conf --privsep_context vif_plug_ovs.privsep.vif_plug --privsep_sock_path /tmp/tmp1RA8X9/privsep.sock
stack 1826 1.2 0.2 555212 9912 ? Ss 12:07 7:22 /usr/bin/python /usr/local/bin/cinder-volume --config-file /etc/cinder/cinder.conf
stack 2092 2.7 3.0 572836 111628 ? S 12:08 16:22 /usr/bin/python /usr/local/bin/cinder-volume --config-file /etc/cinder/cinder.conf
stack 13364 1.1 0.1 274560 6444 ? Ss 11:59 7:06 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 14220 0.0 0.0 274560 3308 ? S 11:59 0:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 14221 0.0 0.0 274560 3308 ? S 11:59 0:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 14222 0.0 0.0 274560 3308 ? S 11:59 0:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 14223 0.0 0.0 274560 3308 ? S 11:59 0:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 14224 0.0 0.0 274560 3304 ? S 11:59 0:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 14225 0.0 0.0 274560 3308 ? S 11:59 0:00 /usr/bin/python /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf
stack 16765 0.0 0.7 290700 27348 ? Ss 12:01 0:09 /usr/bin/python /usr/local/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
stack 16921 0.5 3.5 333028 130860 ? D 12:01 3:18 /usr/bin/python /usr/local/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
stack 16922 0.3 3.8 333172 142684 ? S 12:01 2:04 /usr/bin/python /usr/local/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
stack 16923 0.7 3.4 321276 127156 ? S 12:01 4:38 /usr/bin/python /usr/local/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
stack 16924 2.3 3.4 320860 127860 ? S 12:01 14:26 /usr/bin/python /usr/local/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
stack 18270 0.9 0.1 37212 4788 ? S 11:44 5:51 /usr/bin/python /usr/bin/dstat -tcmndrylpg --tcp --output /opt/stack/logs/dstat-csv.log
stack 18271 4.0 0.1 38396 6312 ? S 11:44 25:34 /usr/bin/python /usr/bin/dstat -tcmndrylpg --top-cpu-adv --top-io-adv --top-mem --swap --tcp
stack 18534 2.6 2.9 294624 107052 ? Ss 12:01 16:30 /usr/bin/python /usr/local/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
stack 19124 2.7 0.6 274428 24128 ? Ss 12:01 16:59 /usr/bin/python /usr/local/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini
stack 19977 2.4 0.5 281568 21416 ? Ss 12:01 15:01 /usr/bin/python /usr/local/bin/neutron-l3-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini
root 20561 0.0 0.2 596776 7860 ? Sl 12:01 0:01 /usr/bin/python /usr/local/bin/neutron-rootwrap-daemon /etc/neutron/rootwrap.conf
stack 20618 1.9 0.5 265296 18504 ? Ss 12:01 12:10 /usr/bin/python /usr/local/bin/neutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini
stack 21219 2.2 0.5 267048 21720 ? Ss 12:02 14:04 /usr/bin/python /usr/local/bin/neutron-metering-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/services/metering/metering_agent.ini
root 21451 0.0 0.0 148332 3128 ? S 12:02 0:00 /usr/bin/python /usr/local/bin/privsep-helper --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --privsep_context neutron.privileged.default --privsep_sock_path /tmp/tmpOt5E4R/privsep.sock
stack 21453 0.0 0.4 266468 15520 ? S 12:02 0:06 /usr/bin/python /usr/local/bin/neutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini
stack 21454 0.0 0.4 267968 14796 ? S 12:02 0:06 /usr/bin/python /usr/local/bin/neutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini
stack 21615 0.0 0.0 21312 932 pts/18 S+ 22:14 0:00 grep --color=auto python
root 22934 0.0 0.0 148224 2996 ? S 12:02 0:00 /usr/bin/python /usr/local/bin/privsep-helper --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini --privsep_context neutron.privileged.default --privsep_sock_path /tmp/tmpALGRbi/privsep.sock
root 23217 0.0 0.2 301592 8424 ? Sl 12:03 0:00 /usr/bin/python /usr/local/bin/neutron-rootwrap-daemon /etc/neutron/rootwrap.conf
root 23939 0.0 0.1 375580 5456 ? Sl 12:03 0:00 /usr/bin/python /usr/local/bin/neutron-rootwrap-daemon /etc/neutron/rootwrap.conf
root 24363 0.0 0.1 208736 4644 ? Sl 17:00 0:00 python3 /usr/lib/software-properties/software-properties-dbus
stack 26765 1.5 0.2 273560 9200 ? Ss 12:03 9:23 /usr/bin/python /usr/local/bin/nova-scheduler --config-file /etc/nova/nova.conf
stack 28043 2.0 1.0 278624 39672 ? S 12:04 12:21 /usr/bin/python /usr/local/bin/nova-scheduler --config-file /etc/nova/nova.conf
stack 28044 2.0 0.7 278588 28004 ? S 12:04 12:18 /usr/bin/python /usr/local/bin/nova-scheduler --config-file /etc/nova/nova.conf
stack 28079 0.0 0.1 525848 7344 ? Ss 12:04 0:19 /usr/bin/python /usr/local/bin/nova-novncproxy --config-file /etc/nova/nova.conf --web /opt/stack/noVNC
stack 28944 2.0 0.7 280228 27352 ? Ss 12:04 12:46 /usr/bin/python /usr/local/bin/nova-consoleauth --config-file /etc/nova/nova.conf
stack 29868 1.5 0.2 267564 8796 ? Ss 12:04 9:32 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova.conf
stack 30526 1.5 0.2 267520 9784 ? Ss 12:04 9:37 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova_cell1.conf
stack 30694 2.0 0.7 282500 28920 ? S 12:04 12:21 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova.conf
stack 30695 2.0 1.0 282048 38416 ? S 12:04 12:19 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova.conf
stack 31436 2.2 1.6 293680 60476 ? S 12:05 13:50 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova_cell1.conf
stack 31437 2.2 2.7 295440 100716 ? S 12:05 13:51 /usr/bin/python /usr/local/bin/nova-conductor --config-file /etc/nova/nova_cell1.conf
stack 31471 2.4 1.0 2007592 38804 ? Ssl 12:05 15:04 /usr/bin/python /usr/local/bin/nova-compute --config-file /etc/nova/nova-cpu.conf
方式二: screen -x