RPM tool
rpm tool deals with rpm packages directly, but cannot deal with packages placed in a repository.
Zypper, Yum,... tools deal with repositories.
$rpm -q package_name #e.g rpm -q subversion Query if a package is installed.$rpm -qf "*/bash" #find which package owns that file.#rpm -e package_name #deletes a package.$rpm -qi package_name # shows info about a package.$rpm -ql package_name # list files contained in package_name#rpm -i package.rpm # installs a rpm file package.#rpm -i --force package.rpm # forces package.rpm installation.#rpm -qpl foo.rpm # shows the files in foo.rpm file package.#rpm -ql foo # show files of an installed package.$rpm -q --scripts foo # shows installation and uninstallation scripts for foo package.$rpm -qR foo # shows which dependencies foo package requires.YUM (Fedora, etc)
#yum install foo # installs foo package from repository.#yum -y install foo # install foo package and answer yes to every question.#yum erase foo # deletes foo package.$yum search foo # searchs for packages containing foo pattern in its name or description.$yum provides "*/rpmbuild" # searchs for packages containing files matching the pattern. #yum info foo # shows info about foo package.#yum localinstall foo.rpm # installs foo.rpm package and searchs for dependencies in repositories.#yum update foo # updates foo package.#yum update # updates all the system.Install EPEL repository:
#yum install epel-release#yum install htop # After that we can install new packages like htop.RPMBUILD
#rpm -ivv python-tz-2006p-1.1.src.rpm # first we install a rpm source file.#rpmbuild -ba /usr/src/packages/SPECS/python-tz.spec # we build the binary package.NOTE: in Fedora based systems spec files are placed in /usr/src/redhat/SPECS
ZYPPER (OpenSuse 10.3 and up)
#zypper install foo # installs foo package from repository.#zypper remove foo # removes a package. e.g: zypper remove python-twisted-conch $zypper info python-twisted-conch # shows package info $zypper search python # searchs for packages matching python.#zipper ref && zipper dup # refresh repositories and then update the system.MANDRAKE
#urpmi foo # installs foo package or search package that match foo pattern.#urpme foo # erases foo package.$urpmf foo # searchs for rpm packages which contain files matching foo pattern.#urpme --auto-orphans # removes orphan packages.