linux常用系统源

Centos7

  • 1.备份
1
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  • 2.下载新的 CentOS-Base.repo /etc/yum.repos.d/
1
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  • 3.运行 yum makecache 生成缓存

  • 4.其他

**非阿里云ECS用户会出现 Couldn’t resolve host ‘mirrors.cloud.aliyuncs.com’ 信息,不影响使用。用户也可自行修改相关配置: **

1
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

raspberry

  • 1.备份
1
mv /etc/apt/sources.list etc/apt/sources.list.bak
  • 2.换源,编辑/etc/apt/sources.list
1
2
3
4
5
6
cat > /etc/apt/sources.list < EOF
deb http://mirrors.huaweicloud.com/debian/ buster main non-free contrib
deb http://mirrors.huaweicloud.com/debian-security buster/updates main
deb http://mirrors.huaweicloud.com/debian/ buster-updates main non-free contrib
deb http://mirrors.huaweicloud.com/debian/ buster-backports main non-free contrib
EOF
  • 3.更新
1
apt update -y