apt vs aptitude little tutorial


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users apt vs aptitude little tutorial
# 1  
Old 08-15-2009
apt vs aptitude little tutorial

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 this will clear some misundersands about it, maybe somewher i will be wrong or somebody could explain it better so any comments are welcomed.
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 Smilie

REFERENCES:
list packages - LinuxQuestions.org
Tutorial Introduction to Aptitude
Debian Linux apt-get package management cheat sheet
aptitude
Search Term Reference
Debian User Forums &bull; View topic - apt-get -f install vs. aptitude -f install
Search Term Reference
# 2  
Old 08-16-2009
Please go through you post and correct as many typing mistakes as possible (there are at least 30). It makes the post extraordinarily difficult to read.

Quote:
Similar situation is in packages one package can be usesd with another, and that is depenndency.
Maybe you mean?:

Quote:
Where one package relies on another, that is a dependency.
Perhaps number the paragraphs so that people can respond to specific questions within this thesis.
Where you have an actual command line that you have typed at a command prompt and pasted into the post, please mark the command line with "code tags".

This line for example is rather difficult to follow unless we can split the code from the dialogue:

Quote:
What is dpkg --get-selections > bak; dpkg --set-selections < bak; (just another format for dpkg -l) ?
Did you mean:?
Is
Code:
dpkg --get-selections > bak; dpkg --set-selections < bak

just another format for
Code:
dpkg -l



Please state what failed? e.g. Did you receive any error messages from:

Code:
dpkg --remove packagename


On a pedantic note:
Quote:
Lets celar some terms:

Let's clarify some terms:
OMG I'm turning into an English tutor.

Last edited by methyl; 08-16-2009 at 02:54 PM.. Reason: more typos than the original post !
# 3  
Old 08-16-2009
Quote:
Originally Posted by methyl
OMG I'm turning into an English tutor.
Only if you fix this:
Quote:
Dis you mean:?
# 4  
Old 08-16-2009
Yep I fixdit

(For those who stumble upon this post I am of the opinion that this task was not set by an employer and that a bit of layout, a spell check, and some examples of commands and system responses will get the marks).

Last edited by methyl; 08-16-2009 at 03:17 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series: ... (0 Replies)
Discussion started by: Neo
0 Replies

2. UNIX for Beginners Questions & Answers

Apt-get

Want to install APACHE but it's saying command is not found using centos (4 Replies)
Discussion started by: zbest1966
4 Replies

3. UNIX for Dummies Questions & Answers

Apt-get install --purge

Hello, i would like to know what is the use of that command apt-get install --purgeI understand the use of --purge while using with remove parameter, but i don't get it when it's about installing. Enlight me please ! Thx ---------- Post updated 09-03-16 at 11:35 AM ---------- Previous... (0 Replies)
Discussion started by: Purgator
0 Replies

4. Red Hat

Yum and apt-get

I know both yum and apt-get could update the package , could advise which one is better in Redhat server ? thanks Login ID ust3 is currently in read-only mode for multiple infractions. Creating new identities to avoid restrictions is not allowed. This thread is closed. (1 Reply)
Discussion started by: ust03
1 Replies

5. Ubuntu

Aptitude removes all packages

Hi Team, Please find below error. I got this after i done something in aptitude. Actually i was trying to update all packages, but unfortunately I removed all packages. Now my server is down. When i boot it gives me me errors of missing .so files. Is there any way to repair my server... (2 Replies)
Discussion started by: paragnehete
2 Replies

6. Debian

apt-get error

Hello when i am giving a command apt-get install I am getting error as below: " apt-get: error while loading shared libraries: libapt-pkg-libc6.3-6.so.3.11: cannot open shared object file: No such file or directory " can u suggest what to do. step by step. (3 Replies)
Discussion started by: pradeepreddy
3 Replies

7. UNIX for Advanced & Expert Users

apt-get install error

Hello when i am giving a command apt-get install I am getting error as below: " apt-get: error while loading shared libraries: libapt-pkg-libc6.3-6.so.3.11: cannot open shared object file: No such file or directory " can u suggest what to do. https://www.unix.com/images/misc/progress.gif... (1 Reply)
Discussion started by: pradeepreddy
1 Replies

8. UNIX for Dummies Questions & Answers

Apt-get install

When I use apt-get install command, for example samba install, does that command then invokes search of entire disk to find samba packet or what? (1 Reply)
Discussion started by: salvor_hardin
1 Replies

9. Linux

apt-get craziness.....

I had mysql client installed, then I upgraded my version of perl using apt-get install. Now, I want to get mysql-client working again and when I try to install it, I get: /usr/bin# apt-get install mysql-client Sorry, but the following packages have unmet dependencies: mysql-client: Depends:... (2 Replies)
Discussion started by: natter
2 Replies

10. UNIX for Advanced & Expert Users

Debian aptitude - apt-get problem

I've got a strange one. As root, in aptitude, I'll do an update successfully. Then I do an upgrade, the files download, the progress bar will not show total progress, just progress per file, then reset to 0% for the next file. When the files complete downloading, I hit a carrige return to go to... (1 Reply)
Discussion started by: mikek147
1 Replies
Login or Register to Ask a Question