apt apt 用法

This guide will walk you through everything you’d need to start using the apt command in Linux. Packages help in delivering or installing any application on a Linux running system. A Linux package is the pre-compiled version of any application.

本指南将引导您逐步了解在Linux中开始使用apt命令所需的一切。 软件包有助于在Linux操作系统上交付或安装任何应用程序。 Linux软件包是任何应用程序的预编译版本。

Packages make it easier for the end-user to work with applications. Instead of compiling from source, a package is like a Windows executable file that you can double-click to install.

软件包使最终用户更容易使用应用程序。 程序包就像Windows可执行文件一样,可以双击以进行安装,而不是从源代码进行编译。

These packages are available on the distribution’s repositories. You sure can manually handle the packages on your system if you like. But a package manager automates those tasks for you. Let’s get more understanding of the apt package manager today.

这些软件包在发行版的存储库中可用。 您可以根据需要手动处理系统上的软件包。 但是,程序包管理器会自动为您执行这些任务。 让我们今天对apt软件包管理器有更多的了解。

apt命令到底是什么? (What’s the apt command anyway?)

The Advanced Package Tool, Or ‘APT’ for short, is the package management service for Ubuntu and Debian based systems. If you have been using Linux for a while, you must have seen the apt command before.

Advanced Package Tool(简称“ APT”)是针对基于Ubuntu和Debian的系统的软件包管理服务。 如果您使用Linux已有一段时间,那么您之前一定已经看过apt命令。

APT provides a user-friendly and interactive front-end tool for the users to manage packages without the complexity of the dpkg command.

APT为用户提供了一种用户友好的交互式前端工具,使用户可以管理软件包,而无需dpkg的复杂性 命令。

The apt command is responsible for installing, updating, removing, and managing packages of Ubuntu and Debian based systems.

apt命令负责安装,更新,删除和管理基于Ubuntu和Debian的系统的软件包。

This package manager soared in popularity after its introduction within the Ubuntu 16.04 LTS version. While the apt command in Linux offers a wide range of functionality, this tutorial will briefly discuss the most essential ones – installing and removing packages, updating and upgrading repositories, and finally searching for packages.

该软件包管理器在Ubuntu 16.04 LTS版本中引入后Swift普及。 尽管Linux中的apt命令提供了广泛的功能,但本教程将简要讨论最基本的功能-安装和删除软件包,更新和升级存储库以及最终搜索软件包。

探索apt命令 (Exploring the apt command)

This command takes away the complexity of the dpkg interface and provides users with a simple and easy to understand method for managing packages in their repositories.

此命令消除了dpkg界面的复杂性,并为用户提供了一种简单易懂的方法来管理其存储库中的软件包。

Let us explore the common functions of the apt command. As the command works the same for both Debian and Ubuntu systems, we will only mention Ubuntu in this tutorial from now on.

让我们探讨apt命令的常见功能。 由于该命令对Debian和Ubuntu系统都起作用,因此从现在开始我们只会在本教程中提及Ubuntu。

1.安装软件包 (1. Installing a package)

The most basic use of the apt command in Ubuntu is for package installation. While many general-purpose programs and services come pre-installed with the operating system, it doesn’t take away the need to install new software on your system.

Ubuntu中apt命令的最基本用法是用于软件包安装。 尽管操作系统中已预装了许多通用程序和服务,但并不能消除在系统上安装新软件的需要。

The apt command in Ubuntu allows us to install packages using the install option. Here is the syntax for installing a program or service using the apt command on Ubuntu.

Ubuntu中的apt命令允许我们使用install选项安装软件包。 这是在Ubuntu上使用apt命令安装程序或服务的语法。


sudo apt install [package name1] [package-name2] [package-name3]

Here is how we use the apt install command to install a package on Ubuntu. In the screenshot below, we install the vsftpd package for an FTP server on Ubuntu.

这是我们使用apt install命令在Ubuntu上安装软件包的方式。 在下面的屏幕截图中,我们在Ubuntu上为FTP服务器安装了vsftpd软件包。

Sudo Apt Install
Sudo Apt安装

This command also allows the user to install multiple packages at once by listing the package names one after another separated by spaces as shown in the syntax example.

此命令还允许用户一次安装多个软件包,方法是依次列出软件包名称,并以空格隔开,如语法示例所示。

2.卸载软件包 (2. Uninstalling a package)

When you no longer need a program or service on your system, there is no use keeping it. It will only occupy system resources that you can devote to other purposes.

当您不再需要系统上的程序或服务时,将其保留就没有用了。 它只会占用您可以用于其他目的的系统资源。

The apt command takes care of it! We can uninstall a program or service from our system using the apt remove option.

apt命令会处理它! 我们可以使用apt remove选项从系统中卸载程序或服务。

Here is the syntax for removing a program or service from our system using the apt command.

这是使用apt命令从我们的系统中删除程序或服务的语法。


sudo apt remove [package name]
Sudo Apt Remove
Sudo Apt移除

However, There will be some orphaned files from the installed package even after it’s removed. In such a case you can use the purge remove option.

但是,即使已删除软件包,在安装的软件包中也会有一些孤立的文件。 在这种情况下,您可以使用“清除清除”选项。


sudo apt --purge remove [package-name]

This is generally a cleaner way of removing a package which also removes the files along with the package here automatically.

通常,这是一种删除软件包的更干净的方法,该方法还会在此处自动删除文件和软件包。

3.自动删除孤立的软件包 (3. Auto remove orphaned packages)

Apt command handles dependencies for you so the don’t generally need to worry about them when installing a package.

Apt命令为您处理依赖关系,因此在安装软件包时通常不需要担心它们。

But the case is different when you’re uninstalling packages. Only the critical dependencies are removed while removing a package. The rest stay in our systems.

但是在卸载软件包时情况有所不同。 删除软件包时,仅删除关键的依赖项。 其余的留在我们的系统中。

That’s where the autoremove functionality comes into play.

这就是自动删除功能发挥作用的地方。


sudo apt autoremove

The above command will uninstall all the orphaned packages from your system. This includes any package that was installed as a dependency and is no longer necessary.

上面的命令将从系统中卸载所有孤立的软件包。 这包括已安装为依赖项且不再需要的任何软件包。

4.更新APT存储库 (4. Updating APT repositories)

The dpkg stores all the packages available for installation on your Linux distribution. However, as these packages are stored locally you can often end up having old versions of packages for a program when newer versions have been released.

dpkg存储所有可用于在Linux发行版上安装的软件包。 但是,由于这些程序包存储在本地,因此,当发布了新版本的程序时,通常可能最终会获得程序的旧版本程序包。

This causes a need for a method to update your repositories. Guess what? The apt update option has got you covered.

这导致需要一种更新存储库的方法。 你猜怎么了? apt更新选项使您满意。


sudo apt update

It checks the online repositories and downloads all the updated packages to your local repository.

它检查在线存储库,并将所有更新的软件包下载到本地存储库。

5.升级系统软件包 (5. Upgrading your system packages)

Once we update our local repositories, it is a wise choice to upgrade all your programs and services to the latest versions. This is possible through the apt upgrade option of the apt command on Ubuntu.

一旦我们更新了本地存储库,明智的选择就是将所有程序和服务升级到最新版本。 这可以通过Ubuntu上apt命令的apt升级选项来实现。


sudo apt upgrade

This will scan all the installed packages on your system and find the programs or services which are running on an older version. Next, it will upgrade all such programs and services to the latest available versions.

这将扫描系统上所有已安装的软件包,并找到在旧版本上运行的程序或服务。 接下来,它将所有此类程序和服务升级到最新的可用版本。

This is an essential command as it allows you to initiate a system-wide upgrade using a single command.

这是必不可少的命令,因为它使您可以使用单个命令来启动系统范围的升级。

But the above command will only upgrade non-critical packages. If there’s a kernel update available, we’ll need to perform a full system upgrade using the following command:

但是上面的命令只会升级非关键软件包。 如果有可用的内核更新,则需要使用以下命令执行完整的系统升级:


sudo apt full-upgrade

The above command will upgrade the Linux kernel along with any system critical packages that weren’t upgraded with the previous command. You will generally need a restart after a full-upgrade so the new kernel boots up.

上面的命令将升级Linux内核以及所有未使用先前命令升级的系统关键软件包。 全面升级后,通常需要重新启动,以便启动新内核。

6.搜索包 (6. Searching for a package)

The apt search command is the most common command used to search for packages on Ubuntu. It is designed to search the package name along with its metadata such as the description, dependencies, source and version.

apt search命令是用于在Ubuntu上搜索软件包的最常用命令。 它旨在搜索包名称及其元数据,例如描述,依赖项,源和版本。

The command returns all the packages whose name or metadata matches the specified search keyword. Following is the syntax for searching a package using the apt search command.

该命令返回名称或元数据与指定搜索关键字匹配的所有软件包。 以下是使用apt search命令搜索软件包的语法。


sudo apt search [keyword]

结论 (Conclusion)

Linux based systems utilize packages for installing and running all kinds of applications and services. This makes it essential for a Linux user to be able to manage and keep a note of all the available packages in their local repository.

基于Linux的系统利用软件包来安装和运行各种应用程序和服务。 这使得Linux用户必须能够管理和记录本地存储库中所有可用软件包的记录。

The dpkg is difficult to navigate even for experienced Linux users. Hence the Advanced Package Tool is cherished as a valuable tool to help people interact with the packages in their repositories.

即使对于有经验的Linux用户,dpkg也很难导航。 因此,高级软件包工具被视为一种有价值的工具,可以帮助人们与存储库中的软件包进行交互。

This tutorial aimed at getting you up and running with the command. If you have any feedback, feel free to reach out to us in the comments below.

本教程旨在使您入门并使用该命令。 如果您有任何反馈意见,请随时通过以下评论与我们联系。

翻译自: https://www.journaldev.com/41725/apt-command-tutorial

apt apt 用法

apt apt 用法_apt命令–实用用法指南相关推荐

  1. lsof 命令实用用法介绍

    Table of Contents 前言 Linux 下有哪些文件 lsof 命令实用用法介绍 查看当前打开的所有文件 列出被删除但占用空间的文件 恢复打开但被删除的文件 查看当前文件被哪些进程打开 ...

  2. 的tree用法_linux命令tree用法

    CentOS7.3学习笔记总结(四十九)-linux命令tree用法 tree命令用于以树状图形方式列出目录结构(指定目录下的所有文件.所有目录). 该命令默认未安装,安装命令:yum -y inst ...

  3. java javac命令用法_javac命令的用法介绍

    javac命令的用法介绍,javac命令参数实例,参数有哪些?相关参数介绍: javac的用法: javac 其中, 可能的选项包括: -g 生成所有调试信息 -g:none 不生成任何调试信息 -g ...

  4. linux中uniq的用法,uniq命令的用法

    uniq用法u n i q用来从一个文本文件中去除或禁止重复行.一般u n i q假定文件已分类,并且结果正确.我们并不强制要求这样做,如果愿意,可以使用任何非排序文本,甚至是无规律行.可以认为u n ...

  5. 计算机网络ping用法,Ping命令及用法详解

    Ping命令的原理与作用 Ping命令可以测试计算机名和计算机的IP地址,验证与远程计算机的连接,通过向计算机发送ICMP( Internet Control and Message Protocal ...

  6. bat for循环_bat教程[279] reg import命令的用法

    古树屋Click to follow us C:\Users\86137>reg import /?REG IMPORT FileName[/reg:32 | /reg:64] FileName ...

  7. bat ping 返回值_bat教程[273] print命令的用法

    古树屋Click to follow us (1)print命令的简介 C:\Users\86137>print /?打印文本文件.PRINT [/D:device] [[drive:][pat ...

  8. linux apt 命令,Ubuntu系统中apt命令的用法汇总

    apt是Advanced Packaging Tool的简称,是一款安装包管理工具.那么要如何使用apt命令来管理安装包呢?apt命令有哪些参数呢?下面小编就给大家详细介绍下Ubuntu中apt命令的 ...

  9. dpkg和apt-get命令的用法

    apt-get命令的用法 安装软件 root@ubuntu:~# sudo apt-get install libc6 libconfig9 更新所有已安装的软件包: $ sudo apt-get u ...

最新文章

  1. 想要永久远程办公?抱歉,你可能「不配」
  2. Vivado中使用逻辑分析仪ILA
  3. 修改用户名_新华美育查找用户名及修改密码的方法分享
  4. 如何使用VS2015开发Qt5程序
  5. python 优雅的解析 jsonp
  6. Android TextView中文字通过SpannableString来设置超链接、颜色、字体等属性
  7. linux php imagick 扩展安装,linux下为php5.3安装Imagick扩展
  8. 阿里云Linux服务器Tomcat9.0的安装及配置
  9. 从Android到React Native开发(三、自定义原生控件支持)
  10. autoware中pure_pursuit控制和MPC控制解析
  11. 朋友圈点赞图在线生成源码
  12. Win10完美运行红色警戒2的安装包和补丁_我是亲民_新浪博客
  13. 九州8508机顶盒安装软件教程记录
  14. 新技术在支付清算行业的创新应用
  15. NGINX源码之:ngx_hash
  16. 二分图/二部图(bipartite graph)
  17. 在matlab神经网络中xite,神经网络的MATLAB实现苏析超
  18. LWN:5.18 合并窗口,第二部分!
  19. typescript 中 public private protect 区别
  20. 自制Ghost封装系统在企业中的应用

热门文章

  1. 老白聊数据-关于销售预测的那些事
  2. 课堂练习--最大子数组和
  3. 一个优秀的Android应用从建项目开始
  4. Android应用程序中的多个Activity的显示创建和调用
  5. [Unity菜鸟] Character控制移动
  6. [转载] 字符串的startsWith和endWith方法
  7. [转载] python中svm的使用_Python中支持向量机SVM的使用方法详解
  8. [转载] python-pandas创建Series数据类型
  9. [转载] java简易爬虫Crawler
  10. 前端之CSS第二部分属性相关