最后执行 - 换源完成后执行更新
Centos
sudo yum clean all
sudo yum makecache
Ubuntu
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get upgrade
Rocky
# 清理旧缓存
sudo dnf clean all
# 生成新缓存
sudo dnf makecache
# 验证配置是否生效(检查仓库地址)
sudo dnf repolist
换源
Centos7
目录:/etc/yum.repos.d/CentOS-Base.repo
#备份yum原文件
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
#阿里云源
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#清华大学源
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/repo/Centos-7.repo
Centos8
#阿里云源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
#清华大学源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/repo/centos8/CentOS-Base.repo
Ubuntu22源
目录:/etc/apt/sources.list
注意:此为Ubuntu22源
#腾讯源
deb http://mirrors.cloud.tencent.com/ubuntu jammy main restricted
deb http://mirrors.cloud.tencent.com/ubuntu jammy-updates main restricted
deb http://mirrors.cloud.tencent.com/ubuntu jammy universe
deb http://mirrors.cloud.tencent.com/ubuntu jammy-updates universe
deb http://mirrors.cloud.tencent.com/ubuntu jammy multiverse
deb http://mirrors.cloud.tencent.com/ubuntu jammy-updates multiverse
deb http://mirrors.cloud.tencent.com/ubuntu jammy-backports main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu jammy-security main restricted
deb http://mirrors.cloud.tencent.com/ubuntu jammy-security universe
deb http://mirrors.cloud.tencent.com/ubuntu jammy-security multiverse
#阿里源
deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
Ubuntu24源
#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ noble-backports main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports/ noble-security main restricted universe multiverse
#阿里开源站
deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
Rocky换源
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.tuna.tsinghua.edu.cn/rocky|g' \
-i.bak \
/etc/yum.repos.d/rocky*.repo
本文共 89 个字数,平均阅读时长 ≈ 1分钟
评论 (0)