Home  >  Article  >  Operation and Maintenance  >  There are several types of package management in linux

There are several types of package management in linux

青灯夜游
青灯夜游Original
2022-07-01 16:50:054902browse

8 types of commonly used package management include: 1. DPKG, a Debian package management system; 2. apt, a package management system on Debian and Ubuntu; 3. apt-cache, an apt software package management tool; 4. RPM, a Red Hat package management system; 5. yum, a package manager that exists to resolve package dependencies; 6. DNF, a new generation of rpm package manager; 7. pkg, used by FreeBSD by default Package manager; 8. Pacman, Arch series package management system.

There are several types of package management in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

Most modern Unix-like operating systems provide a centralized mechanism for searching and installing software. Software is usually stored in repositories and distributed through packages. The work of handling packages is called package management. Packages provide the basic components of an operating system, as well as shared libraries, applications, services, and documentation.

In addition to installing software, the package management system also provides tools to update installed packages. Package repositories help ensure that the code used in your system has been reviewed and that the installed version of the software has been approved by developers and package maintainers.

Most package systems are built around a collection of package files. A package file is typically an archive file that contains compiled binaries and other resources for the software, as well as installation scripts. Package files also contain valuable metadata, including their dependencies and a list of other packages required to install and run them.

While the functionality and benefits of these package management systems are broadly the same, packaging formats and tools vary by platform:

##DebianUbuntu##CentOS.rpmyum##FedoraFreeBSDPorts,

1. DPKG

dpkg is a Debian package management system, and the package suffix is ​​.deb.

dpkg is a tool used to install, create and manage software packages under Linux systems. The software packages it installs are generally downloaded to the local software package, and the extension is deb.

Format: dpkg parameter package.deb (Beginners tend to forget to enter spaces. Spaces must be placed between commands and parameters, as well as parameters and software packages, otherwise Linux will not recognize it)

dpkg -i

dpkg -i is the command used to install software packages under Linux systems.

Format: /home/username/desktop/ # dpkg -i package.deb (At this time, the installation package is placed on the desktop, or it can be placed in other folders, in the file Open a terminal in the folder or # dpkg -i /absolute path/package.deb )

dpkg -r

dpkg -r is used to uninstall software packages under Linux systems The command. I recommend using it in conjunction with the dpkg -l command, because the name of the uninstalled software is not necessarily the same as the name of the installation package during installation.

Format: # dpkg -r package (can be in any path when uninstalling)

Use the dpkg -l command to find the software that needs to be uninstalled, and copy the software name (do not copy the software version together) , the copied software name replaces package

dpkg in the format -P

dpkg -P is used under Linux system to uninstall the software package and delete its configuration file at the same time Order. It is best to use this command if you want to completely uninstall the software package. I have encountered the problem that the installation of the later version of the software failed to be successful because it was not uninstalled cleanly.

Format: # dpkg -P package (for usage, please refer to dpkg -r)

dpkg -l

dpkg -l is under linux system Use the command to view a list of currently installed packages.

Format: # dpkg -l You can see all installed software packages

If you want to see a specific software, for example, the software I installed in the company has the gongsi key You can use # dpkg -l grep | gongsi to see the installation package with the gongsi keyword, where | is a vertical bar and not the letter l.

2. aptapt is the abbreviation of Advanced Package Tool, which is a software package that works on Debian, Ubuntu and other related Linux distributions. management system. apt provides functions such as automatic retrieval, configuration and installation of software packages on Unix-like operating systems to simplify software management.

apt, apt-get, and apt-cache commands use libraries to process software packages. apt can actually be regarded as the front end of dpkg, and is more user-friendly than the previous dselect.

apt integrates apt-get and apt-cache - these two commands have many functions but are often not used, so apt retains commonly used and important functions.

Commonly used commands:

# 从软件源同步最新的软件信息并缓存到本地 
apt update 

# 安装指定的包,并同时安装其依赖的其他包。 
apt install [package] 

# 更新软件版本 
apt upgrade 

# 查找软件,没有添加参数就是展示所有的软件包,加关键字就是搜索指定的包 
apt list zlib* 

# 列出已经安装的软件版本 
apt list --installed 

# 关键字搜索软件的名称和描述 
apt search zlib* 

# 卸载包,但是配置文件还是会保存着
apt remove [package] 

# 卸载包,并删除配置文件 
apt purge [package] 

# 卸载因安装软件自动安装的依赖 
apt autoremove 

# 删除所有已下载的软件包 
apt clean 

# 类似clean,但删除的是过期的包(即已不能下载或者是无用的包) 
apt autoclean

3. apt-cacheapt-cache is an apt software package under linux Management tool that queries apt's binary package cache files. Most information query functions of APT package management can be implemented by the apt-cache command. Through the apt-cache command and the use of different subcommands and parameters, functions such as searching and displaying software package information and package dependencies can be realized.

Common commands:

apt-cache show package_name
#显示指定软件包的信息,包括版本号,安装状态和包依赖关系等.

apt-cache search package_name
#搜索软件包,可以按关键字查找软件包,通常用于查询的关键字会使用软件包的名字或软件包的一部分.

apt-cache showpkg package_name
#显示软件包的依赖关系信息.

 apt-cache stats
#显示当前系统所使用的数据源的统计信息,用户可以使用该命令查看数据源的相关统计信息.

apt-cache policy package_name
#显示软件包的安装状态和版本信息.

apt-cache depends package_name
#显示指定软件包所依赖的软件包。当用户需要了解某个软件包依赖于其他哪些包时,可以使用apt-cache depends来查询包依赖关系.

apt-cache rdepends package_name
#查询指定软件包的反向依赖关系,即那些其他的软件包需要依赖你所指定的软件包做为安装和运行的必须条件.

apt-cache dump
#显示缓存中的每个软件包的简要描述信息.


apt-cache unmet
#显示不符合一致性的依赖关系.

4, RPM##RPM is a Red Hat package management system, and the package suffix is. rpm.

RPM is the abbreviation of Red-Hat Package Manager (RPM package manager). Although this file format name is marked with the RedHat logo, its original design concept is open and now includes OpenLinux, S.u.S.E. and Turbo Linux and other Linux distributions have adopted it, and it can be regarded as a recognized industry standard. A packaging and installation tool for Internet downloads, included with some Linux distributions. It generates files with .RPM extension. Similar to Dpkg.

In short, it is a software package in linux.

rpm package composition

There are several types of package management in linux##【1】Software name

  • 【2】Version

  • 【3】Applicable system

  • 【4】System architecture

  • 【5】Applicable to rpm system software

  • rpm related commands and parameters

You can use the rpm command to process the rpm package software

There are several types of package management in linux5、yum

##yum, the full name is "Yellow dog Updater, Modified", is a specialized A software package manager that exists to resolve package dependencies. Just like on Windows systems, you can use 360 ​​Software Manager to achieve one-click installation, upgrade, and uninstallation of software. Linux systems also provide such a tool, which is yum.

可以这么说,yum 是改进型的 RPM 软件管理器,它很好的解决了 RPM 所面临的软件包依赖问题。yum 在服务器端存有所有的 RPM 包,并将各个包之间的依赖关系记录在文件中,当管理员使用 yum 安装 RPM 包时,yum 会先从服务器端下载包的依赖性文件,通过分析此文件从服务器端一次性下载所有相关的 RPM 包并进行安装。

yum 软件可以用 rpm 命令安装,安装之前可以通过如下命令查看 yum 是否已安装:

# rpm -qa | grep yum
yum-metadata-parser-1.1.2-16.el6.i686
yum-3.2.29-30.el6.centos.noarch
yum-utils-1.1.30-14.el6.noarch
yum-plugin-fastestmirror-1.1.30-14.el6.noarch
yum-plugin-security-1.1.30-14.el6.noarch

可以看到,系统上已经安装了 yum。

yum基于 RPM 包管理,能够从指定的服务器自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。

yum 提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。

yum 语法

yum [options] [command] [package ...]
  • options:可选,选项包括-h(帮助),-y(当安装过程提示选择全部为 "yes"),-q(不显示安装的过程)等等。

  • command:要进行的操作。

  • package:安装的包名。

yum常用命令

1. 列出所有可更新的软件清单命令:yum check-update

2. 更新所有软件命令:yum update

3. 仅安装指定的软件命令:yum install

4. 仅更新指定的软件命令:yum update

5. 列出所有可安裝的软件清单命令:yum list

6. 删除软件包命令:yum remove

7. 查找软件包命令:yum search

8. 清除缓存命令:

  • yum clean packages: 清除缓存目录下的软件包

  • yum clean headers: 清除缓存目录下的 headers

  • yum clean oldheaders: 清除缓存目录下旧的 headers

  • yum clean, yum clean all (= yum clean packages; yum clean oldheaders) :清除缓存目录下的软件包及旧的 headers

6、DNF

DNF 是新一代的rpm软件包管理器。他首先出现在 Fedora 18 这个发行版中。而最近,它取代了yum,正式成为 Fedora 22 的包管理器。

DNF包管理器克服了YUM包管理器的一些瓶颈,提升了包括用户体验,内存占用,依赖分析,运行速度等多方面的内容。DNF使用 RPM, libsolv 和 hawkey 库进行包管理操作。尽管它没有预装在 CentOS 和 RHEL 7 中,但你可以在使用 YUM 的同时使用 DNF 。

安装 DNF 包管理器

DNF 并未默认安装在 RHEL 或 CentOS 7系统中,但是 Fedora 22 已经默认使用 DNF .

1、为了安装 DNF ,您必须先安装并启用 epel-release 依赖。

在系统中执行以下命令:

# yum install epel-release

或者

# yum install epel-release -y

其实这里并没有强制使用”-y”的理由,相反的,在不使用”-y”的情况下,用户可以在安装过程中查看到底有哪些东西被安装进了系统。但对于没有这个需求的用户,您可以在 YUM 中使用”-y”参数来自动安装所有东西。

2、使用 epel-release 依赖中的 YUM 命令来安装 DNF 包。在系统中执行以下命令:

# yum install dnf

然后, DNF 包管理器就被成功的安装到你的系统中了。接下来,是时候开始我们的教程了!在这个教程中,您将会学到27个用于 DNF 包管理器的命令。使用这些命令,你可以方便有效的管理您系统中的 RPM 软件包。现在,让我们开始学习 DNF 包管理器的27条常用命令吧!

7、pkg

FreeBSD默认使用的包管理器。

8、Pacman

Pacman是Arch系的包管理系统,新版本包后缀名是.pkg.tar.zst,之前的版本是.pkg.tar.xz。

相关推荐:《Linux视频教程

Operating Systems Format Tools
.deb apt, apt-cache,, dpkg
.deb apt, apt-cache,, dpkg
.rpm dnf
.txz pkg

The above is the detailed content of There are several types of package management in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn