Package Management: Difference between revisions

From miki
Jump to navigation Jump to search
(→‎Ubuntu / Debian: Add package authentication key)
Line 1: Line 1:
== Ubuntu / Debian ==
== Ubuntu / Debian ==


Adding / removing / querying packages:
<source lang=bash>
<source lang=bash>
dpkg -i <package> # Install a package from local file
dpkg -i <package> # Install a package from local file
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
dpkg -L <package> # List files delivered by a given <package>
dpkg -L <package> # List files delivered by a given <package>
dpkg -S <file> # List packages providing given file
dlocate -L <keyword> # ... same as above but much faster (require package dlocate)
dlocate <file> # ... fast version of dpkg -S and dpkg -L combined (require package dlocate)
dpkg -S <file> # List packages providing given file
dlocate -S <file> # ... fast version of dpkg -S (require package dlocate)
dlocate -S <file> # ... same as above but much faster (require package dlocate)
dlocate -L <keyword> # ... fast version of dpkg -L (require package dlocate)
dlocate <file> # ... same as dpkg -L -S combined but much faster (require package dlocate)
apt-cache search <keyword> # Search package cache (package name and description) for given <keyword>
apt-cache search <keyword> # Search package cache (package name and description) for given <keyword>
</source>
</source>


To add a repository:
To add a repository, edit file <tt>/etc/apt/sources.list</tt> ou <tt>sources.list.d/</tt>, then <tt>apt-get update</tt>.
* edit file <tt>/etc/apt/sources.list</tt> ou <tt>sources.list.d/</tt>, then <tt>apt-get update</tt>.

To add a package authentication key:
<source lang="bash">
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
</source>


== RPM's ==
== RPM's ==

Revision as of 11:10, 10 October 2009

Ubuntu / Debian

Adding / removing / querying packages:

dpkg -i <package>                                     # Install a package from local file
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 <keyword>                                  # ... 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)
apt-cache search <keyword>                            # Search package cache (package name and description) for given <keyword>

To add a repository:

  • edit file /etc/apt/sources.list ou sources.list.d/, then 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 -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