Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management - Part 2

Channel: Interview Questions Linux
Abstract: 6. You are not sure about what are the configuration files provided by a specific package say httpd. How will you find list of all the configuration f
6. You are not sure about what are the configuration files provided by a specific package say httpd. How will you find list of all the configuration files provided by httpd and their location.

Answer : We need to run option -c followed by package name with rpm command and it will list the name of all the configuration file and their location.

# rpm -qc httpd

/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf.modules.d/00-base.conf
/etc/httpd/conf/httpd.conf
/etc/sysconfig/httpd

Similarly we can list all the associated document files as:

# rpm -qd httpd

/usr/share/doc/httpd/ABOUT_APACHE
/usr/share/doc/httpd/CHANGES
/usr/share/doc/httpd/LICENSE
...

also, we can list the associated License file as:

# rpm -qL openssh

/usr/share/licenses/openssh/LICENCE

Not to mention that the option -d and option -L in the above command stands for ‘documents‘ and ‘License‘, respectively.

7. You came across a configuration file located at ‘/usr/share/alsa/cards/AACI.conf’ and you are not sure this configuration file is associated with what package. How will you find out the parent package name?

Answer : When a package is installed, the relevant information gets stored in the database. So it is easy to trace what provides the above package using option -qf (-f query packages owning files).

# rpm -qf /usr/share/alsa/cards/AACI.conf
alsa-lib-1.0.28-2.el7.x86_64

Similarly we can find (what provides) information about any sub-packge, document files and License files.

8. How will you find list of recently installed software’s using rpm?

Answer : As said earlier, everything being installed is logged in database. So it is not difficult to query the rpm database and find the list of recently installed software’s.

We can do this by running the below commands using option –last (prints the most recent installed software’s).

# rpm -qa --last

The above command will print all the packages installed in a order such that, the last installed software appears at the top.

If our concern is to find out specific package, we can grep that package (say sqlite) from the list, simply as:

# rpm -qa --last | grep -i sqlite

sqlite-3.8.10.2-1.fc22.x86_64                 Thursday 18 June 2015 05:05:43 PM IST

We can also get a list of 10 most recently installed software simply as:

# rpm -qa --last | head

We can refine the result to output a more custom result simply as:

# rpm -qa --last | head -n 2

In the above command -n represents number followed by a numeric value. The above command prints a list of 2 most recent installed software.

9. Before installing a package, you are supposed to check its dependencies. What will you do?

Answer : To check the dependencies of a rpm package (XYZ.rpm), we can use switches -q (query package), -p (query a package file) and -R (Requires / List packages on which this package depends i.e., dependencies).

# rpm -qpR gedit-3.16.1-1.fc22.i686.rpm 

/bin/sh
/usr/bin/env
glib2(x86-32) >= 2.40.0
gsettings-desktop-schemas
gtk3(x86-32) >= 3.16
gtksourceview3(x86-32) >= 3.16
gvfs
libX11.so.6
...
10. Is rpm a front-end Package Management Tool?

Answer : No! rpm is a back-end package management for RPM based Linux Distribution.

YUM which stands for Yellowdog Updater Modified is the front-end for rpm. YUM automates the overall process of resolving dependencies and everything else.

Very recently DNF (Dandified YUM) replaced YUM in Fedora 22. Though YUM is still available to be used in RHEL and CentOS, we can install dnf and use it alongside of YUM. DNF is said to have a lots of improvement over YUM.

Good to know, you keep yourself updated. Lets move to the front-end part.

Pages: 1 2 3

Ref From: tecmint

Related articles