RHCSA Rapid Track
Install and remove packages and package groups.
Outcomes
Install and remove packages with dependencies.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that all required resources are available.
[student@workstation ~]$ lab start software-dnf
Instructions
From
workstation, open an SSH session to theserveramachine as thestudentuser. Use thesudo -icommand to switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Search for a specific package.
Try to run the
nmapcommand. You should find that it is not installed.[root@servera ~]#
nmap-bash: nmap: command not foundUse the
dnf searchcommand to search for packages withnmapas part of their name or summary.[root@servera ~]#
dnf search nmap...output omitted... ========================= Name Exactly Matched: nmap ========================== nmap.x86_64 : Network exploration tool and security scanner ======================== Name & Summary Matched: nmap ========================= nmap-ncat.x86_64 : Nmap's Netcat replacementUse the
dnf infocommand to obtain more information about thenmappackage.[root@servera ~]#
dnf info nmap...output omitted... Available Packages Name : nmap Epoch : 3 Version : 7.91 Release : 10.el9 ...output omitted...
Use the
dnf installcommand to install thenmappackage.[root@servera ~]#
dnf install nmap...output omitted... Dependencies resolved. =============================================================================== Package Arch Version Repository Size =============================================================================== Installing: nmap x86_64 3:7.91-10.el9 rhel-9.0-for-x86_64-appstream-rpms 5.6 M Transaction Summary =============================================================================== Install 1 Package Total download size: 5.6 M Installed size: 24 M Is this ok [y/N]:y...output omitted... Complete!Remove packages.
Use the
dnf removecommand to remove thenmappackage, but respond withnowhen prompted. How many packages are removed?[root@servera ~]#
dnf remove nmapDependencies resolved. =============================================================================== Package Arch Version Repository Size =============================================================================== Removing: nmap x86_64 3:7.91-10.el9 @rhel-9.0-for-x86_64-appstream-rpms 24 M Transaction Summary =============================================================================== Remove 1 Package Freed space: 24 M Is this ok [y/N]:nOperation aborted.Use the
dnf removecommand to remove thetarpackage, but respond withnowhen prompted. How many packages are removed?[root@servera ~]#
dnf remove tar...output omitted... Dependencies resolved. =============================================================================== Package Arch Version Repository Size =============================================================================== Removing: tar x86_64 2:1.34-3.el9 @System 3.0 M Removing dependent packages: cockpit x86_64 264-1.el9 @rhel-9.1-for-x86_64-baseos-rpms 57 k cockpit-system noarch 264-1.el9 @System 3.3 M ...output omitted... Transaction Summary =============================================================================== Remove 12 Packages Freed space: 48 M Is this ok [y/N]:nOperation aborted.
Gather information about the "Security Tools" component group and install it on
servera.Use the
dnf group listcommand to list all available component groups.[root@servera ~]#
dnf group listUse the
dnf group infocommand to obtain more information about theSecurity Toolscomponent group, including a list of included packages.[root@servera ~]#
dnf group info "Security Tools"...output omitted... Group: Security Tools Description: Security tools for integrity and trust verification. Default Packages: scap-security-guide Optional Packages: aide hmaccalc openscap openscap-engine-sce openscap-utils scap-security-guide-doc scap-workbench tpm2-tools tss2 udicaUse the
dnf group installcommand to install theSecurity Toolscomponent group.[root@servera ~]#
dnf group install "Security Tools"...output omitted... Dependencies resolved. =============================================================================== Package Arch Version Repository Size =============================================================================== Installing group/module packages: scap-security-guide noarch 0.1.60-5.el9 rhel-9.0-for-x86_64-appstream-rpms 683 k Installing dependencies: openscap x86_64 1:1.3.6-3.el9 rhel-9.0-for-x86_64-appstream-rpms 2.0 M ...output omitted... Transaction Summary =============================================================================== Install 5 Packages Total download size: 3.0 M Installed size: 94 M Is this ok [y/N]:y...output omitted... Installed: openscap-1:1.3.6-3.el9.x86_64 openscap-scanner-1:1.3.6-3.el9.x86_64 scap-security-guide-0.1.60-5.el9.noarch xmlsec1-1.2.29-9.el9.x86_64 xmlsec1-openssl-1.2.29-9.el9.x86_64 Complete!
Explore the history and undo options of the
dnfcommand.Use the
dnf historycommand to display recentdnfhistory.[root@servera ~]#
dnf historyID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 3 | group install Security T | 2022-03-24 15:23 | Install | 6 2 | install nmap | 2022-03-24 15:12 | Install | 1 1 | -y install @base firewal | 2022-03-03 04:47 | Install | 156 EEOn your system, the history is probably different.
Use the
dnf history infocommand to confirm that the last transaction is the group installation. In the following command, replace the transaction ID with the one from the preceding step.[root@servera ~]#
dnf history infoTransaction ID : 3 Begin time : Thu 24 Mar 2022 03:23:56 PM EDT Begin rpmdb : 7743aed72ac79f632442c9028aafd2499a1591f92a660b3f09219b422ca95f02 End time : Thu 24 Mar 2022 03:23:58 PM EDT (2 seconds) End rpmdb : 20c4f0215388b7dca9a874260784b1e5cf9bc142da869967269e3d84dd0f789d User : Student User <student> Return-Code : Success Releasever : 9 Command Line : group install Security Tools Comment : Packages Altered: Install openscap-1:1.3.6-3.el9.x86_64 @rhel-9.0-for-x86_64-appstream-rpms Install openscap-scanner-1:1.3.6-3.el9.x86_64 @rhel-9.0-for-x86_64-appstream-rpms ...output omitted...3Use the
dnf history undocommand to remove the set of packages that were installed when thenmappackage was installed. On your system, find the correct transaction ID from the output of thednf historycommand, and then use that ID in the following command.[root@servera ~]#
dnf history undo2
Return to the
workstationsystem as thestudentuser.[root@servera ~]#
exitlogout [student@servera ~]$exitConnection to servera closed. [student@workstation ~]$