Bookmark this page

Lab: Install and Update Software Packages

In this lab, you manage software repositories, and install and upgrade packages from those repositories.

Outcomes

  • Manage software repositories.

  • Install and upgrade packages from repositories.

  • Install an RPM package.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start software-review

Instructions

  1. On the serverb machine, configure a software repository to obtain updates. Name the repository errata and configure the repository in the /etc/yum.repos.d/errata.repo file. Configure the errata.repo file to use the http://content.example.com/rhel9.0/x86_64/rhcsa-practice/errata repository. Do not verify GPG signatures.

    1. Log in to the serverb machine as the student user, and switch to the root user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ sudo -i
      [sudo] password for student: student
      [root@serverb ~]#
    2. Create the /etc/yum.repos.d/errata.repo file with the following content:

      [errata]
      name=Red Hat Updates
      baseurl=http://content.example.com/rhel9.0/x86_64/rhcsa-practice/errata
      enabled=1
      gpgcheck=0
  2. On serverb, install the rht-system package.

    1. List the available packages for the rht-system package.

      [root@serverb ~]# dnf list rht-system
      Last metadata expiration check: 0:05:27 ago on Wed 27 Apr 2022 05:01:59 AM EDT.
      Available Packages
      rht-system.noarch     1.0.0-2             errata
    2. Install the latest version of the rht-system package.

      [root@serverb ~]# dnf install rht-system
      ...output omitted...
      Total download size: 7.5 k
      Installed size: 300
      Is this ok [y/N]: y
      ...output omitted...
      Complete!
      [root@serverb ~]#
  3. For security reasons, the serverb machine must not be able to connect to a paper printer. You can achieve this effect by removing the cups package. When finished, exit from the root shell.

    1. List the installed cups package.

      [root@serverb ~]# dnf list cups
      Last metadata expiration check: 0:08:02 ago on Wed 27 Apr 2022 05:01:59 AM EDT.
      Installed Packages
      cups.x86_64        1:2.3.3op2-13.el9      @rhel-9.0-for-x86_64-appstream-rpms
      [root@serverb ~]#
    2. Remove the cups package.

      [root@serverb ~]# dnf remove cups.x86_64
      ...output omitted...
      Remove  46 Packages
      
      Freed space: 94 M
      Is this ok [y/N]: y
      ...output omitted...
      Complete!
    3. Exit from the root shell.

      [root@serverb ~]# exit
      [student@serverb ~]$
  4. The start script downloads the rhcsa-script-1.0.0-1.noarch.rpm package in the /home/student directory on the serverb machine.

    Confirm that the rhcsa-script-1.0.0-1.noarch.rpm package is available on serverb, and install it by using root privileges. Verify that the package is installed. Exit from the serverb machine.

    1. Verify that the rhcsa-script-1.0.0-1.noarch.rpm package is available on serverb.

      [student@serverb ~]$ rpm -q -p rhcsa-script-1.0.0-1.noarch.rpm -i
      Name        : rhcsa-script
      Version     : 1.0.0
      Release     : 1
      Architecture: noarch
      Install Date: (not installed)
      Group       : System
      Size        : 593
      License     : GPL
      Signature   : (none)
      Source RPM  : rhcsa-script-1.0.0-1.src.rpm
      Build Date  : Wed 23 Mar 2022 08:24:21 AM EDT
      Build Host  : localhost
      Packager    : Bernardo Gargallo
      URL         : http://example.com
      Summary     : RHCSA Practice Script
      Description :
      A RHCSA practice script.
      The package changes the motd.
    2. Install the rhcsa-script-1.0.0-1.noarch.rpm package.

      [student@serverb ~]$ sudo dnf install \
      rhcsa-script-1.0.0-1.noarch.rpm
      [sudo] password for student: student
      Last metadata expiration check: 0:11:06 ago on Wed 27 Apr 2022 05:01:59 AM EDT.
      Dependencies resolved.
      ==========================================================================
       Package          Architecture      Version        Repository        Size
      ==========================================================================
      Installing:
       rhcsa-script     noarch            1.0.0-1        @commandline      7.5 k
      
      Transaction Summary
      ==========================================================================
      Install  1 Package
      
      Total size: 7.5 k
      Installed size: 593
      Is this ok [y/N]: y
      Downloading Packages:
      Running transaction check
      Transaction check succeeded.
      Running transaction test
      Transaction test succeeded.
      Running transaction
        Preparing        :                                                 1/1
        Running scriptlet: rhcsa-script-1.0.0-1.noarch                     1/1
        Installing       : rhcsa-script-1.0.0-1.noarch                     1/1
        Running scriptlet: rhcsa-script-1.0.0-1.noarch                     1/1
        Verifying        : rhcsa-script-1.0.0-1.noarch                     1/1
      
      Installed:
        rhcsa-script-1.0.0-1.noarch
      
      Complete!
    3. Verify that the package is installed.

      [student@serverb ~]$ rpm -q rhcsa-script
      rhcsa-script-1.0.0-1.noarch
      [student@serverb ~]$
    4. Return to the workstation system as the student user.

      [student@serverb ~]$ exit
      logout
      Connection to serverb closed.
      [student@workstation ~]$

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade software-review

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish software-review

This concludes the section.

Revision: rh124-9.0-398f302