Package Management: Difference between revisions
Jump to navigation
Jump to search
(→Ubuntu / Debian: reformat - merge repo and package command) |
|||
Line 1: | Line 1: | ||
== Ubuntu / Debian == |
== Ubuntu / Debian == |
||
Installing a package |
Installing a package: |
||
<source lang="bash"> |
<source lang="bash"> |
||
# ----- Installing from the REPOSITORIES |
|||
apt-get update # (OPTIONAL) update the local repository cache |
apt-get update # (OPTIONAL) update the local repository cache |
||
apt-get install <package(s)> # Install given package |
apt-get install <package(s)> # Install given package |
||
Line 9: | Line 10: | ||
apt-get purge <package(s)> # Remove package and related configuration files |
apt-get purge <package(s)> # Remove package and related configuration files |
||
apt-get autoremove # Remove package installed to satisfy dependencies for some package and that are no more needed |
apt-get autoremove # Remove package installed to satisfy dependencies for some package and that are no more needed |
||
⚫ | |||
⚫ | |||
</source> |
</source> |
||
Querying |
Querying the '''cache''' or '''installed''' packages: |
||
<source lang=bash> |
<source lang=bash> |
||
# ----- Querying INSTALLED PACKAGE |
|||
dpkg --get-selections # Show the list of packages installed through apt-get |
dpkg --get-selections # Show the list of packages installed through apt-get |
||
dpkg --get-selections | grep php # ... filtering for some specific package keyword |
dpkg --get-selections | grep php # ... filtering for some specific package keyword |
||
Line 20: | Line 24: | ||
dlocate -S <file> # ... same as above but much faster (require package dlocate) |
dlocate -S <file> # ... same as above but much faster (require package dlocate) |
||
dlocate <file> # ... same as dpkg -L -S combined but much faster (require package dlocate) |
dlocate <file> # ... same as dpkg -L -S combined but much faster (require package dlocate) |
||
# ----- Querying the CACHE |
|||
apt-cache search <regex> # Search package cache (package name and description) for given <regex> |
apt-cache search <regex> # Search package cache (package name and description) for given <regex> |
||
apt-cache search --name-only <regex> # ... same but only search in package name |
apt-cache search --name-only <regex> # ... same but only search in package name |
||
apt-cache showpkg <package(s)> # Show information about given package(s) |
apt-cache showpkg <package(s)> # Show information about given package(s) |
||
# ----- Querying a .deb PACKAGE file |
|||
⚫ | |||
⚫ | |||
</source> |
</source> |
||
Line 74: | Line 82: | ||
apt-file search <file> # Display the name of all packages within repository that contain this file |
apt-file search <file> # Display the name of all packages within repository that contain this file |
||
apt-file search -x "/<file>$" # ... more accurate query using regex |
apt-file search -x "/<file>$" # ... more accurate query using regex |
||
</source> |
|||
⚫ | |||
<source lang=bash> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
</source> |
</source> |
||
Revision as of 21:44, 18 October 2009
Ubuntu / Debian
Installing a package:
# ----- Installing from the REPOSITORIES
apt-get update # (OPTIONAL) update the local repository cache
apt-get install <package(s)> # Install given package
apt-get upgrade # Install new version of all installed package (without installing new package)
apt-get remove <package(s)> # Remove package (or install it if package name prefixed with - )
apt-get purge <package(s)> # Remove package and related configuration files
apt-get autoremove # Remove package installed to satisfy dependencies for some package and that are no more needed
# ----- Installing from a .deb PACKAGE file
dpkg --install <debfile> # (or -i) Install a package from given .deb file
Querying the cache or installed packages:
# ----- Querying INSTALLED PACKAGE
dpkg --get-selections # Show the list of packages installed through apt-get
dpkg --get-selections | grep php # ... filtering for some specific package keyword
dpkg -L <package> # List files delivered by a given <package>
dlocate -L <package> # ... same as above but much faster (require package dlocate)
dpkg -S <file> # List packages providing given file
dlocate -S <file> # ... same as above but much faster (require package dlocate)
dlocate <file> # ... same as dpkg -L -S combined but much faster (require package dlocate)
# ----- Querying the CACHE
apt-cache search <regex> # Search package cache (package name and description) for given <regex>
apt-cache search --name-only <regex> # ... same but only search in package name
apt-cache showpkg <package(s)> # Show information about given package(s)
# ----- Querying a .deb PACKAGE file
dpkg --info <debfile> # (or -I) Show information of given .deb file
dpkg --content <debfile> # (or -c) Show content of given .deb file
Querying packages that are not installed yet (requires package apt-file):
Note: An alternative is to use the script [{{#file: dweblocate}} dweblocate], but apt-file is more powerful actually
apt-file update # (optional - needed 1st time use)
apt-file list <package> # Search package in repositories, and show the content
apt-file search <file> # Display the name of all packages within repository that contain this file
apt-file search -x "/<file>$" # ... more accurate query using regex
To add a repository:
vi /etc/apt/sources.list # or edit files in /etc/apt/sources.list.d/
apt-get update
To add a package authentication key:
gpg --keyserver keyserver.ubuntu.com --recv 247D1CFF # (optional) Get the key from some keyserver
gpg --export --armor 247D1CFF | sudo apt-key add - # Add the key
RPM's
- RPM RedHat Package Manager
- Using RPM: THe Basics (Part I)
- Install commands
rpm -ivh package # Installing a package - verbose and progress bars
rpm -iv -nodeps package # Installing a package (verbose), ignore dependencies
- Query commands
rpm -ql package # List files provided by a package
- To query a package that has not been installed, add -p option to the command:
rpm -qpl package # List files provided by a package