Mastering Linux System Administration. Richard Blum
Чтение книги онлайн.
Читать онлайн книгу Mastering Linux System Administration - Richard Blum страница 37
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. That said, battle lines have already been drawn, with Red Hat, CentOS, and Fedora oriented toward using flatpak instead of Canonical's snap container format.
While CentOS desktop distributions install flatpak by default, the CentOS server environment doesn't. However, you can easily install flatpak as a package using the standard dnf
or rpm
methods.
INSTALLING FLATPAK
The flatpak container format provides quick installation of many popular application programs. To use flatpak on your CentOS server, you'll need to first install the software package and then install the repository configuration by following these steps:
1 Log onto your CentOS server as the root user account.
2 From the command‐line prompt, enter the command dnf install flatpak. There are lots of dependencies required, so you'll see quite a few packages install.
3 Once flatpak is installed, you will need to point it to a flatpak container repository. The most popular one is Flathub. Configure that by entering the command flatpak remote‐add ‐‐if‐not‐exists flathub https://flathub.org/repo/flathub.flatpakrepo. You should see output that's similar to this:# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo Note that the directories '/var/lib/flatpak/exports/share' '/root/.local/share/flatpak/exports/share' are not in the search path set by the XDG_DATA_DIRS environment variable, so applications installed by Flatpak may not appear on your desktop until the session is restarted. #
4 Test the flatpak command by entering the command flatpak list.# flatpak list #Not too exciting. When you first install flatpak, there won't be any containers installed, but now you know that flatpak is installed.
To find an application in the flatpak repository, you use the flatpak search
command.
# flatpak search mosh Name Description Application ID Version Branch Remotes Mosh The Mobile Shell org.mosh.mosh 1.3.2 stable flathub #
When working with a container, you must use its Application ID value and not its name. To install the application, use the flatpak install
command.
# flatpak install org.mosh.mosh Looking for matches… Found similar ref(s) for 'mosh' in remote 'flathub' (system). Use this remote? [Y/n]: y Found ref 'app/org.mosh.mosh/x86_64/stable' in remote 'flathub' (system). Use this ref? [Y/n]: y Required runtime for org.mosh.mosh/x86_64/stable (runtime/org.freedesktop.Platform/x86_64/20.08) found in remote flathub Do you want to install it? [Y/n]: y … Installation complete. #
To check whether the installation went well, you can use the flatpak list
command again.
# flatpak list Name Application ID Version Branch Installation Freedesktop Plat… org.freedesktop.Platform 20.08.2 20.08 system default …freedesktop.Platform.GL.default 20.08 system openh264 …g.freedesktop.Platform.openh264 2.1.0 2.0 system Mosh org.mosh.mosh 1.3.2 stable system #
Finally, to remove an application container, use the flatpak uninstall
command.
# flatpak uninstall org.mosh.mosh ID Branch Op 1. [-] org.mosh.mosh stable r Uninstall complete. #
Using application containers is similar to using package management systems, but what goes on behind the scenes is fundamentally different. However, the end result is that you have an application installed on your Linux system that can be easily maintained and upgraded.
The Bottom Line
Recognize Red Hat packages. Developers bundle the files required for an application into a package to make it easier to install. A package management system allows you to easily track what software packages are installed on your Linux system, as well as install, update, and remove them. Red Hat–based Linux distributions use the Red Hat Package Management (RPM) system for managing application software. The rpm command‐line tool provides access to the package management database, allowing you to quickly determine the status of installed packages.Master It The curl software package allows you to easily transfer data using a multitude of protocols (such as FTP, HTTP, and SCP) from the command line. What command would you use to determine whether curl is installed on your Linux system? If the package is installed, what command would you use to view the version and a description of the package?
Use automated Red Hat package managers. Most Red Hat–based Linux distributions are based on the rpm utility but use different front‐end tools at the command line. Red Hat, CentOS, and Fedora use dnf for installing and managing software packages. The dnf tool automatically installs any software packages required by the package you install.Master It The perf utility allows you to monitor the performance of a Linux system. What command would you use to check whether the perf software is available as an rpm package for your Linux system, and what command would you use to install it? What command would you use to remove it?
Manually install Red Hat packages. Not all Linux systems are connected to the Internet, allowing the automated package management tools to connect to a repository. In those situations, you'll