RHCE Package Management and Software Installation 1 — Questions and Answers
Question 1: Which command installs a package named 'httpd' using DNF on RHEL 8/9?
- dnf install httpd (Correct answer)
- rpm -i httpd
- yum add httpd
- apt install httpd
Correct answer: dnf install httpd
DNF is the default package manager on RHEL 8/9 and uses 'dnf install <package>' to install packages.
Question 2: Which directory contains DNF/YUM repository configuration files on RHEL?
- /etc/yum.conf.d/
- /etc/dnf/repos/
- /etc/yum.repos.d/ (Correct answer)
- /var/lib/dnf/repos/
Correct answer: /etc/yum.repos.d/
Repository .repo files are stored in /etc/yum.repos.d/ and are read by both YUM and DNF.
Question 3: What DNF command lists all currently installed packages on the system?
- dnf show installed
- dnf list installed (Correct answer)
- dnf query --all
- dnf info all
Correct answer: dnf list installed
'dnf list installed' displays all packages that are currently installed on the system.
Question 4: Which RPM option is used to query which package owns a specific file?
- rpm -qf /path/to/file (Correct answer)
- rpm -ql /path/to/file
- rpm -qi /path/to/file
- rpm -qc /path/to/file
Correct answer: rpm -qf /path/to/file
'rpm -qf' (query file) shows which installed package owns the specified file path.
Question 5: How do you enable a DNF module stream named 'nodejs:18' on RHEL 8/9?
- dnf module enable nodejs:18 (Correct answer)
- dnf stream enable nodejs:18
- dnf module switch-to nodejs:18
- dnf enable-module nodejs:18
Correct answer: dnf module enable nodejs:18
'dnf module enable <module>:<stream>' enables the specified stream without installing any packages.
Question 6: Which command installs a locally downloaded RPM file '/tmp/mypkg.rpm' while automatically resolving dependencies?
- rpm -ivh /tmp/mypkg.rpm
- dnf install /tmp/mypkg.rpm
- dnf localinstall /tmp/mypkg.rpm
- Both B and C are correct (Correct answer)
Correct answer: Both B and C are correct
Both 'dnf install /path/to/file.rpm' and 'dnf localinstall' resolve dependencies; plain 'rpm -i' does not resolve deps automatically.
Question 7: Which command removes the 'vsftpd' package along with any packages that depend on it?
- dnf erase vsftpd
- dnf remove vsftpd (Correct answer)
- dnf purge vsftpd
- rpm -e --cascade vsftpd
Correct answer: dnf remove vsftpd
'dnf remove' uninstalls the specified package and any packages that depend on it, making it the standard removal command.
Which command installs a package named 'httpd' using DNF on RHEL 8/9?