apt更换镜像源

转载自 apt更换镜像源_白鹤想亮翅的博客-CSDN博客_apt换源

apt更换镜像源

白鹤想亮翅 2020-05-19 18:58:22

1711  正在上传…重新上传取消​ 收藏 8 

分类专栏: Linux学习笔记 文章标签: linux ubuntu

版权

​ Linux学习笔记  专栏收录该内容

4 篇文章 0 订阅

订阅专栏

  文章转载至   [荒野雄兵的博客](https://blog.csdn.net/daerzei/article/details/84873964)

系统说明:VMware14 Pro下Ubuntu18.04 LTS版,64位

网上的教程大部分都是文本命令行的方式更换国内源的,其实Ubuntu18.04也提供了图形界面的方式,这里主要讲图形界面的方式,毕竟点点鼠标就能完成的事儿谁愿意去输命令啊,而且还容易出错,当然这里也附上命令行的方式。

可能很多人会问到底什么是源呢?
其实吧它就像苹果和案桌的软件应用商店一样,为Linux用户提供软件下载及更新服务的。
Linux家族有三个软件源系统:
yum源,使用这种软件管理器的主要是:RedHat,CentOS
apt源,使用这种软件管理器的主要是:Ubuntu
Pacman源,使用这种软件管理器的主要是:archlinux还有新近崛起的Manjaro

Ubuntu是外国人开发的系统,默认使用的也是国外的源,但是从国内翻^qiang下载国外的软件(插件)源太慢。其实国内也有很多的镜像源,比如说阿里源,网易源,清华园(源),中科大源。

一般这些源都是做为自己公司的业务服务的,比如说阿里的源,就是为阿里上百万台云服务器提供软件源的,你可以想像一下它的速度能不快吗?

这里实现切换阿里云源,别看截图很多,其实操作起来很简单滴

方式一:图形界面

第一步:打开软件和更新

Ubuntu18更换国内源_01.png
Ubuntu18更换国内源_02.png

第二步:设置163源

Ubuntu18更换国内源_03.png

这是原来的/etc/apt/sources.list配置文件
Ubuntu18更换国内源_04.png

选择其他站点
Ubuntu18更换国内源_05.png

选择阿里云源并保存
Ubuntu18更换国内源_06.png

关闭配置页面,即保存所有配置
Ubuntu18更换国内源_07.png

第三步:正在更新缓存

关闭之后会弹出一个对话框问你要不要重新载入软件的列表信息
切换国内源,需要更新缓存,点击重新载入
Ubuntu18更换国内源_08.png

更新过以后可以看下/etc/apt/sources.list配置文件
Ubuntu18更换国内源_09.png

可以发现sources.list配置文件已经修改成了阿里云源
Ubuntu18更换国内源_10.png

方式二:命令行

第一步:修改sources.list配置文件:

sudo vim /etc/apt/sources.list

 

在文件最前面添加以下条目,保险起见,的操作之前做好备份

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

 

第二步:更新缓存

执行下面的命令:

sudo apt-get update
sudo apt-get upgrade

 

至此完成国内源的切换,
网上的都是这么说的,但是直接手动修改配置文件毕竟有风险,而且原来的配置还没有注释掉,建议通过图形界面的方式进行修改。
附上其他源的内容,需要的话自己添加进sources.list文件里吧。
清华源:

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

 

中科大

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

 

163源

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

 
                                </div>
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值