Red Hat System Administration I
Gather information about a package from a third party, extract files from it for inspection, and then install it on a server.
Outcomes
Install on a server a package that is not from the software repositories.
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-rpm
Instructions
Use the
sshcommand to log in to theserveramachine as thestudentuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$View package information and list files in the
rhcsa-script-1.0.0-1.noarch.rpmpackage. Also view the script that runs when you install or uninstall the package.View information for the
rhcsa-script-1.0.0-1.noarch.rpmpackage.[student@servera ~]$
rpm -q -p rhcsa-script-1.0.0-1.noarch.rpm -iName : 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.Note
The preceding package modifies the MOTD, or "Message of the Day". A system displays the MOTD to users as they log in to systems.
List files in the
rhcsa-script-1.0.0-1.noarch.rpmpackage.[student@servera ~]$
rpm -q -p rhcsa-script-1.0.0-1.noarch.rpm -l/opt/rhcsa-script/mymotdView the script that runs when you install or uninstall the
rhcsa-script-1.0.0-1.noarch.rpmpackage.[student@servera ~]$
rpm -q -p rhcsa-script-1.0.0-1.noarch.rpm --scriptspreinstall scriptlet (using /bin/sh): if [ "$1" == "2" ]; then if [ -e /etc/motd.orig ]; then mv -f /etc/motd.orig /etc/motd fi fi postinstall scriptlet (using /bin/sh): ...output omitted...
Extract the contents of the
rhcsa-script-1.0.0-1.noarch.rpmpackage to the/home/studentdirectory.Use the
rpm2cpioandcpio -tvcommands to list the files in therhcsa-script-1.0.0-1.noarch.rpmpackage.[student@servera ~]$
rpm2cpio rhcsa-script-1.0.0-1.noarch.rpm | cpio -tv-rw-r--r-- 1 root root 593 Mar 23 08:24 ./opt/rhcsa-script/mymotd 2 blocksExtract all files from the
rhcsa-script-1.0.0-1.noarch.rpmpackage to the/home/studentdirectory. Use therpm2cpioandcpio -idvcommands to extract the files and create the parent directories where needed in verbose mode.[student@servera ~]$
rpm2cpio rhcsa-script-1.0.0-1.noarch.rpm | cpio -idv./opt/rhcsa-script/mymotd 2 blocksList the files in the
/home/student/optdirectory to verify that the extracted files are the same as the files inside the package.[student@servera ~]$
ls -lR optopt: total 0 drwxr-xr-x. 2 student student 20 Mar 23 09:22 rhcsa-script opt/rhcsa-script: total 4 -rw-r--r--. 1 student student 593 Mar 23 09:22 mymotd
Install the
rhcsa-script-1.0.0-1.noarch.rpmpackage. Use thesudocommand to gain superuser privileges to install the package.Use the
sudo rpm -ivhcommand to install therhcsa-script-1.0.0-1.noarch.rpmRPM package.[student@servera ~]$
sudo rpm -ivh rhcsa-script-1.0.0-1.noarch.rpm[sudo] password for student:studentVerifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:rhcsa-script-1.0.0-1 ################################# [100%] [student@servera ~]$Use the
rpmcommand to verify that you correctly installed the package.[student@servera ~]$
rpm -q rhcsa-scriptrhcsa-script-1.0.0-1.noarch
Exit from the
serveramachine and connect again to test the new message of the day.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation ~]$ssh student@servera______ _ _ _ _ _____ _ _ | ___ \ | | | | | | | | |_ _| (_) (_) | |_/ /___ __| | | |_| | __ _| |_ | |_ __ __ _ _ _ __ _ _ __ __ _ | // _ \/ _` | | _ |/ _` | __| | | '__/ _` | | '_ \| | '_ \ / _` | | |\ \ __/ (_| | | | | | (_| | |_ | | | | (_| | | | | | | | | | (_| | \_| \_\___|\__,_| \_| |_/\__,_|\__| \_/_| \__,_|_|_| |_|_|_| |_|\__, | __/ | |___/ Activate the web console with: systemctl enable --now cockpit.socket Register this system with Red Hat Insights: insights-client --register Create an account or view all your systems at https://red.ht/insights-dashboard Last login: Wed Mar 23 09:21:26 2022 from 172.25.250.9 [student@servera ~]$Return to the
workstationsystem as thestudentuser.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation ~]$