Apt和Apt-Get教程及示例

Distributions like Ubuntu, Debian use APT as a default online package manager. APT works with dpkg together where apt resolves dependencies and download packages from internet, network share, etc. and dpkg installs, configure them. In this tutorial, we will look at how to use apt efficiently APT packages extensions are .deb which is actually dpkg packages. There is a GUI application manager synaptic which have base features of the APT. Here is a simple package name the information provided by the package name.

像Ubuntu,Debian这样的发行版都使用APT作为默认的在线软件包管理器。 APT与dpkg一起使用,其中apt解析依赖关系并从Internet,网络共享等下载软件包,然后dpkg安装,配置它们。 在本教程中,我们将研究如何有效地使用apt APT软件包,扩展名为.deb,实际上是dpkg软件包。 有一个具有APT基本功能的GUI应用程序管理器突触。 这是一个简单的包名,由包名提供信息。

包装信息 (Package Information)

yakkety 4.9.0-2 amd64
  • Yaketty is the packages original name which is given by the upstream provider. Some times package names can be changed and different from the upstream provider. But this situation is very rare.

    Yaketty是软件包的原始名称,由上游提供商提供。 有时,程序包名称可以更改,并且与上游提供程序不同。 但是这种情况非常罕见。

  • 4.9.0 is a version that is provided by the upstream developer.

    4.9.0是上游开发人员提供的版本。

  • -2 is version added by package maintainer in the Ubuntu repository. Some times distribution-related updates may be needed differently from the original program.

    -2是软件包维护者在Ubuntu系统信息库中添加的版本。 有时可能需要与原始程序不同的发行版相关更新。

  • amd64 is system architecture for this package which means it supports 64 bit.

    amd64是此软件包的系统体系结构,这意味着它支持64位。

更新包 (Update Packages)

Updating packages are done with two stages. First, we will update repository information. A repository is a place where packages are held in the HTTP or FTP server. The repository provides packages and metadata or information about packages. This information will get and then the required packages will updates.

更新软件包分为两个阶段。 首先,我们将更新存储库信息。 存储库是将软件包保存在HTTP或FTP服务器中的地方。 该存储库提供软件包和元数据或有关软件包的信息。 获取此信息,然后所需的软件包将更新。

$ sudo apt-get update
Update Packages
Update Packages
更新包

As we can see from the screenshot we get information about packages from tr.archive.ubuntu.com and updated our local information base. Now we will upgrade our packages.

从屏幕截图中可以看到,我们从tr.archive.ubuntu.com获取有关软件包的信息,并更新了本地信息库。 现在,我们将升级我们的软件包。

$ sudo apt-get upgrade
Upgrade Packages
Upgrade Packages
升级套餐

We can use the following command to make upgrade job more automatic

我们可以使用以下命令使升级作业更加自动化

$ sudo apt-get dist-upgrade

With this command upgrade, the related question will be automatically answered. To make things simple we can combine these two commands into a single line like below.

通过此命令升级,将自动回答相关问题。 为简单起见,我们可以将这两个命令合并为一行,如下所示。

$ sudo apt-get update && sudo apt-get dist-upgrade

升级套餐 (Upgrade Packages)

While upgrading we can see questions like Do you want to continue? [Y/n] Y We can automatically answer all questions with yes like below.

升级时,我们会看到诸如“您想继续吗?”的问题 [是/]是我们可以自动回答所有问题,如下所示。

$ sudo apt-get dist-upgrade -y

搜索包 (Search Packages)

Searching packages are easy. We will just provide the term or package name we want to search

搜索包很容易。 我们将只提供我们要搜索的术语或软件包名称

$ apt-cache search tmux
Search Packages
Search Packages
搜索包

We can see that there are some packages in the list but there is no string in the line like tmux. Searching is done in the package details too where we look next. We can search a term that is like google free-text search. We get more results.

我们可以看到列表中有一些软件包,但是像tmux这样的行中没有字符串。 搜索也在包详细信息中完成,我们接下来将查找。 我们可以搜索类似于Google自由文本搜索的术语。 我们得到更多结果。

$ apt-cache search tmu
Search Packages
Search Packages
搜索包

包装信息(Package Information)

We may want to get package details information about installed-size, architecture, dependencies, version, file name, description, maintainer,  etc.

我们可能想要获取有关安装大小,体系结构,依赖项,版本,文件名,描述,维护者等的软件包详细信息。

$ apt-cache show tmux
Package Info
Package Info
套餐信息

安装套件(Install Packages)

Installing packages is easy as other operations we just provide our package name to the apt-get install command like below.

安装软件包很容易,因为

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值