IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> Ubuntu apt sources.list -> 正文阅读

[系统运维]Ubuntu apt sources.list

目录

Understanding sources.list File:

Update sources.list File:

Chinese aliyun source:

分析下阿里的源:

Installing with apt-get

apt commands


The operating system needs a mechanism to install packages easily as needed.

Packages can be hosted on a webserver or FTP server of the Linux distribution from where users can download and install it. These webservers or FTP servers are called package repository.

You also need a way to manage (install, remove, download) these packages from the package repository. So a package manager is included on your favorite Linux distribution.? Ubuntu is based on Debian GNU/Linux distribution. Ubuntu uses the APT (Advanced Package Tool) package manager to manage packages. The APT package manager and all the graphical front ends (Ubuntu Software Center, Muon, aptitude etc) uses the sources.list file to learn about which package repository or repositories to use.

The APT package manager and all its graphical frontends gets the package repository information from /etc/apt/sources.list file and files from the /etc/apt/sources.list.d directory.

Understanding sources.list File:

The contents of the /etc/apt/sources.list file looks something like this.


An APT line starts with deb, which means this package repository distributes software packages as pre compiled binaries in deb file format.

An APT line may also start with deb-src, which means the package repository distributes software packages as source codes, which you will have to compile in your own computer in order to use. By default, all the deb-src package repositories are disabled on Ubuntu.


you have to type in the short codename of your Ubuntu operating system. It is different for each version of Ubuntu. For example, in Ubuntu 18.04 LTS, it is bionic.

You can find out what it is for your distribution with the following command:

lsb_release -cs

?It may be? bionic-updates, bionic-security, bionic-backports,bionic-proposed。


The Ubuntu package repository is divided into main, restricted, universe and multiverse sections.

Update sources.list File:

You can chage? /etc/apt/sources.list file. After this, you must run 'sudo apt update' to make it effective.

Chinese aliyun source:

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

分析下阿里的源:

http://mirrors.aliyun.com/ubuntu/

其中,比较重要的就是dists目录和pool目录。dists目录包含了当前库的所有软件包的索引。这些索引通过系统版本分类在不同的文件夹。

进入dists目录,看到如下内容:

各组文件夹都是以下格式命名的:

xxx
xxx-backports
xxx-proposed
xxx-security
xxx-updates

其中xxx就是Ubuntu不同版本的代号. e.g.,

?他们文件夹的差别在于:

? security - Important Security Updates.

? updates - Recommended Updates.

? proposed - Pre-released Updates.

? backports - Unsupported Updates.

进入bionic目录:

?

有main, multiverse, restricted, universe文件夹,对应sources.list中的:

这些文件夹里面包含了不同软件包索引,区别在于:

  • ??? main: 完全free的软件。
  • ??? restricted: 不完全free的软件。
  • ??? universe: Ubuntu官方不提供支持与补丁,全靠社区支持。
  • ??? multiverse:非free软件,完全不提供支持和补丁。

如果我们打开main目录下的binary-i386子目录下的Packages.gz文件,可以看到里面是对一个个Package的描述:

.....
Package: libgmp-dev
Architecture: i386
Version: 2:6.1.2+dfsg-2
Multi-Arch: same
Priority: optional
Section: libdevel
Source: gmp
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1524
Provides: libgmp10-dev
Depends: libgmp10 (= 2:6.1.2+dfsg-2), libgmpxx4ldbl (= 2:6.1.2+dfsg-2)
Suggests: gmp-doc, libgmp10-doc, libmpfr-dev
Conflicts: libgmp10-dev
Replaces: libgmp10-dev, libgmp3-dev
Filename: pool/main/g/gmp/libgmp-dev_6.1.2+dfsg-2_i386.deb
Size: 328344
MD5sum: 2d8dd0e5b0579b2355e697e976f22336
SHA1: 201eeb494e10d6726672ae3583bd9d89b04d4fdc
SHA256: ab0f672c5a6ee12a6b63497ec762e060e973ebc85e81cd606fc8328ab27cce0a
Homepage: http://gmplib.org/
Description: Multiprecision arithmetic library developers tools
Description-md5: db56254d94fec9ce85e93ebf60b032a9
Supported: 5y

........

说明: Packages.gz这个文件是一个“索引”文件,里面记录了各种包的包名Package、运行平台(Architecture)、版本号(Version)、依赖关系(Depends)、deb包地址(Filename)等 。注意到Filename指向的是源服务器pool目录下的某个deb。因此可以猜测,apt-get install 某个软件时,其实就是基于这些Packages.gz来计算依赖关系,然后根据其中的Filename地址来下载所需的deb,然后再执行dpkg -i xxx.deb来完成软件包的安装。
?

Installing with apt-get

After you’ve edited and updated sources.list , all you need to do is log in as root and type:

apt-get install [package-name]

For example, to install the GIMP, you would enter:

apt-get install gimp

Notice that no version number is needed. Instead, apt-get installs the latest version of the package in all the available sources. If none of the versions is newer than what is already installed, then nothing is installed.

If you choose, however, you can choose a particular version number. For example, to install version 2.2 of the GIMP, type:

apt-get install gimp=2.2

apt commands

apt和apt-get命令之间的区别

虽然 apt 与 apt-get 有一些类似的命令选项,但它并不能完全向下兼容 apt-get 命令。也就是说,可以用 apt 替换部分 apt-get 系列命令,但不是全部。

apt 命令取代的命令命令的功能
apt installapt-get install安装软件包
apt removeapt-get remove移除软件包
apt purgeapt-get purge移除软件包及配置文件
apt updateapt-get update刷新存储库索引
apt upgradeapt-get upgrade升级所有可升级的软件包
apt autoremoveapt-get autoremove自动删除不需要的包
apt full-upgradeapt-get dist-upgrade在升级软件包时自动处理依赖关系
apt searchapt-cache search搜索应用程序
apt showapt-cache show显示安装细节

当然,apt 还有一些自己的命令:

新的apt命令命令的功能
apt list列出包含条件的包(已安装,可升级等)
apt edit-sources编辑源列表

?


REF:

详解Ubuntu的source.list文件_VinQin的博客-CSDN博客_sourcelist

Ubuntu 20.04系统更改apt源为阿里源_孤寒者的博客-CSDN博客_apt淘宝源

Understanding and Using sources.list for Ubuntu

An apt-get primer - Linux.com?



Linux学习笔记(一)----Ubuntu下的apt命令 - 谢呈勖 - 博客园

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2022-04-23 11:09:45  更:2022-04-23 11:10:01 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/15 20:23:55-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码