------------------------------------------------------------------------------------------------------------------------- Cheatsheet: Common tasks with packages (Debian and RPM) Credits: http://programmmer.wordpress.com/2012/01/06/rpm-and-debian-common-tasks-for-lpic1/ ------------------------------------------------------------------------------------------------------------------------- Debian Install, upgrade and uninstall Debian binary packages. Install dpkg -i ./vim3.3-3.deb apt-get install vim install Install or upgrade one or more packages by name. Upgrade Upgrading a package is no different from installing one. However, you should use the -G option when upgrading with dpkg to ensure that the installation won't proceed if a newer version of the same package is already installed. dist-upgrade Upgrade automatically to new versions of Debian Linux. update Fetch a list of currently available packages. This is typically done before any changes are made to existing packages. upgrade Upgrade a system's complete set of packages to current versions safely. This command is conservative and will not process upgrades that could cause a conflict or break an existing configuration; it also will not remove packages. Uninstall dpkg -r elvis dpkg --purge elvis remove Remove specified packages. Obtain package information like version, content, dependencies, package integrity and installation status (whether or not the package is installed). dpkg -s apt List the installed packages using dpkg -l; if you don't specify a pattern, all packages will be listed: # dpkg -l xdm Use dpkg -S to determine the package from which a particular file was installed with the filename: # dpkg -S /usr/bin/nl Important files/commands /etc/apt/sources.list dpkg dpkg-reconfigure reconfigure an already installed package apt-get apt-cache query the APT cache gencaches - Build both the package and source cache showpkg - Show some general information for a single package showsrc - Show source records stats - Show some basic statistics unmet - Show unmet dependencies search - Search the package list for a regex pattern depends - Show raw dependency information for a package rdepends - Show reverse dependency information for a package pkgnames - List the names of all packages in the system aptitude install remove purge hold unhold keep reinstall update full-upgrade search RPM Install, re-install, upgrade and remove packages using RPM and YUM. Install rpm -i binutils-2.11.93.0.2-11.i386.rpm cpp-2.96-113.i386.rpm \ glibc-devel-2.2.5-44.i386.rpm gcc-2.96-113.i386.rpm rpm -ih gcc-2.96-113.i386.rpm -- with hash yum install samba Upgrade rpm -U gcc-2.96-113.i386.rpm yum check-update Remove Packages yum remove httpd rpm -e glibc-devel --nodeps Skip dependency testing --test Runs through the motions except actually uninstalling Obtain information on RPM packages such as version, status, dependencies, integrity and signatures. Check installed Pacackages with list yum list Collect information about a particular package yum info httpd List the packages that have been installed on the system: # rpm -qa Verify Mode Files from installed packages can be compared against their expected configuration from the RPM database by using rpm -V. Frequently used verify options --nofiles Ignores missing files. --nomd5 Ignores MD5 checksum errors. --nopgp Ignores PGP checking errors. Determine what files a package provides, as well as find which package a specific file comes from. Determine what package a particular file was installed from. Of course, not all files originate from packages: # rpm -qf /etc/aliases sendmail-8.11.6-15 List the files contained in a package: # rpm -qlp gnucash-1.3.0-1.i386.rpm -q query mode -l List all of the files contained in package. When used with -p, the package is a filename. -p option and specify a package name instead of a package filename Important files/commands rpm rpm2cpio Extract cpio archive from RPM Package Manager (RPM) package rpm2cpio rpm-1.1-1.i386.rpm /etc/yum.conf YUM is configured through the /etc/yum.conf configuration file. /etc/yum.repos.d/ Repositories may be added and modified through the /etc/yum.repos.d directory yumdownloader is a program for downloading RPMs from Yum repositories. Download the kernel RPM to /var/tmp: yumdownloader --destdir /var/tmp kernel List the URL for the kernel and kernel-smp RPMs: yumdownloader --urls kernel kernel-smp