Five common Linux system installation package management tools (Chinese User Guide)

Five common Linux system installation package management tools (Chinese User Guide)

catalogue


This article introduces the installation package management tools of common Linux operating systems, mainly the commands they use!

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

1. dpkg

Ubuntu,Debian

The dpkg command is a utility used by Debian Linux system to install, create, and manage software packages.

Command line usage

# Dpkg (option) (parameter)
$ dpkg --help
Usage: dpkg [<option> ...] <command>

# option
-i: Install package
-r: Delete package
-P: Delete the configuration file of the software package while deleting it
-L: Displays the files associated with the package
-l: Displays a list of installed packages
--unpack: Unpack the software package
-c: Display the list of files in the package
--confiugre: Configuration package

# parameter
Deb Software package: specify the.deb software package

Example demonstration instructions

# Installation package
$ dpkg -i package.deb

# Delete package
$ dpkg -r package

# Delete package (including configuration file)
$ dpkg -P package

# Lists the files associated with the package
$ dpkg -L package

# Displays the version of the package
$ dpkg -l package

# Unpack the contents of the deb package
$ dpkg --unpack package.deb

# Search for the package content
$ dpkg -S keyword

# Lists the currently installed packages
$ dpkg -l

# List the contents of the deb package
$ dpkg -c package.deb

# Configuration package
$ dpkg --configure package

# List installed packages
$ sudo dpkg-query -l
$ sudo dpkg-query -l | less
$ sudo dpkg-query -l | grep tmux

2. apt

Ubuntu,Debian

The APT get command is an APT package management tool in the Debian Linux distribution. All Debian based distributions use this package management system. The deb package can package the files of an application together, which is roughly like the installation files on Windows.

Command line usage

# Apt get (option) (parameter)
$ apt --help
Usage: apt [options] command

# option
-c: Specify profile

# parameter
 Management instructions: for APT Management operation of software package
 Package: specify the package to be manipulated

Example demonstration instructions

# Update all installed packages
$ apt-get upgrade

# Upgrade the system to a new version
$ apt-get dist-upgrade

# to update
$ apt-get update

# Install a new package
$ apt-get install packagename

# Uninstall an installed software package (keep the configuration file)
$ apt-get remove packagename

# Uninstall an installed package (delete profile)
$ apt-get –purge remove packagename

# To delete the software you have deleted
$ apt-get autoclean apt

# The backup of the installed software will also be deleted
$ apt-get clean

# List installed packages
$ sudo apt list --installed
$ sudo apt list --installed | less
$ sudo apt list --installed | grep tmux

3. rpm

RHEL,CentOS

The RPM command is a management tool for RPM software packages. Rpm was originally a program used by Red Hat Linux distribution to manage various Linux packages. Because it follows GPL rules and is powerful and convenient, it is widely popular. Gradually adopted by other distributions. The appearance of RPM suite management makes Linux easy to install and upgrade, and indirectly improves the applicability of Linux.

Command line usage

# RPM (option) (parameter)
$ rpm --help
Usage: rpm [OPTION...]

# option
-a: Query all kits
-c: Only configuration configuration files are listed. This parameter needs to be matched"-l"Parameter usage
-d: Only text files are listed. This parameter needs to be matched"-l"Parameter usage
-e<Kit file>or--erase<Kit file>: Delete the specified Suite
-f<file>+: Query the suite with the specified file
-h or--hash: List tags when the kit is installed
-i: Displays information about the kit
-i<Kit file>or--install<Kit file>: Install the specified kit file
-l: Displays a list of files for the suite
-p<Kit file>+: Query specified RPM Kit file
-q: Using the inquiry mode, when encountering any problems, rpm The command will ask the user first
-R: Displays the association information of the suite
-s: Display file status, this parameter needs to be matched"-l"Parameter usage
-U<Kit file>or--upgrade<Kit file>: Upgrade the specified kit file
-v: Display instruction execution process
-vv: Detailed display of instruction execution process for troubleshooting

# parameter
 Software package: specify the rpm software package

Example demonstration instructions

# install
$ rpm -ivh your-package.rpm

# Forced installation
$ rpm --force -ivh your-package.rpm

# uninstall
$ rpm -e proftpd-1.2.8

# List all installed packages
$ rpm -qa
$ rpm -qa | grep sql

# Where are the files in the rpm package installed
$ rpm -ql ***.rpm
# A package that has not been installed
$ rpm -qlp ***.rpm
# An installed software package
$ rpm -ql ***.rpm

# Which software package is a program installed
$ rpm -qf `which Program name`   # Returns the full name of the package
$ rpm -qif `which Program name`  # Returns information about the package
$ rpm -qlf `which Program name`  # Returns the file list of the software package

4. yum

CentOS6,CentOS7

The yum command is an RPM based package manager in Fedora, RedHat and SUSE. It enables system administrators to update and manage RPM packages interactively and automatically. It can download and install RPM packages automatically from specified servers. It can automatically handle dependency relationships and install all dependent packages at once, without cumbersome downloading and installation.

Command line usage

# Yum (options) (parameters)
$ yum --help
Loaded plugins: fastestmirror, langpacks
Usage: yum [options] COMMAND

# option
-h: Display help information;
-y: Answer all questions“ yes";
-c: Specify the configuration file;
-q: Quiet mode;
-v: Detailed mode;
-d: Set debug level (0-10);
-e: Set error level (0-10);
-R: set up yum The maximum waiting time to process a command;
-C: It runs completely from the cache without downloading or updating any header files.

# parameter
install: install rpm Software package;
update: to update rpm Software package;
check-update: Check for updates available rpm Software package;
remove: Delete the specified rpm Software package;
list: Display the information of the software package;
search: Check the information of the software package;
info: Displays the specified rpm Description information and summary information of the software package;
clean: clear yum Expired cache;
shell: get into yum of shell Prompt;
resolvedep: display rpm Dependencies of software packages;
localinstall: Install local rpm Software package;
localupdate: Show local rpm Update the software package;
deplist: display rpm All dependencies of the package.

Example demonstration instructions

# install
$ yum install             # Install all
$ yum install package1    # Install the specified installation package (package1)
$ yum groupinsall group1  # Setup group group1

# Update and upgrade
$ yum update              # Update all
$ yum update package1     # Update the specified package package1
$ yum check-update        # Check updatable programs
$ yum upgrade package1    # Upgrade the specified package package1
$ yum groupupdate group1  # Upgrade program group group1

# Find display
$ yum list installed | grep mysql
$ yum list installed mysql*
$ yum info package1     # Display the installation package information (package1)
$ yum list              # Displays all installed and installable packages
$ yum list package1     # Displays the installation of the specified package (package1)
$ yum groupinfo group1  # Display program group group1 information

# Delete program
$ yum remove/erase package1  # Delete package package1
$ yum groupremove group1     # Delete program group group1
$ yum deplist package1       # View program package1 dependency

# Clear cache
$ yum clean packages    # Clear the software packages in the cache directory
$ yum clean headers     # Clear the headers in the cache directory
$ yum clean oldheaders  # Clear the old headers in the cache directory

5. dnf

RHEL8,CentOS8

DNF uses libsolv for dependency resolution, which is developed and maintained by SUSE to improve performance. Yum is mainly written in Python. It has its own method to deal with dependency resolution. Its API has no complete documentation, and its extension system only allows Python plug-ins. Yum is the front-end tool of RPM. It manages dependencies and resource pools, and then uses rpm to install, download and delete packages.

Since many long-standing problems in Yum have not been solved, the yum package manager has been replaced by the DNF package manager. These problems include poor performance, too much memory, and slow dependency resolution. What is the difference between DNF and YUM? Read.

Install DNF package manager

# rely on
$ yum install -y epel-release

# install
$ yum install -y dnf

# inspect
$ dnf –version

Introduction to common commands

# Install package
$ dnf install nano

# Upgrade package
$ dnf update systemd

# Upgrade all system packages
$ dnf update
$ dnf upgrade

# Check the update of system software package
$ dnf check-update

# Delete package
$ dnf remove nano
$ dnf erase nano

# Delete useless orphaned packages
$ dnf autoremove

# Delete cached useless packages
$ dnf clean all

# View DNF software libraries available in the system
$ dnf repolist

# View all available and unavailable DNF software libraries in the system
$ dnf repolist all

# List all RPM packages
$ dnf list

# List all installed RPM packages
$ dnf list installed

# List all RPM packages available for installation
$ dnf list available

# Search RPM packages in the software library
$ dnf search nano

# Find the provider of a file
$ dnf provides /bin/bash

# View package details
$ dnf info nano

# View all package groups
$ dnf grouplist

# Install a package group
$ dnf groupinstall 'Educational Software'

# Upgrade packages in a package group
$ dnf groupupdate 'Educational Software'

# Delete a package group
$ dnf groupremove 'Educational Software'

# Reinstall specific packages
$ dnf reinstall nano

# Rollback the version of a specific software
$ dnf downgrade acpid

# View the execution history of DNF commands
$ dnf history

# View all DNF commands and their uses
$ dnf help

# Get help on using a command
$ dnf help clean

Some software package groups
$ dnf grouplist

# Install a package group
$ dnf groupinstall 'Educational Software'

# Upgrade packages in a package group
$ dnf groupupdate 'Educational Software'

# Delete a package group
$ dnf groupremove 'Educational Software'

# Reinstall specific packages
$ dnf reinstall nano

# Rollback the version of a specific software
$ dnf downgrade acpid

# View the execution history of DNF commands
$ dnf history

# View all DNF commands and their uses
$ dnf help

# Get help on using a command
$ dnf help clean

Tags: Linux

Posted by azn_romeo_4u on Wed, 07 Sep 2022 22:00:05 +0530