010-160 Package Management 1 — Questions and Answers
Question 1: Which command is used to install a package on a Debian-based Linux system?
- rpm -i package.rpm
- apt-get install package (Correct answer)
- yum install package
- pacman -S package
Correct answer: apt-get install package
apt-get install is the standard command for installing packages on Debian-based systems like Ubuntu.
Question 2: What does the 'dpkg -l' command do?
- Installs a .deb package file
- Lists all installed packages (Correct answer)
- Removes a package
- Downloads a package from the repository
Correct answer: Lists all installed packages
dpkg -l lists all installed packages on the system along with their version and description.
Question 3: Which file on Debian-based systems contains the list of software repositories?
- /etc/yum.repos.d/
- /etc/apt/sources.list (Correct answer)
- /etc/pacman.conf
- /etc/rpm/repos.conf
Correct answer: /etc/apt/sources.list
/etc/apt/sources.list defines the URLs and types of repositories that APT uses to fetch packages.
Question 4: What is the purpose of running 'apt-get update'?
- Upgrades all installed packages to the latest version
- Refreshes the local package index from repositories (Correct answer)
- Removes outdated packages from the system
- Installs system updates automatically
Correct answer: Refreshes the local package index from repositories
'apt-get update' downloads the latest package lists from configured repositories, refreshing the local index.
Question 5: Which RPM command option is used to query information about an installed package?
- rpm -i
- rpm -e
- rpm -q (Correct answer)
- rpm -U
Correct answer: rpm -q
rpm -q (query) retrieves information about installed packages from the RPM database.
Question 6: On a Red Hat-based system, which command would you use to remove a package?
- apt-get remove package
- dpkg -r package
- yum remove package (Correct answer)
- pkg delete package
Correct answer: yum remove package
yum remove (or dnf remove on newer systems) is the correct command to uninstall packages on Red Hat-based distributions.
Question 7: What is the file extension for packages managed by the RPM package manager?
- .deb
- .pkg
- .rpm (Correct answer)
- .tar
Correct answer: .rpm
RPM packages use the .rpm extension and are used on distributions like Red Hat, CentOS, and Fedora.
Which command is used to install a package on a Debian-based Linux system?