Ubuntu翻译之man(8)apt-get

2024-08-30 02:15:57 浏览数 (3)

APT-GET(8)

名称

NAME

// apt-get - APT包处理实用程序--命令行接口

apt-get - APT package handling utility -- command-line interface

概要

SYNOPSIS

apt-get [-sqdyfmubV] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {update | upgrade | dselect-upgrade | dist-upgrade | install pkg [{=pkg_version_number | /target_release}]... | remove pkg... | purge pkg... | source pkg [{=pkg_version_number | /target_release}]... | build-dep pkg [{=pkg_version_number | /target_release}]... | download pkg [{=pkg_version_number | /target_release}]... | check | clean | autoclean | autoremove | {-v | --version} | {-h | --help}}

描述

DESCRIPTION

//apt-get是用于包处理的命令行工具,可以被视为使用APT库的其他工具的用户“后端”。存在几个“前端”接口,如aptitude(8), synaptic(8) and wajig(1)。

//除非给出了-h或--help选项,否则必须存在以下命令之一。

apt-get is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library. Several "front-end" interfaces exist, such as aptitude(8), synaptic(8) and wajig(1).

Unless the -h, or --help option is given, one of the commands below must be present.

update

//update用于从他的源重新同步包索引文件。可用包的索引是从/etc/apt/sources.list中指定的位置获取的。例如,在使用Debian存档时,此命令检索并扫描Packages.gz文件,以便提供有关新的和更新的软件包的信息。upgrade(升级)或dist-upgrade之前应始终执行update(更新)。请注意,由于无法提前知道包文件的大小,因此整体进度表将不准确。

update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available. An update should always be performed before an upgrade or dist-upgrade. Please be aware that the overall progress meter will be incorrect as the size of the package files cannot be known in advance.

upgrade

//upgrade(升级)被用于从/etc/apt/sources.list中列举的镜像源,安装当前系统上已经安装的所有软件包的最新版本。检索并升级当前安装的有可用新版本的软件包;在任何情况下,当前已经安装的包都不会被删除,或者尚未安装的包不会被检索和安装。如果不更改另一个软件包的安装状态,则无法升级当前安装的软件包的新版本,将保持其当前版本。必须首先执行update(更新),以便apt-get知道有新版本的包可用。

//当一个包作为参数被提供时,该包将在升级操作之前被安装。

upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

When a package is supplied as an argument, the package will be installed prior to the upgrade action.

dist-upgrade

//dist-upgrade除了执行升级功能外,还智能地处理与新版本包的依赖关系变化;apt-get有一个“智能”的冲突解决系统,必要时它会尝试以牺牲不太重要的包为代价升级最重要的包。因此,dist-upgrade命令可能会删除一些软件包。/etc/apt/sources.list文件包含从中检索所需包文件的位置列表。另请参阅apt_preferences(5) ,了解覆盖单个包的常规设置的机制。

//当一个包作为参数被提供时,该包将在升级操作之前被安装。

dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for overriding the general settings for individual packages.

When a package is supplied as an argument, the package will be installed prior to the upgrade action.

dselect-upgrade

//dselect-upgrade与传统的Debian打包前端dselect(1)结合使用。dselect-upgrade遵循dselect(1) 对可用包的状态字段所做的更改,并执行实现该状态所需的操作(例如,删除旧包和安装新包)。

dselect-upgrade is used in conjunction with the traditional Debian packaging front-end, dselect(1). dselect-upgrade follows the changes made by dselect(1) to the Status field of available packages, and performs the actions necessary to realize that state (for instance, the removal of old and the installation of new packages).

install

//install 后面是想要安装或升级所需的一个或多个软件包。每个包都是一个包名,而不是一个完全限定的文件名(例如,在Debian系统中,提供的参数是apt-utils,而不是apt-utils_2.7.14_amd64.deb)。指定用于安装的软件包所需的所有软件包也将被检索和安装。/etc/apt/sources.list文件用于定位所需的包。如果在包名称后附加连字符-(中间没有空格),如果安装了已标识的软件包,它将被删除。同样,加号 可用于指定要安装的软件包。后面的这个特性可用于覆盖apt-get的冲突解决系统所做的决策。

//通过在包名称后面加上等号=和要选择的包版本号,可以选择特定版本的包进行安装。这将导致定位并选择该版本进行安装。或者,可以通过在包名称后面加斜线 / 和分发版本或存档名称(stable, testing, unstable)来选择特定的分发版本。

//这两种版本选择机制都可以降级包,必须谨慎使用。

//使用install命令你可以升级一个或多个已安装的软件包,而不升级系统上已经安装的每个软件包。与“upgrade”命令是安装所有当前系统已安装包到最新版本的目标不同,“install”将仅安装指定包的最新版。只需提供您要升级的软件包的名称,如果有新版本可用,它(及其依赖关系,如上文所述)将被下载并安装。

//最后,apt_preferences(5) 机制允许您为单个软件包创建可供选择的安装策略。

//如果没有包与给定的表达式匹配,并且表达式包含“.”,“?”或者“*”其中之一,则假定它是POSIX正则表达式,并将其应用于数据库中的所有包名。然后安装(或删除)任何匹配项。请注意,匹配是通过子字符串完成的,因此“lo.*”与“how lo”和“lowest”匹配。如果这是不希望的,请使用“^”或“$”字符锚定正则表达式,或创建更具体的正则表达式。

//APT 2.0中不推荐使用正则表达式,apt命令中已删除了正则表达式,锚定表达式除外。在未来的版本中也将从apt-get

命令中删除。请改用apt-patterns

install is followed by one or more packages desired for installation or upgrading. Each package is a package name, not a fully qualified filename (for instance, in a Debian system, apt-utils would be the argument provided, not apt-utils_2.7.14_amd64.deb). All packages required by the package(s) specified for installation will also be retrieved and installed. The /etc/apt/sources.list file is used to locate the desired packages. If a hyphen is appended to the package name (with no intervening space), the identified package will be removed if it is installed. Similarly a plus sign can be used to designate a package to install. These latter features may be used to override decisions made by apt-get's conflict resolution system.

A specific version of a package can be selected for installation by following the package name with an equals and the version of the package to select. This will cause that version to be located and selected for install. Alternatively a specific distribution can be selected by following the package name with a slash and the version of the distribution or the Archive name (stable, testing, unstable).

Both of the version selection mechanisms can downgrade packages and must be used with care.

This is also the target to use if you want to upgrade one or more already-installed packages without upgrading every package you have on your system. Unlike the "upgrade" target, which installs the newest version of all currently installed packages, "install" will install the newest version of only the package(s) specified.Simply provide the name of the package(s) you wish to upgrade, and if a newer version is available, it (and its dependencies, as described above) will be downloaded and installed.

Finally, the apt_preferences(5) mechanism allows you to create an alternative installation policy for individual packages.

If no package matches the given expression and the expression contains one of '.', '?' or '*' then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so 'lo.*' matches 'how-lo' and 'lowest'. If this is undesired, anchor the regular expression with a '^' or '$' character, or create a more specific regular expression.

Fallback to regular expressions is deprecated in APT 2.0, has been removed in apt(8), except for anchored expressions, and will be removed from apt-get(8) in a future version. Use apt-patterns(7) instead.

reinstall

//reinstall是install的一个别名,--reinstall。

reinstall is an alias for install --reinstall.

remove

//remove用法与install完全相同,只是它的作用是删除软件包而不是安装了软件包。请注意,删除包会将其配置文件留在系统上。如果在包名称后附加加号 (中间没有空格),则将安装已标识的包,而不是将其删除。

remove is identical to install except that packages are removed instead of installed. Note that removing a package leaves its configuration files on the system. If a plus sign is appended to the package name (with no intervening space), the identified package will be installed instead of removed.

purge

//purge与remove完全相同,除了包被删除和清除(任何配置文件也被删除)。

purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).

source

//source导致apt-get获取源代码包。APT将检查可用的包,以决定要获取哪个源包。然后,它将查找该源程序包的最新可用版本并将其下载到当前目录中,同时遵循默认发行版本,如果可能的话,使用选项APT::Default-Release,-t选项或者每个包使用pkg/release语法设置。

//参数被解释为二进制和源包名称。如果要更改,请参阅--only-source选项。

//源代码包通过sources.list文件中的deb-src行与二进制包分开跟踪。这意味着你需要为每个要从中获取源代码的软件仓库添加这样一行;否则,您可能会得到错误的(太旧/太新)源代码版本,或者根本没有。

//如果指定了--compile选项,则将使用dpkg-buildpackage将包编译为二进制.deb,使用--host-architecture选项定义的架构。如果指定了--download-only,则这个源码包不会被解压缩。

//与包文件所使用的机制类似,一个指定版本的源码包可以被检索通过源码包名=版本号获取。这使得源包名称和版本能够精确匹配,隐式启用APT::Get::Only-Source选项。

//请注意,源代码包并不像二进制包那样在dpkg数据库中安装和跟踪;它们只是下载到当前目录,就像源代码tarball一样。

source causes apt-get to fetch source packages. APT will examine the available packages to decide which source package to fetch. It will then find and download into the current directory the newest available version of that source package while respecting the default release, set with the option APT::Default-Release, the -t option or per package with the pkg/release syntax, if possible.

The arguments are interpreted as binary and source package names. See the --only-source option if you want to change that.

Source packages are tracked separately from binary packages via deb-src lines in the sources.list(5) file. This means that you will need to add such a line for each repository you want to get sources from; otherwise you will probably get either the wrong (too old/too new) source versions or none at all.

If the --compile option is specified then the package will be compiled to a binary .deb using dpkg-buildpackage for the architecture as defined by the --host-architecture option. If --download-only is specified then the source package will not be unpacked.

A specific source version can be retrieved by postfixing the source name with an equals and then the version to fetch, similar to the mechanism used for the package files. This enables exact matching of the source package name and version, implicitly enabling the APT::Get::Only-Source option.

Note that source packages are not installed and tracked in the dpkg database like binary packages; they are simply downloaded to the current directory, like source tarballs.

build-dep

//build-dep执行apt-get来安装/删除包,试图以满足源码包的依赖关系构建。默认情况下,满足依赖关系以本机构建包。如果需要,可以使用--host architecture选项指定主机架构。

build-dep causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package. By default the dependencies are satisfied to build the package natively. If desired a host-architecture can be specified with the --host-architecture option instead.

//参数被解释为二进制包或源码包名称。如果要更改,请参阅--only source选项。

The arguments are interpreted as binary or source package names. See the --only-source option if you want to change that.

satisfy

//satisfy使得apt-get满足给定的依赖字符串。依赖项字符串可能具有构建配置文件和构建依赖项中的架构限制列表。它可以选择以“Conflicts:”作为前缀,以不满足依赖字符串。可以指定多个相同类型的字符串。

//示例: apt-get satisfy "foo" "Conflicts: bar" "baz (>> 1.0) | bar (= 2.0), moo"

//这个老的选项 '</>' 不再支持, 使用 '<=/>=' 替代。

satisfy causes apt-get to satisfy the given dependency strings. The dependency strings may have build profiles and architecture restriction list as in build dependencies. They may optionally be prefixed with "Conflicts: " to unsatisfy the dependency string. Multiple strings of the same type can be specified.

Example: apt-get satisfy "foo" "Conflicts: bar" "baz (>> 1.0) | bar (= 2.0), moo"

The legacy operator '</>' is not supported, use '<=/>=' instead.

check

//check是一种诊断工具;它更新包缓存并检查是否存在损坏的依赖关系。

check is a diagnostic tool; it updates the package cache and checks for broken dependencies.

download

//download会将给定的二进制包下载到当前目录中。与往常一样,确保了包数据的真实性。

download will download the given binary package into the current directory. The authenticity of the package data is ensured as usual.

clean

//clean清除本地仓库已取回到的包文件。它从/var/cache/apt/archives/和/var/cache/app/archives/partial/中删除除lock

(锁文件)之外的所有内容。

clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.

autoclean (and the auto-clean alias since 1.1)

//从版本1.1开始,autocleanauto-clean的别名。和clean一样,autoclean清除本地仓库已取回到的包文件。不同的是它仅移除哪些不再能被下载的包文件,这些文件在很大程度上是无用的。这允许缓存在长时间内得到维护,而不会因为增长而失控。如果配置选项APT::Clean-Installed被设置为关闭,它将防止已安装的软件包被清除。

Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.

distclean (and the dist-clean alias)

//distclean是dist-clean的别名,distclean删除/var/lib/apt/lists下的所有文件,但Release、Release.gpg和InRelease文件除外。例如,在最终确定分发给用户的镜像时,可以使用它。出于安全原因,保留了发布文件,以防止各种类型的攻击。

distclean removes all files under /var/lib/apt/lists except Release, Release.gpg, and InRelease. It can be used for example, when finalizing images distributed to users. The release files are kept for security reasons, to prevent various types of attacks.

autoremove (and the auto-remove alias since 1.1)

//从版本1.1开始,autoremove是auto-remove的别名。autoremove被用于移除那些为满足其他包依赖关系而自动安装的和当前不再被需要的包。

autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.

autopurge

//和autoremove一样,但是autopurge同时会移除配置文件。它是autoremove --purge的一个快捷方式。

Like autoremove, but autopurge also removes configuration files. This is a shortcut for autoremove --purge.

changelog

//changelog试图去下载一个包的更新日志并通过sensible-pager(可感知的分页器)方式来显示。默认情况下它显示的更新日志来自当前已安装的版本。但是,你可以指定与install命令相同的选项。

changelog tries to download the changelog of a package and displays it through sensible-pager. By default it displays the changelog for the version that is installed.However, you can specify the same options as for the install command.

indextargets

//apt-get update将下载的所有数据文件(也称为索引目标)的信息,默认以deb822格式的列表显示。支持--format选项来修改输出格式,并接受默认输出的行来过滤记录。该命令主要用作与APT一起工作的外部工具的接口,以获取下载文件的信息和文件名,以便他们也可以使用它们,而不是自己再次下载。这里省略了详细的文档,可以在apt-doc包附带的/usr/share/doc/apt/acquire-additional-files.md.gz文件中找到。

Displays by default a deb822 formatted listing of information about all data files (aka index targets) apt-get update would download. Supports a --format option to modify the output format as well as accepts lines of the default output to filter the records by. The command is mainly used as an interface for external tools working with APT to get information as well as filenames for downloaded files so they can use them as well instead of downloading them again on their own. Detailed documentation is omitted here and can instead be found in the file /usr/share/doc/apt/acquire-additional-files.md.gz shipped by the apt-doc package.

选项

OPTIONS

//所有命令行选项都可以使用配置文件进行设置,这部分描述指示了要设置的配置选项。对于布尔选项,您可以使用-f-、--no-f、-f=no或其他几种变体来覆盖配置文件。

All command line options may be set using the configuration file, the descriptions indicate the configuration option to set. For boolean options you can override the config file by using something like -f-,--no-f, -f=no or several other variations.

--no-install-recommends

//不要将推荐的软件包视为安装的依赖项。配置项:APT::Install-Recommends。

Do not consider recommended packages as a dependency for installing. Configuration Item: APT::Install-Recommends.

--install-suggests

//将建议的包视为安装的依赖项。配置项:APT::Install-Suggests。

Consider suggested packages as a dependency for installing. Configuration Item: APT::Install-Suggests.

-d, --download-only

//仅下载;仅取回包文件,而不解包或安装。配置项:APT::Get::Download-Only。

Download only; package files are only retrieved, not unpacked or installed. Configuration Item: APT::Get::Download-Only.

-f, --fix-broken

//Fix(修复);尝试纠正一个依赖关系中断的系统。当与install/remove一起使用时,此选项可以省略任何包,以允许APT推断出可能的解决方案。如果指定了包,则必须完全纠正问题。首次运行APT时,该选项有时是必要的;APT本身不允许系统上存在损坏的包依赖关系。系统的依赖结构可能会损坏到需要手动干预的程度(这通常意味着使用dpkg--remove来消除一些有问题的包)。在某些情况下,将此选项与-m一起使用可能会产生错误。配置项:APT::Get::Fix-Broken。

Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's dependency structure can be so corrupt as to require manual intervention (which usually means using dpkg --remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations. Configuration Item: APT::Get::Fix-Broken.

-m, --ignore-missing, --fix-missing

//忽略丢失的包;如果无法检索包或检索后完整性检查失败(包文件损坏),请保留这些包并处理结果。在某些情况下,将此选项与-f一起使用可能会产生错误。如果选择了一个软件包进行安装(特别是如果在命令行上提到它)但无法下载,那么它将被静默地保留。配置项:APT::Get::Fix-Missing。

Ignore missing packages; if packages cannot be retrieved or fail the integrity check after retrieval (corrupted package files), hold back those packages and handle the result. Use of this option together with -f may produce an error in some situations. If a package is selected for installation (particularly if it is mentioned on the command line) and it could not be downloaded then it will be silently held back. Configuration Item: APT::Get::Fix-Missing.

--no-download

//禁用包下载。这最好与--ignore-missing一起使用,以强制APT仅使用它已经下载的.debs。配置项:APT::Get::Download。

Disables downloading of packages. This is best used with --ignore-missing to force APT to use only the .debs it has already downloaded. Configuration Item:APT::Get::Download.

-q, --quiet

//Quiet(静默的);生成适合日志记录的输出,省略进度指示器。更多的q将产生更多的静默输出,最多可使用2个。你还可以使用-q=#设置静默级别,覆盖配置文件。请注意,静默级别2意味着-y;你永远不应该在没有无动作修饰符(如-d、-print-uris或-s)的情况下使用-qq,因为APT可能会决定做一些你意想不到的事情。配置项:quiet。

Quiet; produces output suitable for logging, omitting progress indicators. More q's will produce more quiet up to a maximum of 2. You can also use -q=# to set the quiet level, overriding the configuration file. Note that quiet level 2 implies -y; you should never use -qq without a no-action modifier such as -d, --print-uris or -s as APT may decide to do something you did not expect. Configuration Item: quiet.

-s, --simulate, --just-print, --dry-run, --recon, --no-act

//No action(无行动);执行基于当前系统状态可能会发生的但实际上不会改变系统的事件的模拟。锁定将被禁用(Debug::NoLocking),因此系统状态可能会在apt-get运行时发生变化。模拟也可以由非root用户执行,这些用户可能无法读取所有的apt配置,导致模拟失真。默认情况下,非root用户也会显示表示此警告的通知(APT::Get::Show-User-Simulation-Note)。配置项:APT::Get::Simulate。

//模拟运行打印出一系列行,每行代表一个dpkg操作:配置(Conf)、删除(Remv)或解包(Inst)。方括号表示损坏的包,空方括号表示无关紧要的损坏(罕见的)。

No action; perform a simulation of events that would occur based on the current system state but do not actually change the system. Locking will be disabled (Debug::NoLocking) so the system state could change while apt-get is running. Simulations can also be executed by non-root users which might not have read access to all apt configuration distorting the simulation. A notice expressing this warning is also shown by default for non-root users (APT::Get::Show-User-Simulation-Note).Configuration Item: APT::Get::Simulate.

Simulated runs print out a series of lines, each representing a dpkg operation: configure (Conf), remove (Remv) or unpack (Inst). Square brackets indicate broken packages, and empty square brackets indicate breaks that are of no consequence (rare).

-y, --yes, --assume-yes

//提示自动为yes;假设所有提示的答案为“yes”,并以非交互方式运行。如果发生不希望的情况,例如更改已保存的包、尝试安装未经身份验证的包或删除基本包,apt-get将中止。配置项:APT::Get::Assume-Yes.

Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install an unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.

--assume-no

//提示自动为"no";配置项:APT::Get::Assume-No.

Automatic "no" to all prompts. Configuration Item: APT::Get::Assume-No.

--no-show-upgraded

//不显示要升级的所有软件包的列表。配置项: APT::Get::Show-Upgraded。

Do not show a list of all packages that are to be upgraded. Configuration Item: APT::Get::Show-Upgraded.

-V, --verbose-versions

//显示已升级和已安装软件包的完整版本。配置项: APT::Get::Show-Versions。

Show full versions for upgraded and installed packages. Configuration Item: APT::Get::Show-Versions.

-a, --host-architecture

//此选项控制通过apt-get source --compile(apt-get源代码编译)为其构建的架构包,以及如何满足跨架构构建依赖关系。默认情况下,它没有设置,这意味着主机架构与构建架构相同(由APT::Architecture定义)。配置项: APT::Get::Host-Architecture。

This option controls the architecture packages are built for by apt-get source --compile and how cross-builddependencies are satisfied. By default is it not set which means that the host architecture is the same as the build architecture (which is defined by APT::Architecture). Configuration Item: APT::Get::Host-Architecture.

-P, --build-profiles

//此选项控制激活的构建配置文件,apt-get source --compile为其构建源包,以及如何满足构建依赖关系。默认情况下,没有活动的构建配置文件。一次可以通过逗号连接多个构建配置文件来激活它们。配置项: APT::Build-Profiles。

This option controls the activated build profiles for which a source package is built by apt-get source --compile and how build dependencies are satisfied. By default no build profile is active. More than one build profile can be activated at a time by concatenating them with a comma. Configuration Item: APT::Build-Profiles.

-b, --compile, --build

//下载源代码包后编译它们。配置项: APT::Get::Compile。

Compile source packages after downloading them. Configuration Item: APT::Get::Compile.

--ignore-hold

//忽略保留包;这会导致apt-get忽略包上的保留。这可能与dist-upgrade结合使用时是有用的,以覆盖大量不希望的保留。配置项: APT::Ignore-Hold。

Ignore package holds; this causes apt-get to ignore a hold placed on a package. This may be useful in conjunction with dist-upgrade to override a large number of undesired holds. Configuration Item: APT::Ignore-Hold.

--with-new-pkgs

//允许在与upgrade结合使用时安装新软件包。如果已安装软件包的更新需要安装新的依赖项,这将非常有用。upgrade将升级包并安装新的依赖项,而不是阻止包的升级。请注意,使用此选项进行升级永远不会删除软件包,只允许添加新的软件包。配置项: APT::Get::Upgrade-Allow-New。

Allow installing new packages when used in conjunction with upgrade. This is useful if the update of an installed package requires new dependencies to be installed.Instead of holding the package back upgrade will upgrade the package and install the new dependencies. Note that upgrade with this option will never remove packages,only allow adding new ones. Configuration Item: APT::Get::Upgrade-Allow-New.

--no-upgrade

//Do not upgrade packages(不要升级软件包);当与install结合使用时,如果命令行上的包已经安装,no-upgrade将阻止包进行更新。配置项: APT::Get::Upgrade。

Do not upgrade packages; when used in conjunction with install, no-upgrade will prevent packages on the command line from being upgraded if they are already installed. Configuration Item: APT::Get::Upgrade.

--only-upgrade

//Do not install new packages(不安装新的包);当与install结合使用时, only-upgrade将仅对已经安装的包进行升级并忽略安装新包的请求。配置项: APT::Get::Only-Upgrade。

Do not install new packages; when used in conjunction with install, only-upgrade will install upgrades for already installed packages only and ignore requests to install new packages. Configuration Item: APT::Get::Only-Upgrade.

--allow-downgrades

//这是一个危险的选项,如果它正在降级,将导致apt在没有提示的情况下继续下去。除非在非常特殊的情况下,否则不应该使用它。使用它可能会破坏你的系统!配置项:APT::Get::allow-downgrades。在APT 1.1中引入。

This is a dangerous option that will cause apt to continue without prompting if it is doing downgrades. It should not be used except in very special situations. Using it can potentially destroy your system! Configuration Item: APT::Get::allow-downgrades. Introduced in APT 1.1.

--allow-remove-essential

//Force yes(强制yes);这是一个危险的选项,如果它正在删除必要项,将导致apt在没有提示的情况下继续。除非在非常特殊的情况下,否则不应该使用它。使用它可能会破坏你的系统!配置项: APT::Get::allow-remove-essential。在APT 1.1中引入。

Force yes; this is a dangerous option that will cause apt to continue without prompting if it is removing essentials. It should not be used except in very special situations. Using it can potentially destroy your system! Configuration Item: APT::Get::allow-remove-essential. Introduced in APT 1.1.

--allow-change-held-packages

//Force yes(强制yes);这是一个危险的选项,如果它正在更改持有的包,将导致apt在没有提示的情况下继续。除非在非常特殊的情况下,否则不应该使用它。使用它可能会破坏你的系统!配置项:APT::Get::allow-change-held-packages。在APT 1.1中引入。

Force yes; this is a dangerous option that will cause apt to continue without prompting if it is changing held packages. It should not be used except in very special situations. Using it can potentially destroy your system! Configuration Item: APT::Get::allow-change-held-packages. Introduced in APT 1.1.

--force-yes

//Force yes(强制yes);这是一个危险的选项,如果它正在做一些可能有害的事情,将导致apt在没有提示的情况下继续。除非在非常特殊的情况下,否则不应该使用它。使用force-yes可能会破坏你的系统!配置项APT::Get::force-yes。这已被弃用,取而代之的是--allow-unauthenticated , --allow-downgrades , --allow-remove-essential , --allow-change-held-packages在APT 1.1。

Force yes; this is a dangerous option that will cause apt to continue without prompting if it is doing something potentially harmful. It should not be used except in very special situations. Using force-yes can potentially destroy your system! Configuration Item: APT::Get::force-yes. This is deprecated and replaced by --allow-unauthenticated , --allow-downgrades , --allow-remove-essential , --allow-change-held-packages in 1.1.

--print-uris

//被打印的不是获取文件以安装它们的URIs。每个URI都有路径、目标文件名、大小和预期的MD5哈希。请注意,要写入的文件名并不总是与远程站点上的文件名匹配!这也适用于源代码(source)和更新(update)命令。当与update命令一起使用时,MD5和大小不包括在内,解压缩任何压缩文件由用户决定。配置项: APT::Get::Print-URIs。

Instead of fetching the files to install their URIs are printed. Each URI will have the path, the destination file name, the size and the expected MD5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.

--purge

//对任何要删除的内容使用清除(purge)而不是删除(remove)。计划清除的包后边将显示星号(“*”)。remove--purge相当于purge命令。配置项:APT::Get::Purge。

Use purge instead of remove for anything that would be removed. An asterisk ("*") will be displayed next to packages which are scheduled to be purged. remove --purge is equivalent to the purge command. Configuration Item:APT::Get::Purge.

--reinstall

//重新安装已安装的最新版本的软件包。配置项: APT::Get::ReInstall。

Re-install packages that are already installed and at the newest version. Configuration Item: APT::Get::ReInstall.

--list-cleanup

//默认情况下,列表清理选项处于启用状态;使用--no-list-cleanup将其关闭。当它打开时,apt-get将自动管理/var/lib/apt/lists的内容,以确保删除过时的文件。关闭它的唯一原因是您经常更改源列表。配置项: APT::Get::List-Cleanup。

This option is on by default; use --no-list-cleanup to turn it off. When it is on, apt-get will automatically manage the contents of /var/lib/apt/lists to ensure that obsolete files are erased. The only reason to turn it off is if you frequently change your sources list. Configuration Item: APT::Get::List-Cleanup.

-S, --snapshot

//此选项控制为源条目中启用快照(Snapshot: enable)的存档选择的快照。例如,-S 20220102T030405Z选择2022年1月2日03:04:05 UTC的快照。配置项: APT::Snapshot;另请参阅sources.list(5) 手册页。

This option controls the snapshot chosen for archives with Snapshot: enable in the source entry. For example, -S 20220102T030405Z selects a snapshot from January 2nd,2022 at 03:04:05 UTC. Configuration Item: APT::Snapshot; see also the sources.list(5) manual page.

-t, --target-release, --default-release

//此选项控制策略引擎的默认输入;它使用指定的发布字符串创建优先级为990的默认引脚。这会覆盖/etc/apt/preferences中的常规设置。特别是固定包不受此选项值的影响。简而言之,此选项使你可以简单地控制从哪些分发包中检索。一些常见的例子可能是-t '2.1*', -t unstable-t sid。配置项:APT: APT::Default-Release;另请参阅apt_preferences(5) 手册页。

This option controls the default input to the policy engine; it creates a default pin at priority 990 using the specified release string. This overrides the general settings in /etc/apt/preferences. Specifically pinned packages are not affected by the value of this option. In short, this option lets you have simple control over which distribution packages will be retrieved from. Some common examples might be -t '2.1*', -t unstable or -t sid. Configuration Item: APT::Default-Release; see also the apt_preferences(5) manual page.

--trivial-only

//只执行“琐碎”(trivial)的操作。从逻辑上讲,这可以被认为与假设是(--assume-yes)属于同一类型;其中--assume-yes将对任何提示回答yes,--trivial-only将回答no。配置项: APT::Get::Trivial-Only。

Only perform operations that are 'trivial'. Logically this can be considered related to --assume-yes; where --assume-yes will answer yes to any prompt, --trivial-only will answer no. Configuration Item: APT::Get::Trivial-Only.

--mark-auto

//成功安装后,将所有新安装的软件包标记为自动安装,当不再有手动安装的包依赖于此包时,这将导致每个包被删除。这相当于对所有已安装的软件包运行apt-mark auto。配置项:APT::Get::Mark-Auto。

After successful installation, mark all freshly installed packages as automatically installed, which will cause each of the packages to be removed when no more manually installed packages depend on this package. This is equally to running apt-mark auto for all installed packages. Configuration Item: APT::Get::Mark-Auto.

--no-remove

//如果要删除任何包,apt-get会立即中止,而不会提示。配置项:APT::Get::Remove。

If any packages are to be removed apt-get immediately aborts without prompting. Configuration Item:APT::Get::Remove.

--auto-remove, --autoremove

//如果命令是install或remove,则此选项的作用类似于运行autoremove命令,删除未使用的依赖包。配置项:APT::Get::AutomaticRemove。

If the command is either install or remove, then this option acts like running the autoremove command, removing unused dependency packages. Configuration Item:APT::Get::AutomaticRemove.

--only-source

//仅对source(源码包)和build-dep命令有意义。指示给定的源代码包名不会通过二进制表映射信息。这意味着,如果指定了此选项,这些命令将只接受源码包名称作为参数,而不接受二进制包名称并查找相应的源包。配置项: APT::Get::Only-Source。

Only has meaning for the source and build-dep commands. Indicates that the given source names are not to be mapped through the binary table. This means that if this option is specified, these commands will only accept source package names as arguments, rather than accepting binary package names and looking up the corresponding source package. Configuration Item: APT::Get::Only-Source.

--diff-only, --dsc-only, --tar-only

//仅下载源存档的diff、dsc或tar文件。配置项: APT::Get::Diff-Only, APT::Get::Dsc-Only, and APT::Get::Tar-Only。

Download only the diff, dsc, or tar file of a source archive. Configuration Item: APT::Get::Diff-Only, APT::Get::Dsc-Only, and APT::Get::Tar-Only.

--arch-only

//仅处理依赖架构的构建依赖关系。配置项: APT::Get::Arch-Only。

Only process architecture-dependent build-dependencies. Configuration Item: APT::Get::Arch-Only.

--indep-only

//仅处理独立架构的构建依赖关系。配置项: APT::Get::Indep-Only。

Only process architecture-independent build-dependencies. Configuration Item: APT::Get::Indep-Only.

--allow-unauthenticated

//如果包无法通过身份验证则忽略它,也不进行提示。这在使用本地仓库时可能很有用,但如果用户本身不能以其他方式确保数据真实性,则会带来巨大的安全风险。对sources.list(5)条目使用Trusted选项通常应优先于此全局覆盖。配置项: APT::Get::AllowUnauthenticated。

Ignore if packages can't be authenticated and don't prompt about it. This can be useful while working with local repositories, but is a huge security risk if data authenticity isn't ensured in another way by the user itself. The usage of the Trusted option for sources.list(5) entries should usually be preferred over this global override. Configuration Item: APT::Get::AllowUnauthenticated.

--allow-insecure-repositories

//允许update(更新)命令从配置的源获取无法验证的数据。否则,APT将在没有有效加密签名的软件仓库的update(更新)命令中失败。有关概念和含义的详细信息,请参见apt-secure(8) 。配置项:Acquire::AllowInsecureRepositories。

Allow the update command to acquire unverifiable data from configured sources. APT will otherwise fail at the update command for repositories without valid cryptographically signatures. See also apt-secure(8) for details on the concept and the implications. Configuration Item: Acquire::AllowInsecureRepositories.

--allow-releaseinfo-change

//允许update(更新)命令继续从软件仓库下载数据,该存储库更改了存储库中包含的版本信息,例如指示新的主要版本。APT将在此类软件仓库的更新命令中失败,直到确认更改以确保用户为更改做好准备。有关概念和配置的详细信息,请参阅apt-secure(8) 。

//使用专业选项(--allow-releaseinfo-change-field)来允许对某些字段进行更改,如origin, label, codename, suite, version and defaultpin(如来源、标签、代号、套件、版本和默认PIN)。请参见apt_preferences(5)。配置项:Acquire::AllowReleaseInfoChange。

Allow the update command to continue downloading data from a repository which changed its information of the release contained in the repository indicating e.g a new major release. APT will fail at the update command for such repositories until the change is confirmed to ensure the user is prepared for the change. See also apt-secure(8) for details on the concept and configuration.

Specialist options (--allow-releaseinfo-change-field) exist to allow changes only for certain fields like origin, label, codename, suite, version and defaultpin. See also apt_preferences(5). Configuration Item: Acquire::AllowReleaseInfoChange.

--show-progress

//安装、升级或删除软件包时,在终端窗口中显示用户友好的进度信息。有关此数据的机器可解析版本,请参阅apt文档目录中的README.progress-reporting。配置项:Dpkg::Progress and Dpkg::Progress-Fancy。

Show user friendly progress information in the terminal window when packages are installed, upgraded or removed. For a machine parsable version of this data see README.progress-reporting in the apt doc directory. Configuration Items: Dpkg::Progress and Dpkg::Progress-Fancy.

--with-source filename

//将给定文件添加为元数据源。可以重复添加多个文件。有关更多详细信息,请参阅apt-cache(8)中的--with源代码描述。

Adds the given file as a source for metadata. Can be repeated to add multiple files. See --with-source description in apt-cache(8) for further details.

-eany, --error-on=any

//如果发生任何错误,即使是暂时的错误,更新命令也会失败。

Fail the update command if any error occured, even a transient one.

-U, --update

//在指定命令之前运行update命令。这适用于安装、删除或升级软件包的命令,如install, remove, safe-upgrade,full-upgrade(安装、删除、安全升级、完全升级)。这有助于确保命令始终安装最新版本,或者与--snapshot选项结合使用,以确保在运行安装时存在快照。

//附加说明:由于技术限制,每个阶段都会单独获取锁,因此,在执行update(更新)成功之后install(安装) 可能会获取锁失败。在解决这个问题之前,像apt update&&apt install这样连在一起,仅仅只是语法上的修饰。

Run the update command before the specified command. This is supported for commands installing, removing, or upgrading packages such as install, remove, safe-upgrade,full-upgrade. This can be useful to ensure a command always installs the latest versions, or, in combination with the --snapshot option to make sure the snapshot is present when install is being run.

Caveat: Due to technical limitations, locks are acquired individually for each phase, hence an install may fail to acquire locks after successfully executing the update. Until this is resolved, this is merely syntactic sugar for apt update && apt install

-h, --help

//显示简短的使用摘要。

Show a short usage summary.

-v, --version

//显示程序版本。

Show the program version.

-c, --config-file

//配置文件;指定要使用的配置文件。程序将读取默认配置文件,然后读取此配置文件。如果需要在解析默认配置文件之前设置配置设置,请指定一个包含APT_CONFIG环境变量的文件。语法信息请参见apt.conf(5)。

Configuration File; Specify a configuration file to use. The program will read the default configuration file and then this configuration file. If configuration settings need to be set before the default configuration files are parsed specify a file with the APT_CONFIG environment variable. See apt.conf(5) for syntax information.

-o, --option

//设置配置选项;这将设置任意配置选项。语法是-o Foo::Bar=bar. -o--option可以多次使用以设置不同的选项。

Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o Foo::Bar=bar. -o and --option can be used multiple times to set different options.

文件

FILES

/etc/apt/sources.list

//获取包的位置。配置项: Dir::Etc::SourceList。

Locations to fetch packages from. Configuration Item: Dir::Etc::SourceList.

/etc/apt/sources.list.d/

//用于从中获取包位置的文件片段。配置项:Dir::Etc::SourceParts。

File fragments for locations to fetch packages from. Configuration Item: Dir::Etc::SourceParts.

/etc/apt/apt.conf

//APT配置文件。配置项:Dir::Etc::Main。

APT configuration file. Configuration Item: Dir::Etc::Main.

/etc/apt/apt.conf.d/

//APT配置文件片段。配置项: Dir::Etc::Parts。

APT configuration file fragments. Configuration Item: Dir::Etc::Parts.

/etc/apt/preferences

//版本首选项文件。这是你指定“固定”的地方,即首选从单独的源或不同版本的分发中获取某些包。配置项: Dir::Etc::Preferences。

Version preferences file. This is where you would specify "pinning", i.e. a preference to get certain packages from a separate source or from a different version of a distribution. Configuration Item: Dir::Etc::Preferences.

/etc/apt/preferences.d/

//版本首选项的文件片段。配置项:Dir::Etc::PreferencesParts。

File fragments for the version preferences. Configuration Item: Dir::Etc::PreferencesParts.

/var/cache/apt/archives/

//已经检索获取到的包文件的存储区域。配置项:Dir::Cache::Archives。

Storage area for retrieved package files. Configuration Item: Dir::Cache::Archives.

/var/cache/apt/archives/partial/

//运输中的包文件存储区。配置项: Dir::Cache::Archives (partial will be implicitly appended)

Storage area for package files in transit. Configuration Item: Dir::Cache::Archives (partial will be implicitly appended)

/var/lib/apt/lists/

//sources.list(5)中指定的每个包资源的状态信息存储区域。配置项: Dir::State::Lists。

Storage area for state information for each package resource specified in sources.list(5) Configuration Item: Dir::State::Lists.

/var/lib/apt/lists/partial/

//运输中状态信息存储区。配置项: Dir::State::Lists (partial will be implicitly appended)

Storage area for state information in transit. Configuration Item: Dir::State::Lists (partial will be implicitly appended)

另见

SEE ALSO

apt-cache(8), apt-cdrom(8), dpkg(1), sources.list(5), apt.conf(5), apt-patterns(7), apt-config(8), apt-secure(8), The APT User's guide in /usr/share/doc/apt-doc/,apt_preferences(5), the APT Howto.

诊断

DIAGNOSTICS

apt-get returns zero on normal operation, decimal 100 on error.

错误

BUGS

APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.

作者

AUTHORS

Jason Gunthorpe

APT team

备注

NOTES

1. APT bug page

https://bugs.debian.org/src:apt

APT 2.7.14 12 March 2024 APT-GET(8)

1 人点赞