Tag Archives: rpm

Working with .deb and .rpm packages

To list all packages installed on the system, from a terminal prompt enter:

dpkg -l
rpm -qa

Depending on the amount of packages on your system, this can generate a large amount of output. Pipe the output through grep to see if a specific package is installed:

dpkg -l | grep apache2
rpm -q httpd  or  rpm -qa | grep httpd

To list the files installed by a package, in this case the ufw package, enter:

dpkg -L ufw
rpm -qpl ufw

If you are not sure which package installed a file:

dpkg -S /etc/host.conf
base-files: /etc/host.conf

rpm -qf /etc/host.conf
setup-2.5.58-7.el5

To show information about an installed package:

dpkg -p {package}
rpm -qi {package}

To show information about a package file:

dpkg -l {package.rpm}
rpm -qpi {package.rpm}
yum info {package}

To show information about an installable package:

apt-cache show {package}
yum list {package}

To see what license an installed package uses:

rpm -qi {package} | grep License

To see what license a downloaded (not installed) package uses:

rpm -qip {package} | grep License

To get a package list so you can install the same packages on a different machine:

For .deb systems:

On first machine:
sudo dpkg -l | egrep -v ‘(rc|Desired|Status,Err|\+\+\+)’ | cut -f3 -d” ” > ~/packagelist

Then transfer ~/packagelist to your second machine to ~/ and you’ll need to setup the same repositories on the second machine as the first.

On second machine:
sudo apt-get install $(cat ~/packagelist)

To get a package list so you can install the same packages on a different machine:

For .deb systems:

On first machine:
sudo dpkg -l | egrep -v ‘(rc|Desired|Status,Err|\+\+\+)’ | cut -f3 -d” ” > ~/packagelist

Then transfer ~/packagelist to your second machine to ~/ and you’ll need to setup the same repositories on the second machine as the first.

On second machine:
sudo apt-get install $(cat ~/packagelist)