STEP1: 创建stack用户(一定要!)
sudo useradd -s /bin/bash -d /opt/stack -m stack
sudo chmod +x /opt/stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
sudo -u stack -i //用stack用户登陆
STEP2: git clone devstack
git clone http://git.trystack.cn/openstack/devstack.git -b stable/zed //Key,Sucess
STEP3: 创建和修改local.conf
cd devstack //首先要用stack帐号登陆
vim local.conf //Create
官方文档的配置(单机版)+git.trystack.cn的说明
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
# 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
STEP4:开始部署(110分钟,一次成功)
./stack.sh
=========================
DevStack Component Timing (times are in seconds)
=========================
wait_for_service 14
async_wait 486
osc 381
apt-get 2009
test_with_retry 4
dbsync 3
pip_install 2431
apt-get-update 5
run_process 45
git_timed 875
-------------------------
Unaccounted time 377
=========================
Total runtime 6630秒
=================
Async summary
=================
Time spent in the background minus waits: 767 sec
Elapsed time: 6630 sec
Time if we did everything serially: 7397 sec
Speedup: 1.11569
Post-stack database query stats:
+------------+-----------+-------+
| db | op | count |
+------------+-----------+-------+
| keystone | SELECT | 57957 |
| keystone | INSERT | 97 |
| glance | SELECT | 1000 |
| glance | CREATE | 65 |
| glance | INSERT | 256 |
| glance | SHOW | 8 |
| glance | UPDATE | 13 |
| glance | ALTER | 10 |
| glance | DROP | 3 |
| neutron | SELECT | 4468 |
| neutron | SHOW | 39 |
| neutron | CREATE | 319 |
| cinder | SELECT | 236 |
| cinder | SHOW | 1 |
| cinder | CREATE | 74 |
| cinder | SET | 1 |
| cinder | ALTER | 18 |
| neutron | INSERT | 1128 |
| neutron | UPDATE | 240 |
| neutron | ALTER | 150 |
| neutron | DROP | 52 |
| neutron | DELETE | 27 |
| nova_cell1 | SELECT | 269 |
| nova_cell1 | SHOW | 60 |
| nova_cell1 | CREATE | 210 |
| nova_cell0 | SELECT | 270 |
| nova_cell0 | SHOW | 60 |
| nova_cell0 | CREATE | 210 |
| nova_cell0 | ALTER | 2 |
| nova_cell1 | ALTER | 2 |
| placement | SELECT | 54 |
| placement | INSERT | 55 |
| placement | SET | 2 |
| nova_api | SELECT | 114 |
| nova_cell0 | INSERT | 4 |
| nova_cell0 | UPDATE | 46 |
| placement | UPDATE | 3 |
| nova_cell1 | INSERT | 4 |
| nova_cell1 | UPDATE | 44 |
| cinder | INSERT | 5 |
| cinder | UPDATE | 39 |
| cinder | DELETE | 1 |
| nova_api | INSERT | 20 |
| nova_api | SAVEPOINT | 10 |
| nova_api | RELEASE | 10 |
| keystone | DELETE | 9 |
+------------+-----------+-------+
This is your host IP address: 192.168.0.102
This is your host IPv6 address: ::1
Horizon is now available at http://192.168.0.102/dashboard
Keystone is serving at http://192.168.0.102/identity/
The default users are: admin and demo
The password: secret
Services are running under systemd unit files.
For more information see:
https://docs.openstack.org/devstack/latest/systemd.html
DevStack Version: zed
Change: 30a7d790b6bf45bbcc6333008621b093c84055d1 Fix setting the tempest virtual env constrain
OS Version: Ubuntu 22.04 jammy
2023-01-30 10:15:54.621 | stack.sh completed in 6630 seconds.
总结:
1. 一定要创建stack用户并按照STEP1来做。
2. 国内安装devstack时一定要使用国内的源(ubuntu、devstack、openstacck)。我用github的源安装了一整天都失败,用国内的源一次成功,用时110分钟!
3.因为OpenStack是用python写的,有些依赖可能pip会从外网下(可以设置pip为国内源),但我这次安装很顺利,并没有改Pip源。
4.sudo su stack --login 该命令切换帐号为stack,当前目录切换到stack的home目录下
stack@controller:~$
5.执行安装devstack的脚本时一定要注意:1.用stack登陆;2.cd到/opt/stack/devstack目录下再运行stack.sh。 (stack@controller:~/devstack$ ./stack.sh )
6.如果安装过程中出错(ERROR提示),可打开“/opt/stack/logs/error.log”日志获得线索!
7.虚拟机的CPU推荐2-4核,内存8G,硬盘20G-30G(下图显示安装devstack后剩下6G了)
local.conf设置
devstack可以单机安装,也可以多机安装(控制节点、计算节点)
单机安装local.conf设置
/opt/stack/devstack/local.conf
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
# 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