linux 更换更新源linux 更换更新源

生命不息,
折腾不止!

linux 更换更新源

CentOS更改yum源与更新系统

方法1: #命令操作,推荐使用 速度快

[root@host]#cd /etc/yum.repos.d    #进入存放源配置的文件夹
[root@host]#mv ./CentOS-Base.repo ./CentOS-Base.repo.bak    #备份默认源
[root@host]#wget mirrors.163.com/.help/CentOS7-Base-163.repo    #使用wget下载163的源
[root@host]#mv CentOS7-Base-163.repo CentOS-Base.repo    #把下载的文件CentOS-Base-163.repo设置默认源

方法2:

首先备份 /etc/yum.repos.d/CentOS-Base.repo 文件内存放 CentOS 更新源的地址

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载对应版本repo文件, 放入 /etc/yum.repos.d/ (操作前请做好相应备份)

[root@host]# wget mirrors.163.com/.help/CentOS5-Base-163.repo    #CentOS5
[root@host]# wget mirrors.163.com/.help/CentOS6-Base-163.repo    #CentOS6
[root@host]# wget mirrors.163.com/.help/CentOS7-Base-163.repo    #CentOS7

然后在 /etc/yum.repos.d/CentOS6-Base-163.repo 修改为 CentOS-Base.repo 即可

[root@host]# yum clean all                #运行yum makecache生成缓存
[root@host]# yum makecache
[root@host]# yum -y update                #更新系统

详情可参照:http://mirrors.163.com/.help/centos.html

 

Ubuntu 更换源 软件源、更新源

根据当前的网络情况和源健康状况不断地进行更新当前可用的源的信息,包括了 Top fast/near/stable mirror,可以找到当前网络上所有可用的 Ubuntu 镜像(即源),并按照平均下载速度和地理位置进行排名。

而且,当你找到最适合你的源之后,还可以直接下载它的 sources.list 文件,并可直接将它copy到 /etc/apt/sources.list 或者放在 /etc/apt/souces.list.d 目录下,非常的方便,无须苦苦找可用源。

首先,备份一下 Ubuntu 原来的源地址列表文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

备份 /etc/apt/sources.list/etc/apt/sources.list_backup

然后进行修改 /etc/apt/sources.list 把下方源直接复制到里面进行覆盖即可

以Wily(15.10)为例, 编辑 /etc/apt/sources.list 文件, 在文件最前面添加以下条目(操作前请做好相应备份)

 deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse
 deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse
 deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse
 deb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse
 deb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse
 deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse
 deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse
 deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse
 deb-src http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse
 deb-src http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse

或者下载相应版本的sources.list, 覆盖 /etc/apt/sources.list 即可(操作前请做好相应备份)

具体版本修改方法: http://mirrors.163.com/.help/ubuntu.html

赞() 打赏
未经允许不得转载:我的博客 » linux 更换更新源
分享到: 更多 (0)

评论 4

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    这是评论测试

    DUX主题小秘7个月前 (09-17)回复
    • 飞歌导航东方红烦得很

      themebetter主题小秘3周前 (04-08)回复
  2. #2

    这是新的一条评论

    DUX主题小秘7个月前 (09-17)回复
  3. #3

    未来一年,中国的移动支付市场会是什么样?

    DUX主题小秘7个月前 (09-17)回复

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

大前端WP主题 更专业 更方便

联系我们 联系我们