将下载源变更到国内可以时下载速度大大提升
打开下面的文件
vim /etc/yum.repos.d/CentOS-Base.repo
将原来的注释掉改成:
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=0
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=0
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=0
或者修改源
备份源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
非阿里用户会出现 ’Couldn't resolve host 'mirrors.cloud.aliyuncs.com'信息,不影响使用,可以修改配置
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
修改之后更新缓存
yum makecache
yum install git
将 devstack clone 到 /home/devstack
下
git clone https://github.com/openstack-dev/devstack.git -b stable/rocky /home/devstack
注意Centos7 的用户不要使用最新的版本,会报错,关注一下系统版本与git分支对应关系
如果需要使用特定版本需要 切换分支,建议使用稳定版本
git branch # 查看本地分支
git branch -a # 查看在线分支
git checkout stable/rocky # 切换分支
使用 devstack 提供的工具创建一个 stack 用户
cd /home/devstack/tools/
./create-stack-user.sh
给用户 stack 赋予权限
chown -R stack:stack /home/devstack
chmod 777 /opt/stack -R
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
su stack
在 /home/devstack/samples/
中有 local.conf
的示例,可以根据自己的需求修改后放到 /home/devstack/
下
我的 all in one
配置文件
/home/devstack/local.conf:
[[local|localrc]]
ADMIN_PASSWORD=nomoresecret
DATABASE_PASSWORD=stackdb
RABBIT_PASSWORD=stackqueue
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
# only support IP v4
SERVICE_IP_VERSION=4
# Branches
KEYSTONE_BRANCH=stable/rocky
NOVA_BRANCH=stable/rocky
NEUTRON_BRANCH=stable/rocky
SWIFT_BRANCH=stable/rocky
GLANCE_BRANCH=stable/rocky
CINDER_BRANCH=stable/rocky
git clone http://git.trystack.cn/openstack-dev/devstack -b stable/rocky
LOGFILE=$DEST/logs/stack.sh.log
若禁用tempest服务,则加disabled
disable_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
LOGDAYS=2
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=1
SWIFT_DATA_DIR=$DEST/data
修改好配置文件后就可以开始安装了
cd /home/devstack
./stack.sh
剩下的就是漫长的等待,安装步骤结束并不代表安装成功,可能会出各种各样的问题,需要不停去调试,有时只是连接超时,重新执行安装命令就可以了
安装成功后会显示:
This is your host IP address: 192.168.1.11
This is your host IPv6 address: ::1
Horizon is now available at http://192.168.1.11/dashboard
Keystone is serving at http://192.168.1.11/identity/
The default users are: admin and demo
The password: nomoresecret
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
设置 iptables
sudo iptables -I INPUT 1 -j ACCEPT
查看 ipv4 80 端口是否被监听
netstat -ntlp
访问安装成功后返回的网址,用户名为 admin
,密码为配置文件 (local.conf) 中的 ADMIN_PASSWORD
登陆成功后就可以看到 OpenStack 的 Horizon 界面了
问题1:This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.
++./stack.sh:main:760 err_trap
++./stack.sh:err_trap:556 local r=1
++./stack.sh:err_trap:557 set +o xtrace
stack.sh failed
Error on exit
World dumping... see /opt/stack/logs/worlddump-2021-12-23-044206.txt for details
解决:升级python至3的版本
下一篇: Centos 安装Nginx→