openSUSE官方仓库有4类。
1、禁用所有软件源:
sudo zypper mr -da
2、获取当前系统的版本号:
version=$(grep "VERSION_ID=" /etc/os-release | sed 's/.*VERSION_ID="\([^"]*\)".*/\1/')
3、添加镜像仓库:
baseUrl=https://mirrors.ustc.edu.cn/openSUSE
sudo zypper ar -fc ${baseUrl}/distribution/leap/${version}/repo/oss USTC:${version}:OSS
sudo zypper ar -fc ${baseUrl}/distribution/leap/${version}/repo/non-oss USTC:${version}:NON-OSS
sudo zypper ar -fc ${baseUrl}/update/leap/${version}/oss USTC:${version}:UPDATE-OSS
sudo zypper ar -fc ${baseUrl}/update/leap/${version}/non-oss USTC:${version}:UPDATE-NON-OSS
4、刷新数据:
sudo zypper update
sudo zypper refresh