Linux中修改源镜像地址 | 解决软件无法更新以及下载太慢问题


一、centos修改yum源镜像地址:mirrors.163.com(也可改为其他的镜像地址)

  1. 首先备份系统自带yum源配置文件/etc/yum.repos.d/centos-base.repo
[root@iZ91q68xe2hhxlZ yum.repos.d]#  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  1. 进入yum原配置文件所在的文件夹
[root@iZ91q68xe2hhxlZ yum.repos.d]# cd /etc/yum.repos.d/
  1. 下载163的原配置文件(centos7)
[root@iZ91q68xe2hhxlZ yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

二、Ubuntu修改apt-get源

  1. 首先备份自带apt-get原配置文件/etc/apt/sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.bak
  1. 编辑源文件/etc/apt/sources.list。
vim /etc/apt/source.list 
  1. 把源文件内容替换为:
    阿里云源
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

清华大学源

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse   
  1. 更新测试一下
sudo apt-get update


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM