Dec 21 2008

Linux and Solaris Package Managers

Published by at 12:20 am under Linux,Solaris




Here’s a package managers basic commands quick reminder/comparative for (in this order)
– Linux Debian/Ubuntu,
– Linux Redhat/Suse and
– Solaris/OpenSolaris.
 
rpm and dpkg are basic package managers while yum (rpm) and apt-get/aptitude (dpkg) manage dependancies and (online) repositories.
 
# List ALL installed packages

dpkg --list
rpm -qa | grep rpm
pkginfo

 
# Remove package

dpkg --remove package or
aptitude remove package or
apt-get remove package
rpm -e package
pkgrm package

 
# Package installation

dpkg --install package or
aptitude install package or
apt-get install package
rpm -ivh package
pkgadd -d package

 
# Package upgrade

aptitude safe-upgrade package
rpm -Uvh package

 
# Package information

dpkg --status package or
aptitude show package or
apt-cache show package
rpm -q --info rpm
pkginfo -x package

 
# List package files

dpkg -L package
rpm -ql package
pkgchk -l package

 
# What package a file belongs to

dpkg --search /usr/bin/dpkg
rpm -qf /usr/bin/rpm
pkgchk -lp /usr/bin/ls or
grep "/usr/bin/ls" /var/sadm/install/contents

 
# Adding a Repository source
Debian/Ubuntu

/etc/apt/sources.list. Then run aptitude update

Redhat/Fedora/Suse

cd /etc/yum.repos.d
Create myown.repo
[myown]
name=Myown RPM Repository for Red Hat Enterprise Linux baseurl=http://myownrepos/redhat/$release/en/$basearch/
gpgcheck=1
enabled=1
Import the GPG key
rpm --import http://myownrepos/packages/RPM-GPG-KEY.txt

 
Debian advise using aptitude rather than apt-get as it’s supposed to manage dependancies in a better way.


No responses yet

Comments RSS

Leave a Reply