IL PACKAGE MANAGER APT and Aptitude

Aptitude

- Su debian lanciare aptitude(che apre una modalità semigrafica)
- premere F10 che apre un menù che sta in alto
- il primo comando a sinistra aggiorna la source list
- poi fare newpackage per installare un nuovo pacchetto
- per cercare il pacchetto da installare si può usare /nome e appariranno tutti i pacchetti che corrispondono

Commands line

I prefer command line take some info from this guide http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch01s02.html

Per conoscere i pacchetti installati

aptitude search fuse | grep ^i
i   fuse                            - Filesystem in Userspace                   
i A fuse-utils                      - Filesystem in Userspace (transitional pack
i   gvfs-fuse                       - userspace virtual filesystem - fuse server
i   libfuse-dev                     - Filesystem in Userspace (development)     
i   libfuse2                        - Filesystem in Userspace (library)

grep ^i da gli installati

significato:
Each search result is listed on a separate line.
The first character of each line indicates the current state of the package:

  • p, meaning that no trace of the package exists on the system
  • c, meaning that the package was deleted but its configuration files remain on the system
  • i, meaning that the package is installed
  • v, meaning that the package is virtual.

The second character indicates the stored action (if any; otherwise a blank space is displayed) to be performed on the package, with the most common actions being

  • i, meaning that the package will be installed,
  • d, meaning that the package will be deleted
  • p, meaning that the package and its configuration files will be removed.

If the third character is A, the package was automatically installed.

update repository

aptitude update

updates the package lists

upgrade safe

aptitude safe-upgrade

This command will upgrade as many packages as it can upgrade without removing existing packages.

aggressive upgrade

it will install and remove packages until all dependencies are satisfied

aptitude full-upgrade

before called dist-upgrade, still works with the old name

install remove purge

aptitude [ install | remove | purge ] pkg1 [pkg2...]

“Installing” a package which is already installed but can be upgraded will cause it to be upgraded

search

aptitude search pattern1 [pattern2...]

searches for packages whose name contains any of the given patterns, printing the result to the terminal.

show info

aptitude show pkg1 [pkg2...]

print info of the pkgs

other info

when you arrive in this point

Need to get 3200kB of archives. After unpacking 8413kB will be used.
Do you want to continue? [Y/n/?]

you can type else
  • s = how much space each package will use
  • d will display information about automatically installed or removed packages

simulate -s

install, upgrade, and remove packages all accept the parameter -s, which stands for “simulate”. When -s is passed on the command line, the program performs all the actions it would normally perform, but does not actually download or install/remove any files.

Apt:

apt-get upgrade

permette l'aggiornamento dei pacchetti installati in locale
apt-get update

invece fa l'aggiornamento delle sorgenti contenute nei file /etc/apt/sourec.list conviene sempre lanciarlo come primo comando
apt-get install nomepacchetto

per installare uno specifico pacchetto eseguire (vanno indicati i nomi di pacchetto e non quelli degli archivi che li contengono)
apt-get -f dist-upgrade

per aggiornare la distribuzione
- con il parametro check esegue un controllo sui pacchetti che sono installati in modo errato
- con il parametro clean pulisce la cartella di cache /var/cache/apt/archives
-con l'opzione -f cerca di sistemare i problemi legati alle dipendenze
-con -s simula l'esecuzione del comando per far vedere eventuali problemi
apt-cdrom

genera il file source.list dai pacchetti presenti nella distribuzione
apt-cache search nomepacchetto

per avere informazioni su un insieme di pacchetti per esempio tutta una suite, con apt-cache search nomepacchetto si hanno informazioni più dettagliate
apt-cache depends nomepacchetto

per vedere le dipendenze
apt-get remove nome-pacchetto

da rimuovere

i pacchetti che dipendono da quelli rimossi vengono anch'essi rimossi
con l'opzione —purge si rimuovono anche i file di configurazione dei pacchetti rimossi che altrimenti rimangono memorizzati

Quando si installa un pacchetto APT recupera tutti i file necessari delle sorgenti specificate in /etc/apt/sources.list, gli immagazzina in un archivio locale (/var/cache/apt/archives/) e poi procede con l'installazione.
apt-get autoclean, rimuove solo i file inutili
apt-get clean elimina qualunque cosa

INFORMAZIONI DETTAGLIATE SU UN PACCHETTO

apt-cache show nome-pacchetto

Se ci sono più pacchetti per esempio quello installato è indietro rispetto a quello disponibile vengono visualizzati entrambi e su quello installato c'è la riga

Status: install ok installed

Ecco un esempio sul php
root@linkedopendata:/etc/apache2/mods-enabled# apt-cache show libapache2-mod-php5
Package: libapache2-mod-php5
Priority: optional
Section: httpd
Installed-Size: 8288
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: amd64
Source: php5
Version: 5.3.2-1ubuntu4.15
Provides: phpapi-20090626
Depends: libbz2-1.0, libc6 (>= 2.11), libcomerr2 (>= 1.01), libdb4.8, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libpcre3 (>= 7.7), libssl0.9.8 (>= 0.9.8k-1), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4), mime-support, apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common, php5-common (= 5.3.2-1ubuntu4.15), libmagic1, ucf, tzdata
Suggests: php-pear
Conflicts: libapache2-mod-php4, libapache2-mod-php5filter
Filename: pool/main/p/php5/libapache2-mod-php5_5.3.2-1ubuntu4.15_amd64.deb
Size: 2990280
MD5sum: 3e07b9ce27b97bae3cf26d40823d2bf5
SHA1: 7d995dcfd6f892cd16f231f97ee11e04d8ead19c
SHA256: 3c8ddaddac12bb4d34db757838c4eae16507b499658a45062a0dab156119ca74
 .
 PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
 from C, Java and Perl with a couple of unique PHP-specific features thrown
 in. The goal of the language is to allow web developers to write dynamically
 generated pages quickly. This version of PHP5 was built with the Suhosin patch.
Homepage: http://www.php.net/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y
Task: lamp-server, edubuntu-server, mythbuntu-backend-master, mythbuntu-backend-master, mythbuntu-backend-slave, mythbuntu-desktop, mythbuntu-frontend

Package: libapache2-mod-php5
Status: install ok installed
Priority: optional
Section: httpd
Installed-Size: 8288
Maintainer: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Source: php5
Version: 5.3.2-1ubuntu4.7
Provides: phpapi-20090626
Depends: libbz2-1.0, libc6 (>= 2.11), libcomerr2 (>= 1.01), libdb4.8, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libpcre3 (>= 7.7), libssl0.9.8 (>= 0.9.8k-1), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4), mime-support, apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common, php5-common (= 5.3.2-1ubuntu4.7), libmagic1, ucf, tzdata
Suggests: php-pear
Conflicts: libapache2-mod-php4, libapache2-mod-php5filter
Conffiles:
 /etc/apache2/mods-available/php5.load b9feb531674e956201af17f3d83ca123
 /etc/apache2/mods-available/php5.conf 595831b79587f9307fe8e79941c3d869

Package: libapache2-mod-php5
Priority: optional
Section: web
Installed-Size: 8280
Maintainer: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: amd64
Source: php5
Version: 5.3.2-1ubuntu4
Provides: phpapi-20090626
Depends: libbz2-1.0, libc6 (>= 2.11), libcomerr2 (>= 1.01), libdb4.8, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libpcre3 (>= 7.7), libssl0.9.8 (>= 0.9.8k-1), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4), mime-support, apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common, php5-common (= 5.3.2-1ubuntu4), libmagic1, ucf, tzdata
Suggests: php-pear
Conflicts: libapache2-mod-php4, libapache2-mod-php5filter
Filename: pool/main/p/php5/libapache2-mod-php5_5.3.2-1ubuntu4_amd64.deb
Size: 2984944
MD5sum: ef4d637b5c1ce2bebd5135981ddcb899
SHA1: 69b406704802379df2863a3313e205691ee30db9
SHA256: f236bcc0a734dbe5801da3f32e086a0c97847c97bf8355a641ed505f1a5870c1
Description: server-side, HTML-embedded scripting language (Apache 2 module)

root@linkedopendata:/etc/apache2/mods-enabled#

Repository

Un bel link che spiega i repository questo

ECCO UN /et/apt/sourcelist che funziona

#deb file:///cdrom/ sarge main

#deb cdrom:[Debian GNU/Linux 3.1 r0a _Sarge_ - Official i386 Binary-4 (20050607)]/ unstable contrib main
#deb cdrom:[Debian GNU/Linux 3.1 r0a _Sarge_ - Official i386 Binary-3 (20050607)]/ unstable contrib main
#deb cdrom:[Debian GNU/Linux 3.1 r0a _Sarge_ - Official i386 Binary-2 (20050607)]/ unstable contrib main
#deb cdrom:[Debian GNU/Linux 3.1 r0a _Sarge_ - Official i386 Binary-1 (20050607)]/ unstable contrib main

# deb http://security.debian.org/ stable/updates main contrib

#deb http://ftp.students.cs.unibo.it/debian/ stable main
#deb-src http://ftp.students.cs.unibo.it/debian/ stable main

#deb http://ftp.bononia.it/debian/ stable main
#deb-src http://ftp.bononia.it/debian/ stable main

deb http://security.debian.org/ stable/updates main contrib

#deb http://ftp.bononia.it/debian/ stable main
#deb-src http://ftp.bononia.it/debian/ stable main

deb http://debian.fastweb.it/debian/ stable main
#deb-src http://debian.fastweb.it/debian/ stable main

#deb http://ftp.de.debian.org/debian sarge main
#agggiunto per installare squid

Un ottimo repository

deb http://ftp.it.debian.org/debian lenny main contrib non-free
deb http://security.debian.org lenny/updates main contrib non-free

Unstable: Debian Sid

Debian Unstable (Sid)

deb http://ftp.it.debian.org/debian/ unstable main contrib non-free
#deb-src http://ftp.it.debian.org/debian/ unstable main contrib non-free

Forzare la rimozione di un pacchetto

Sorgente http://groglogs.blogspot.it/2009/05/how-to-force-package-removal-when-apt.html

Per forzare la disinstallazione potete provare:
sudo apt-get -f remove nomepacchetto
se fallisce anche questo, magari dando questo errore (o simile):
subprocess post-removal script returned error exit status 2
Errors were encountered while processing:
nomepacchetto
E: Sub-process /usr/bin/dpkg returned an error code (1)

potete provare:
cd /var/lib/dpkg/info
ls | grep nomepacchetto
e cercate un qualche nomepacchetto.prm e cancellatelo rm nomepacchetto.prm quindi provate ancora con sudo apt-get remove package

Dopo nella directory rimane qualche file

:/var/lib/dpkg/info# ls | grep hp-health
hp-health.list
hp-health.postrm
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License