Ubuntu18.04更换镜像源

将Ubuntu18.04的原始镜像源更换为阿里镜像源或清华镜像源:

1、编辑配置文件,将原始内容删除或者注释掉:
编辑之前可以对原始文件进行备份,使用如下命令:

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

编辑文件,命令如下:

vim /etc/apt/sources.list

2、将下面内容粘贴进去(以下是阿里的镜像源)

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

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

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

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

如果要更换为清华的镜像源,则进入网址,选择Ubuntu对应版本的镜像内容:

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 

阿里镜像源网址如下:

https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11WMFViZ

注意:一定要选择与你的Ubuntu版本对应的镜像,我这里是18.04版本
3、更新源

apt-get update

常见相关命令

sudo apt-get update  更新源
 
sudo apt-get install package 安装包
 
sudo apt-get remove package 删除包
 
sudo apt-cache search package 搜索软件包
 
sudo apt-cache show package  获取包的相关信息,如说明、大小、版本等
 
sudo apt-get install package --reinstall   重新安装包
 
sudo apt-get -f install   修复安装
 
sudo apt-get remove package --purge 删除包,包括配置文件等
 
sudo apt-get build-dep package 安装相关的编译环境
 
sudo apt-get upgrade 更新已安装的包
 
sudo apt-get dist-upgrade 升级系统
 
sudo apt-cache depends package 了解使用该包依赖那些包
 
sudo apt-cache rdepends package 查看该包被哪些包依赖
 
sudo apt-get source package  下载该包的源代码
 
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
 
sudo apt-get check 检查是否有损坏的依赖
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值