Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.
Crunchbang's recent releases are based on Debian. Every application or component comes as a package and is then installed on your system.
The application set which installs the packages on your system is called APT (Advanced Package Tool). It consists of different tools which are briefly introduced on this page.
Packages are saved on a server and downloaded by the administrator. To synchronize the local database with the database on the server, use:
sudo apt-get update
If package versions have changed between the synchronization intervals, you can bring the locally installed packages up-to-date with:
sudo apt-get dist-upgrade
To install a package from the repositories, use:
sudo apt-get install PACKAGENAME
To remove packages without their corresponding configuration files:
sudo apt-get remove PACKAGENAME
You can remove a package including their configuration files completely using:
sudo apt-get purge PACKAGENAME
To clean up the downloaded packages that are no longer available in the repositories:
sudo apt-get autoclean
To remove all packages from the package cache use clean (not recommended if you have a slow network connection):
sudo apt-get clean
To remove packages that were installed by other packages and are no longer needed:
sudo apt-get autoremove
If your dist-upgrade or install of a new package stops unexpectedly, try to fix the installation:
sudo apt-get -f install
Optional: Install apt-listbugs to be informed if packages to be downloaded and installed are reported to have a bug:
sudo apt-get install apt-listbugs
You can check for broken dependencies with the check option:
sudo apt-get check
If you see an error message like
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
it means you tried to perform operations as normal user - simply put sudo in front of your command.
Debian's repositories contain over 25'000 packages. If you want to install - for example - a lightweight editor like Notepad, and you do not know the package name, you can use apt-cache to search the database.
apt-cache search notepad
will show something like
basket-data - data files for BasKet Notepads
jscribble - graphical notepad for use with a pen tablet
kephra - gui text editor along Perl alike Paradigms
leafpad - GTK+ based simple text editor
You can install the desired application (let's choose leafpad) with the command
apt-get install leafpad
To find out which version of a package is installed or available in the repositories, you can use:
apt-cache policy PACKAGENAME
This is especially helpful if you have a mixed sources.list
The file sources.list is found in the location /etc/apt/sources.list and contains the repositories which apt gets the database and installs packages from. Do not change this file if not necessary. Version mismatches can make your system impossible to upgrade. Though not recommended, there are certain applications that are not available in Debians repositories (like Skype) or outdated (like Virtualbox or Wine) may require you to add third-party repositories. If you do so, refer to the corresponding installation guides to prevent problems.
To edit this file you need to be root.
sudo nano /etc/apt/sources.list
Do not mix stable, testing and unstable (Squeeze, Wheezy, Sid) repositories. Backports are acceptable if they have a lower priority in apt's preferences.
Another way of installing .deb packages that are not in the repositories is by using dpkg.
sudo dpkg -i /path/to/package.deb
installs the package.deb but does not resolve dependencies. You can use a tool like gdebi to automatically resolve them. Make sure gdebi is installed:
sudo apt-get install gdebi
In your file manager you can now double-click on the downloaded .deb file and open it with gdebi.
A word of warning: externally packaged binaries can lead to problems and make your system go Crunch! BANG!
Removing previously installed .deb packages can be performed using
sudo dpkg -r /path/to/package.deb
Some packages might be buggy and broken in the Debian repositories. If you want to prevent a package from upgrading:
echo "PACKAGENAME hold" | sudo dpkg --set-selections
Release this lock when the package is repaired upstream, using:
echo "PACKAGENAME install" | sudo dpkg --set-selections
Similar to apt-cache search is
dpkg -l *SEARCH_TERM*
It shows you a list of findings (ii stands for installed, un for not installed)