Commands for Linux Package Management. e.g. apt-get, HomeBrew, Port
- Debian/Ubuntu
Name | Command |
---|---|
Install given version package | apt-get install subversion-tools=1.3.2-5~bpo1 |
Uninstall packages | dpkg –remove python-boto |
Remove orphaned packages | apt-get autoremove |
extract contents of a package | ar x <packageFileName> |
Reinstall packages | apt-get –reinstall install tree |
Upgrade a package | apt-get –only-upgrade install bash |
Search a package | apt-get install -y aptitude; aptitude search openssl |
List files installed by package | dpkg –listfiles openssh-server |
List installed packages | dpkg -l |
Check package info | dpkg -s pm-utils |
Install package by file | dpkg -i package-name-here.deb |
Sort installed packages by size | dpkg-query -W –showformat=’\({Installed-Size}\t\){Package}\n’; sort -nr |
Check pacakges by file | dpkg -S /usr/lib/libgtk-1.2.so.0.9.1 |
- Redhat/CentOS
Name | Command |
---|---|
Install given version package | yum install kernel-debuginfo-2.6.18-238.19.1.el5 |
Uninstall packages | yum remove zookeeper |
Uninstall packages | rpm -e –nodeps autoconf-2.59 |
Reinstall packages | |
Upgrade a package | |
Search a package | yum list available ‘graphviz*’ |
List files installed by package | rpm -ql zookeeper |
List installed packages | rpm -qa |
List installed packages | yum list installed |
Check package info | yum info zookeper |
Install package by file | rpm -ivh epel-release-6-8.noarch.rpm |
Sort installed packages by size | rpm -qa –queryformat ‘%{SIZE} %{NAME} %{VENDOR}\n’; sort -n -r |
Check pacakges by file | yum provides /usr/sbin/semanage |
- Mac OSX
Name | Command |
---|---|
Install given version package | brew install postgresql8 |
Uninstall packages | |
Reinstall packages | |
Upgrade a package | brew upgrade bash |
Search a package | brew search postgresql |
List files installed by package | HomeBrew: brew ls mysql |
List files installed by package | OpenPorts: port contents libiconv |
List installed packages | |
Check package info | |
Install package by file | Double click *.dmg file |
Install package by file | sudo installer -pkg GCC-10.7-v2.pkg -target / |
Sort installed packages by size | |
Check pacakges by file |
Blog URL: https://www.dennyzhang.com/linux_package_mgmt