LFCS Certification Software Package Management 2 — Questions and Answers
Question 1: Which command lists all files installed by a specific RPM package named 'nginx'?
- rpm -ql nginx (Correct answer)
- rpm -qi nginx
- rpm -qd nginx
- rpm -qR nginx
Correct answer: rpm -ql nginx
The `rpm -ql` command lists all files that belong to the specified installed package.
Question 2: On a Debian-based system, which command shows the installation candidate version of a package before installing it?
- apt-cache policy <package> (Correct answer)
- apt-cache show <package>
- dpkg -l <package>
- apt list <package>
Correct answer: apt-cache policy <package>
`apt-cache policy` displays version priorities and the installation candidate from configured repositories.
Question 3: What does the `yum history undo <id>` command do?
- Reverts a specific yum transaction by its ID (Correct answer)
- Removes the yum history database entry
- Undoes the last yum update only
- Lists packages changed in that transaction
Correct answer: Reverts a specific yum transaction by its ID
`yum history undo <id>` reverses the changes made by the transaction with the specified ID.
Question 4: Which file in a Debian package contains post-installation scripts?
- postinst (Correct answer)
- control
- conffiles
- preinst
Correct answer: postinst
The `postinst` maintainer script runs automatically after a package's files are unpacked.
Question 5: How do you configure a system to use a local directory as a YUM repository?
- Create a .repo file in /etc/yum.repos.d/ with baseurl=file:///path (Correct answer)
- Run yum-config-manager --add-repo /path
- Edit /etc/yum.conf and add localpath=/path
- Use yum install --enablerepo=local /path
Correct answer: Create a .repo file in /etc/yum.repos.d/ with baseurl=file:///path
A .repo file with a file:// URI in /etc/yum.repos.d/ tells YUM to use the local directory as a package source.
Question 6: Which dpkg command extracts the contents of a .deb file without installing it?
- dpkg-deb -x package.deb /target (Correct answer)
- dpkg -e package.deb /target
- dpkg --unpack package.deb
- dpkg-deb --info package.deb
Correct answer: dpkg-deb -x package.deb /target
`dpkg-deb -x` extracts the data files from a .deb archive into a target directory without running scripts.
Question 7: What is the purpose of the `createrepo` command?
- Generates metadata for a directory of RPM packages to make it a YUM repository (Correct answer)
- Creates a new RPM package from source files
- Initializes a new DNF repository configuration
- Rebuilds the RPM database after corruption
Correct answer: Generates metadata for a directory of RPM packages to make it a YUM repository
`createrepo` creates the repodata/ directory with XML metadata that YUM/DNF requires to use a directory as a repository.
Which command lists all files installed by a specific RPM package named 'nginx'?