提示:博主是桌面版Ubuntu18.04
【Ubuntu】的apt-get源修改与使用-Ubuntu18.04
1.修改apt-get国内镜像源的方法
1,原文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2,编辑源列表文件
sudo gedit /etc/apt/sources.list
3,删除原来内容,添加以下新内容(阿里源)
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
4,更新
sudo apt-get update
# 更新软件
sudo apt-get upgrade
2.apt-get常用命令
1,搜索包
apt-cache search packagename
目标包名packagename
2,获取包的相关信息,如说明、大小、版本等
apt-cache show packagename
3, 安装包
apt-get install packagename
4, 重新安装包
apt-get install packagename -- reinstall
5, 删除包
apt-get remove packagename
6, 删除包,包括删除配置文件等
apt-get remove packagename
7, 更新源
apt-get update
8, 更新已安装的包
apt-get upgrade
9, 升级系统
apt-get dist-upgrade
10, 清理无用的包
apt-get clean
# 或
apt-get autoclean
11, 检查是否有损坏的依赖
apt-get check