持续创作,加速成长!这是我参与「掘金日新计划 · 6 月更文挑战」的第4天,点击查看活动详情
更换apt国内源
sudo vim /etc/apt/source.list
- 添加如下配置
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ impish main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ impish main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ impish-updates main multiverse restricted universe
- 添加完成之后,保存我们系统运行
lsb_release -a
- 记住
Codename的值我这里就是bionic。 再次打开/etc/apt/source.list我们查看下刚才添加进去的行号。:set nu。
- 然后我们
:52,62s/impish/bionic/g表示53-62行全部将impish 替换成bionic 。 到这里我们源就更换好了。我们执行更新看下
-
apt update或者apt upgrade -
这里放置一个我准备好的文件列表
# deb cdrom:[Ubuntu 18.04.6 LTS _Bionic Beaver_ - Release amd64 (20210915)]/ bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu bionic main restricted #Added by software-properties
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic multiverse main restricted universe #Added by software-properties
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse main restricted universe #Added by software-properties
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://mirrors.aliyun.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://mirrors.aliyun.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse #Added by software-properties
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-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 bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse main restricted universe #Added by software-properties
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
简介
-
说了这么多了,今天我们来看看我们的apt到底是个啥,为什么废了这么大精神去配置国内源。
-
Ubuntu提供了一个下载工具APT,可实现软件自动下载、配置、安装二进制或者源码的功能 目前是Ubuntu下用到最多的下载工具
-
APT和install命令一起构成了Ubuntu最常用的下载和安装软件的方法 它的出现解决了Linux平台下安装软件的缺陷,即软件之间相互依赖
-
APT采用的是C/S模式,PC机作为客户端,当需要下载软件的时候就向服务器请求 服务器的IP地址也叫作安装源或者更新源,需选择使用中国的服务器,不然可能会下载失败
-
默认情况下,APT会下载最新的软件包,被安装的软件包所依赖的其他软件也会被下载安装
-
使用命令
sudo apt-get install package-name -
此时
apt-get命令和install命令组合在一起使用 -
apt-get负责下载软件,install负责安装软件 -
在安装过程中会出现一些询问,若希望继续执行就输入y,若希望不执行就输入n
-
有时候本地某些软件可能存在依赖关系,这里依赖关系就是 A 软件依赖于 B 软件
-
使用
sudo apt-get check命令可以查看依赖关系,若存在依赖关系的话,APT会提出解决方案
各项定义如下:
main/:“main”组件包括了自由软件、可以被自由发布的软件和被Ubuntu团队完全支持的软件。其中包括了大多数流行的和稳定的开源软件,当您安装Ubuntu时默认安装的就是这些软件。
restricted/:“restricted”组件是专供普遍用途,而且没有自由软件版权,但依然被Ubuntu团队支持的软件。请注意,因为不能直接修改软件,因而我们可能不能提供完全的技术支持,即便如此,我们还能向实际作者反馈Bug报告。
universe/:“universe”组件是整个自由、开源Linux世界的缩影。在“universe”组件中,你可以找到大多数开源软件,以及在开源版权下的软件,所有这些都是在公共源的基础上建立的。这些软件都是使用“main”中的组件编写的,它们能与“main”组件相安无事地共同运行,但它们没有安全升级的保障。“universe”组件包含了数以千计的软件。虽然是公共的,用户必须明白它们与稳定的Ubuntu核心的软件的差异和不稳定。
multiverse/:multiverse”组件包含了“不自由”的软件,这意味着这些软件不满足 Ubuntu相对于“main”组件的各种版权政策。当您使用这些软件时,如何调整各种权力以及遵重版权所有者的问题,就完全依靠您自己把握了。这些软件不被我们支持,而且通常不能被修改和更新,您将自己承担任何风险
2.3 indices(index复数)表示索引目录,当apt-get update时,根据版本进行索引更新,如下所示: