Ubuntu更新源清晰方法
最直观的更新源方法
安装Ubuntu
推荐ventoy
其他U盘工具使用翻车了。
不会使用请自行百度。
安装好Ubuntu,首先第一步,要更换源,否则… …
Ubuntu中大部分的软件安装和更新都是利用apt命令,从Ubuntu的服务器直接安装的。
Ubuntu官方的服务器在国外,为了提高软件安装和更新速度,Ubuntu提供了选择最佳服务器的功能,可以帮助我们方便的找到一个速度最快的镜像服务器!
试错无数次,这里我推荐!
清华大学开源软件镜像站
中国科学技术大学
例如中国科学技术大学:可使用配置生成器生成各Ubuntu版本的镜像源。
1. 备份镜像源设置文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2. 编辑镜像源设置文件
sudo gedit /etc/apt/sources.list
3. 更新源及/etc/apt/sources.list
sudo apt-get update
4. 更新已安装的软件包
sudo apt-get upgrade
6. 将复制对应版本的清华源或科大源复制粘贴到打开的编辑文档
7. 这是ubtuntu自带sources.list
如要退回原来的源,复制粘贴即可。
# deb cdrom:[Ubuntu 20.04.6 LTS _Focal Fossa_ - Release amd64 (20230316)]/ focal main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal universe
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner
deb http://security.ubuntu.com/ubuntu focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
# deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
apt-get命令
在Ubuntu系统中,使用apt-get命令安装更新软件包:
sudo apt-get install package 安装软件包
sudo apt-get install package - - reinstall 重新安装软件包
sudo apt-get -f install 修复安装软件包"-f = ——fix-missing"
sudo apt-get remove package 删除软件包
sudo apt-get remove package - - purge 删除软件包,包括删除配置文件等
sudo apt-get update 更新源及/etc/apt/sources.list
sudo apt-get upgrade 更新已安装的软件包
sudo apt-get dist-upgrade 升级系统安装的软件包
sudo apt-get dselect-upgrade 使用 dselect 升级
sudo apt-get build-dep package 安装相关的编译环境
sudo apt-get clean && sudo apt-get autoclean 清理无用的软件包
sudo apt-get check 检查是否有损坏的依赖
apt-cache search package 搜索软件包
apt-cache show package 获取包的相关信息,如说明、大小、版本等
apt-cache depends package 了解使用依赖a
pt-cache rdepends package 是查看该软件包被哪些软件包依赖