aptitude is a great alternative to apt-get and the best way to install, remove, upgrade, and otherwise administer packages on you system with apt. aptitude solves orphaned dependencies and has a curses interface that blows the doors off of dselect. Finally, and most importantly, it takes advantage of one tool, doing many many operations:
| Syntax | Description |
|---|---|
| aptitude | Running it with no arguments brings up a curses based interface to search, navigate, install, update and otherwise administer packages |
| aptitude install | Installing software for your system, installing needed dependencies as well |
| aptitude -d install | Download packages to the package cache as necessary, but do not install or remove anything. |
| aptitude remove | Removing packages as well as orphaned dependencies |
| aptitude purge | Removing packages and orphaned dependencies as well as any configuration files left behind |
| aptitude search | Search for packages in the local apt package lists |
| aptitude update | Update the local packages lists |
| aptitude upgrade | Upgrade any installed packages that have been updated |
| aptitude clean | Delete any downloaded files necessary for installing the software on your system |
| aptitude dist-upgrade | Upgrade packages, even if it means uninstalling certain packages |
| aptitude show | Show details about a package name |
| aptitude autoclean | Delete only out-of-date packages, but keep current ones |
| aptitude hold | Fix a package at it’s current version, and don’t update it |
aptitude uses many of the same commands as apt-get. It is not a good idea to use both, you should either use aptitude or apt-get exclusively, or your dependencies might get confused.
Tags: aptitude, cheatsheet, Debian, Ubuntu
Posted by Hans-Henry Jakobsen
apt-get is a command-line package handling utility while aptitude is a high-level interface to the package manager. There isn’t much difference between the two except aptitude will remove unused package dependencies automatically whereas with apt-get you have to do it manually. Neither removes dependencies as that would cause problems. Dependencies are packages that are depended on by other packages. You don’t want to remove them.
To remove unused packages with apt-get use
sudo apt-get autoremove
With aptitude there is nothing to do as it’s automatic.
Tags: apt-get, aptitude, Debian, Ubuntu
Posted by Hans-Henry Jakobsen
| Syntax | Description | Example |
|---|---|---|
| dpkg -i {.deb package} | Install the package | dpkg -i zip_2.31-3_i386.deb |
| dpkg -i {.deb package} | Upgrade package if it is installed else install a fresh copy of package | dpkg -i zip_2.31-3_i386.deb |
| dpkg -R {Directory-name} | Install all packages recursively from directory | dpkg -R /tmp/downloads |
| dpkg -r {package} | Remove/Delete an installed package except configuration files | dpkg -r zip |
| dpkg -P {package} | Remove/Delete everything including configuration files | dpkg -P apache-perl |
| dpkg -l | List all installed packages, along with package version and short description | dpkg -l dokg -l | less dpkg -l ‘*apache*’ dpkg -l | grep -i ‘sudo’ |
| dpkg -l {package} | List individual installed packages, along with package version and short description | dpkg -l apache-perl |
| dpkg -L {package} | Find out files are provided by the installed package i.e. list where files were installed | dpkg -L apache-perl dpkg -L perl |
| dpkg -c {.Deb package} | List files provided (or owned) by the package i.e. List all files inside debian .deb package file, very useful to find where files would be installed | dpkg -c dc_1.06-19_i386.deb |
| dpkg -S {/path/to/file} | Find what package owns the file i.e. find out what package does file belong | dpkg -S /bin/netstat dpkg -S /sbin/ippool |
| dpkg -p {package} | Display details about package package group, version, maintainer, Architecture, display depends packages, description etc | dpkg -p lsof |
| dpkg -s {package} | grep Status | Find out if Debian package is installed or not (status) | dpkg -s lsof | grep Status |
{package} – Replace with actual package name
Tags: cheatsheet, Debian, dpkg, Ubuntu
Posted by Hans-Henry Jakobsen
The last time I installed Debian Etch i closed both port 111 and 113 but since I’ve forgot it already and a new installation is in progress, this post should remind me how to do it in the future. The code view below shows the ports nmap found were in a open state
PORT STATE SERVICE 111/tcp open rpcbind 113/tcp open auth
Port 113/auth can be closed by commenting out the ident line in the /etc/inetd.conf
#ident stream tcp wait identd /usr/sbin/identd identd
Port 111 is the portmap daemon and can be configured to only listen on the loopback interface
dpkg-reconfigure portmap
This command modifies the /etc/default/portmap file and adds/uncomments the line
OPTIONS="-i 127.0.0.1"
Tags: auth, Debian, dpkg-reconfigure, portmap, rpcbind
Posted by Hans-Henry Jakobsen
I’m running Debian Etch because I prefer the stable Debian package tree. This is all great but the software is a little outdated compared to other distributions like Ubuntu. That is where backports come in. Backports are recompiled packages from testing (mostly) and unstable (in a few cases only, e.g. security updates), so they will run without new libraries (wherever it is possible) on a stable Debian distribution. They recommend you to pick out single backports which fits your needs, and not to use all backports available here.
Using backports is simple
deb http://www.backports.org/debian etch-backports main contrib non-free
apt-get update
You might get a error message
Reading package lists... Done W: GPG error: http://www.backports.org etch-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EA8E8B2116BA136C W: You may want to run apt-get update to correct these problems
This message comes on Debian Etch because you haven’t imported the backports keyring. It’s easily fixed by running the command
apt-get install debian-backports-keyring
apt-get -t etch-backports install nmap
It is important to remember that if you forget to tell apt-get that nmap is installed from backports and run another apt-get install nmap it will remove my backports package.
A simple solution to this is to use pinning
Edit /etc/apt/preferences, the file has to be created if you haven’t used pinning before
Package: nmap Pin: release a=etch-backports Pin-Priority: 999
Now the system “remembers” that nmap is installed from the backports repository and you don’t have to worry about it anymore, nice.
Source: http://www.backports.org/
Tags: apt-get, backports, Debian, Etch
Posted by Hans-Henry Jakobsen