Results 1 to 2 of 2
Hi all I dont know if this is right place but I saw somewhere dd tutorial so I decidet to write a little tutorial about debian package manager. I hope ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-15-2009 #1
- Join Date
- Jul 2009
apt vs aptitude little tutorial
Many users in ubuntu/debian use just apt-get install packagename but dont know that package commands can do a much more.
First off all must say that debian/ubuntu use more package managers apt-*, aptitude, GUI add/remove, synaptic ... Is good habit to choose one of them, apt-get or aptitude. Aptitude and apt-get use different kind of treating package dependencies (will be discused later). Ubuntu GUI applications are just wrappers on apt-get NOT aptitude.
Lets celar some terms:
Package: It is a special kind of archive which contains data (binary - desired software, source code, configuration files...)
Repository: In ubuntu/debian world packages stored on internet are organized in repositories. Repository is simply a database of packages that can be downloaded and installed from internet.
Database: Every package managers (apt-*, aptitude) use its own database for storing informations about installed, purged (removed) packages. This is because you should choose one package manager (apt-* or aptitude) so your database will be consistent.
Dependencies: In linux world one aplication can be used by other aplication, for example alsa (sound card utility) is used also with mplayer (movie player) which must play sound in movies and totem (music player) for playing music.
Similar situation is in packages one package can be usesd with another, and that is depenndency.
There are two dependencies:
Reverse Dependencies: are those packages which are dependent on our package (our package must be installed when we want install one of those packages)
Classical dependencies: are those packages which on are our package depend (those packages must be installed when we want install our package)
For example lets say we have package firefox
Reverse Dependencies are firefox plugins, themes ...
Classical Dependencies are those packages which firefox need to run.
I think only way that aptitude differ from apt- is that aptitude stores in his package database markauto and unmarkauto information.
Unmarkaouto are those packages that user installed himself. Markauto are those which were installed autimaticaly causing dependencies.
There is also dpkg command which I mostly use to manage *.deb packages. Note that all package commands require sudo privileges.
We can divide managing packages by localization of packages into these 3 sections:
manage installed packages
manage non installed (from internet) packages
manage non installed (*.deb) packages
MANAGE INSTALLED PACKAGES:
Q: how to find from which package is ls command
A: dpkg -S /bin/dd; OR dpkg -S `which ls`;
Q: How to find all packages in system ?
A: dpkg -l \*; show more packages not just installed, the lines begin with
ii - installed, rc - reconfigured, pi - pre installation finished, un - uninstalled, pn, d. I must say that i google somewhere and man dpkg did not gives me
the infomration about that , so if somebody know more about it comments are welcomed. so command: dpkg -l; shows all installed packages (those which begin with ii).
Also you can use command: aptitude search '~i'; which output: i - packages installed by user and A - automaticaly installed packages for dependencies.
Q: What version of package i have installed ?
A: dpkg -s packagename | grep Version
Q: How to find all files from installed package
A: dpkg -L packagename
Q: How to remove installed package?
A: There are more posibilities: apt-get remove packagename; OR dpkg --remove packagename (BUT THIS LAS ONE DID NOT WORK FOR ME). This command removes package and keep configuration files
if you want remove also configuration files try this: apt-get --purge remove packagename OR aptitude remove packagename. In this way aptitude and apt differs, if you remove package with aptitude it automaticaly remove dependencies
with apt you must specify it explicitly. I dont know if is possible to preserve dependencies with aptitude, so if somebody please comment.
Q: how to upgrade to newest version of instaleld package ?
A: apt-get upgrade packagename OR aptitude upgrade packagename.
Q: where are stored logs for aptitude and dpkg ?
A: /var/log/aptitude, /var/log/dpkg.log. If i am right apt did not have log.
MANAGE NON INSTALLED (INTERNET REPOSITORY) PACKAGES:
Q: how to tell aptitude and apt-get which repository to use ?
A: that can be done editing /etc/apt/sources.list after this you must issue command: apt-get update; OR aptitude update; which synchronize informations (packages names, size, versions...) from internet repositories with our database managed by apt OR aptitude.
Q: how to find packagename ?
A: apt-cache search -n sniffer; will indd those packages which contains in his name word sniffer. command: apt-cache search sniffer; will find those which have sniffer in name OR description.
Q: how to find version, dependencies, size, installed size and some other info about package avalible in repository?
A: apt-cache search -nf packagename OR apt-cache show packagename. I dont know about aptitude equivalent so if you please comment.
Q: how to find dependencies in repository package (very similar to previous command but list only dependencies)
A: apt-cache showpkg packagename OR aptitude show packagename
Q: How to install pacakge from repositories
A: apt-get install packagename OR aptitude install packagename if you want just simulate installation apt-get -s install packagename OR aptitude -s install packagename
Q: how to download package from repositories
A: apt-get -d install packagename OR aptitude -d install packagename. *.deb package will by stored in /var/cache/apt/archives
Q: how to install package which need dependencies ?
A: This is very magican command, if you cannot install something try this first: apt-get -f install OR aptitude -f install. It should repair dependencies problems and you could install package which need other packages.
Q: how to list all packages avalible in repo ?
A: apt-cache pkgnames; OR apt-cache search .; (dot included) OR apt-get install (tab, tab). I dont know exactly which is correct.
MANAGE NON INSTALLED (*.deb) PACKAGES:
Q: where are stored *.deb archives after i issue apt-get install packagename; OR aptitude install packagename;
A: they are strored in /var/cache/apt/archives/ you can delete them by usinh classic method rm OR issuing commands: apt-get clean; OR aptitude clean;
Q: how can i install *.deb package(s) stored in hard disk?
A: dpkg -i packagename; OR if you want install multiple packages: dpkg -R /directory/name;
Q: how to display contents of *.deb ?
A: dpkg -c packagename.deb OR dpkg-deb -c packagename.deb display content in ls -l format.
Q: how to display dependencies, size, installed size, description.... of *.deb archive ?
A: dpkg-deb -I packagename.deb OR dpkg -I packagename.deb
So if i compare apt vs aptitude:
aptitude automaticaly purge configuration files if package is uninstalled, apt- must use --purge option unless it preserve configuration files.
aptitude use markauto and unmarkauto information about package.
apt-get (NOT aptitude) is used by GUI based aplications in ubuntu. (if you use them you should use apt NOT aptitude)
aptitude stores logs in /var/log/aptitude apt not.
aptitude IS NOT front end of apt-
apt IS NOT front end of aptitude
You should use one apt or aptitude NOT BOTH.
My personal questions to gurus:
What is dpkg --get-selections > bak; dpkg --set-selections < bak; (just another format for dpkg -l) ?
which commands do you mostly use ?
Which to use list all repositories packages. apt-cache pkgnames; OR apt-cache search .; (dot included) OR apt-get install (tab, tab);
what is aptitude equivalent for apt-cache search -nf packagename OR apt-cache show packagename.
What is and why did not work for me: dpkg --remove packagename
what is dpkg --remove packagename ? IT DID NOT WORK FOR ME
I hope this would be useful for somebody who use aptitude or apt and want to try other. If you read to the end congratulations
- 04-13-2013 #2
wakatana... Nice to read that... Maybe you could take a few minutes to explain how the 'sources.list' file operates and how or if you can wire the dvd lines in it so aptitude could read those from a local hard drive. It would sure beat dealing with DVD's all the time. It's easy to give up 15 GB on a 100 TB drive to not have to deal with DVD's! I'm also at a loss to find packages that it says are there but I can't find. One such entry is the 'multistrap' package. We use it to build cross platform images. If I go to install it, it says that's it's available and I should take if off the server, but I can't find where the package is on the server!
These types of complaints are why many choose to use both, one doesn't some things the other does, so they use the one, show in the instructions on how to build the image, which is usually apt-* rather than aptitude.