====== Managing Packages ======
Useful information about managing packages can be found [[http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/info.html.en|in the Source Forge newbie documentation]].
Here are a few commands that might come handy whenever you seek information about [installed] packages on your system:
==== Updating package list from sources ====
One thing you always need to do before working with packages on your system, is **make sure your package list is up-to-date**, this is achieved by using this command:
sudo apt-get update
This will simply update your package list information, it won't install or modify anything further, so it is safe to run anytime.
==== Search the package descriptions you've downloaded ====
apt-cache only knows about the **package descriptions you've already downloaded**, to search among **ALL** known Debian packages you need to browse to [[http://packages.debian.org/]] to see what's available.
Example: getting information about php
sudo apt-cache search php5
==== Get more information about a package ====
To display what a package is designed to do, use:
apt-cache show php5-dev
==== Get versionning information ====
apt-cache policy
==== List all installed packages ====
To show **what packages are installed** on your system, and know if they need configuration use:
sudo dpkg -l
You can limit the output using grep:
sudo dpkg -l | grep php
**NOTE** dpkg -l can be use with the \* or '*' argument to also list uninstalled packages:
sudo dpkg -l \*
sudo dpkg -l \*php\*
This is equivalent to:
sudo dpkg -l '*'
sudo dpkg -l '*php*'
This will let you know what packages are installed (ii), uninstalled (un) or are marked to be purged (pn).
==== Find what package a specific file does come from ====
Here's how to find which package contains/supplies a certain file:
sudo dpkg -S postmaster
sudo dpkg -S 'doc/*sql' | cut -f1 -d: | sort -u
==== Removing an Installed Package ====
To completely remove an already installed package:
> apt-get --purge remove
===== Adding a Repo(sitory) to Your Sources =====
==== Package Repositories ====
Debian and Debian based distributions (Linspire, Xandros, Ubuntu, and Mepis to name a few) use a tool called APT (Advanced Packaging Tool) to manage all software on the system. The term "package" refers to an individual file with a .deb extension that contains either all or part of an application.
APT checks to ensure that all necessary packages are available prior to installing a program and also prevents the accidental deletion of a package if another program is dependent upon it. All available software is stored in a repository. Most of these are online.
Linux Mint Debian Edition comes with some default repositories that are already setup, but these contain only a portion of the freely available software out there waiting for you.
==== Choosing a Mirror ====
TO BE COMPLETED
==== /etc/apt/sources.list ====
The// /etc/apt/sources.list/// file contains the details for each available software repository. This file can either be edited manually or it can be modified by using a graphical manager. Examples for both are provided below. All entries in the sources.list file follow a format with 4 distinct regions: package type, web address (URL), distribution, and section(s). One or more sections can be included.
deb http://host/debian distribution section1 section2 section3
deb-src http://host/debian distribution section1 section2 section3
deb http://http.us.debian.org/debian stable main contrib non-free
deb-src http://http.us.debian.org/debian stable main
==== /etc/apt/sources.list.d ====
In case you do not want to "pollute" your sources.list file with third-parties repos, you can also create a new file in the// etc/apt/sources.list.d// repository. Creating a file with a .list extension and adding the repo's reference there will also add it to your sources list:
sudo nano /etc/apt/sources.list.d/new-repo.list
-----
deb http://download.myrepo.org/repository/debian wheezy contrib non-free
deb-src http://download.myrepo.org/repository/debian wheezy contrib non-free
-----
CTRL-x > Y (exit nano and save file)
==== Source Packages ====
Not all repos provide source packages, if a repo only provides .deb packages, omit the second line (deb-src) when adding the repo to your sources. Otherwise, apt-get update will stop with an error of type:
Failed to fetch http://download.myrepo.org/repository/debian/dists/wheezy/InRelease
Unable to find expected entry 'contrib/source/Sources' in Release file (Wrong sources.list entry or malformed file)
==== Signing Keys ====
Most of the "serious" complementary repositories, will require you to install a signing key to allow secured identification of the repositories. This is done through first downloading the key provided by the repo, then issuing a command of type:
sudo apt-key add secure_key.asc
Or you could combine downloading the key and registering it:
wget -q http://download.myrepo.org/repo/secure_key.asc -O- | sudo apt-key add -
==== All-in-one Operation ====
This is mostly for Ubuntu's ppa and doesn't quite often works for LMDE.
It allows to use the add-apt-repository command that will append the repository to /etc/apt/sources.list and add the repository key to the machine:
sudo add-apt-repository deb http://download.myrepo.org/repository/debian wheezy contrib
The add-apt-repository is in the python-software-properties package:
sudo apt-get install python-software-properties
===== Package / Software Managers =====
TO BE COMPLETED