Mastering Linux System Administration. Richard Blum
Читать онлайн книгу.-q bash bash-4.4.19-12.el8.x86_64 $ rpm -q zsh package zsh is not installed $
There are several options you can add to the query action to obtain more detailed information. Table 5.2 shows a few of the more commonly used query options.
TABLE 5.2: The rpm
Command Query Action Options
SHORT OPTION | LONG OPTION | DESCRIPTION |
---|---|---|
‐c
|
‐‐configfiles
|
Lists the names and absolute directory references of package configuration files |
‐i
|
‐‐info
|
Provides detailed information, including version, installation date, and signatures |
N/A |
‐‐provides
|
Shows what facilities the package provides |
‐R
|
‐‐requires
|
Displays various package requirements (dependencies) |
‐s
|
‐‐state
|
Provides states of the different files in a package, such as normal (installed), not installed , or replaced
|
N/A |
‐‐what‐provides
|
Shows to what package a file belongs |
You can also add the ‐i
action, which provides a detailed list of information on the package.
$ rpm -qi bash Name : bash Version : 4.4.19 Release : 12.el8 Architecture: x86_64 Install Date: Sat 05 Dec 2020 08:43:49 AM EST Group : Unspecified Size : 6861588 License : GPLv3+ Signature : RSA/SHA256, Tue 21 Jul 2020 12:08:45 PM EDT, Key ID 05b555b38483c65d Source RPM : bash-4.4.19-12.el8.src.rpm Build Date : Tue 21 Jul 2020 12:03:55 PM EDT Build Host : x86-02.mbox.centos.org Relocations : (not relocatable) Packager : CentOS Buildsys <[email protected]> Vendor : CentOS URL : https://www.gnu.org/software/bash Summary : The GNU Bourne Again shell Description : The GNU Bourne Again shell (Bash) is a shell or command language interpreter that is compatible with the Bourne shell (sh). Bash incorporates useful features from the Korn shell (ksh) and the C shell (csh). Most sh scripts can be run by bash without modification. $
From the output of the detailed query, you can see specific information, such as the date the package was installed and a brief description of the package.
LISTING INSTALLED PACKAGES
You can use the rpm
command to list all the packages installed on your Linux system by using the ‐a
option with the rpm ‐q
command, although the packages are returned in the order in which they were installed, which can make it hard to find a specific package. We like to use the command rpm ‐qa | sort
to sort the output by package name.
Installing Package Files
There are a couple of ways to install an rpm package that you have downloaded. For a new package, use the ‐i
action to install the package. However, if an older version of the package already exists on your system, you'll receive an error message.
It's more common to use the ‐U
action, which installs the new package, or upgrades the package if it's already installed on the system. It has also become somewhat common to add the ‐vh
options as well. The ‐h
option shows the progress of the update, and the ‐v
option shows what it's doing.
rpm -Uvh package
It's also important to remember that you must have root privileges to manually install packages, either as the root user or as a user account with root privileges.
MANUALLY INSTALLING RPM PACKAGES
The zsh package is an alternative shell that you can find in the standard CentOS repository. Follow these steps to manually install it:
1 Log into your CentOS server, either as the root user account or as a user account with root privileges.
2 Download the zsh package from the CentOS repository. You can do this either by using the command yumdownloader zsh or by manually downloading the package from mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages / and copying the file to your CentOS server. At the time of this writing, the current zsh package is zsh‐5.5.1‐6.el8_1.2.x86_64.rpm.
3 Install the zsh package by entering the command rpm ‐Uvh zsh‐5.5.1‐6.el8_1.2.x86_64.rpm. You should see output similar to this:# rpm -Uvh zsh-5.5.1-6.el8_1.2.x86_64.rpm Verifying… ################################# [100%] Preparing… ################################# [100%] Updating / installing… 1:zsh-5.5.1-6.el8_1.2 ################################# [100%] #
4 Verify the installation by entering the command zsh. You should then get the Z shell prompt and not an error message.
5 Return to your normal Bash Shell by typing the command exit.
6 Check whether the installation processed properly by typing the command dnflist installed zsh. You should see the package appear, indicating that it is installed.
Even though you installed the zsh package using the rpm
command‐line tool, it appears when you use the dnf
command to list the installed packages. This shows that both commands install packages to the same package management database.
Removing Package Files
To remove an installed package, just use the ‐e
action for the rpm
command.
# rpm -e zsh # rpm -q zsh package zsh is not installed # dnf list installed zsh Error: No matching Packages to list #
The ‐e
action doesn't show if it was successful, but it will display an error message if something goes wrong with the removal. You can check to make sure the removal was successful by using the ‐q
action to query the package database or by using the dnf list installed
command.
Using Flatpak Containers
As discussed in Chapter 3, “Installing and Maintaining Software in Ubuntu,” containers are software packaging systems that bundle all the files required to run an application into a single package. While this creates duplication of files, it helps eliminate the issue of conflicting library files and makes it easier to move application containers around between servers.
The flatpak application container format was created as an independent open source project with no direct ties to any specific Linux distribution.