0Pricing
Linux Command Line Mastery · Lezione

Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg`

Impari a gestire i pacchetti software sui sistemi basati su Debian usando `apt` e `dpkg`.

Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg` è una lezione Linux Command Line Mastery gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Linux Command Line Mastery, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Linux Command Line Mastery include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

Intro to Package Management

Welcome to package management! On Linux, software comes in packages. These are archives containing program files, documentation, and metadata.

A package manager is a tool that automates the installation, upgrade, configuration, and removal of software. It handles dependencies, ensuring all necessary components are installed.

`dpkg`: The Core Tool

On Debian-based systems (like Ubuntu), the fundamental tool for managing packages is dpkg. It's a low-level tool that directly interacts with .deb files (Debian package files).

  • dpkg installs, removes, and manages individual .deb packages.
  • It does NOT automatically handle dependencies. If a package needs others, you must install them yourself.

Installing with `dpkg`

To install a .deb file you've downloaded, you use the -i (or --install) option with dpkg.

Remember, if the package has dependencies, dpkg will warn you and the installation might fail or be incomplete until those dependencies are met.

sudo dpkg -i /path/to/your-package.deb

Listing `dpkg` Packages

You can query dpkg to see information about installed packages. The -l (or --list) option shows all installed packages.

You can pipe its output to grep to search for specific packages.

dpkg -l | grep firefox

`apt`: The Smarter Manager

While dpkg handles individual .deb files, apt (Advanced Package Tool) is the user-friendly, high-level front-end. It works with repositories (servers holding many packages).

apt automatically handles dependencies, fetches packages from repositories, and simplifies system-wide updates.

Syncing with `apt update`

Before installing or upgrading, you should always run apt update. This command downloads the latest package information from the configured repositories.

It does NOT install new software or update existing ones, it only updates the list of what's available.

sudo apt update

Installing Apps with `apt install`

To install new software from the repositories, use apt install followed by the package name. apt will resolve and install all necessary dependencies.

You'll be prompted to confirm the installation before it proceeds.

sudo apt install htop

Upgrading Your System

To upgrade all installed packages to their latest available versions (based on your updated package lists), use apt upgrade.

This is crucial for security updates and new features. It's a good practice to run apt update before apt upgrade.

sudo apt upgrade

Removing Packages

When you no longer need a package, you can remove it using apt remove or apt purge.

  • apt remove package_name: Deletes the package but keeps its configuration files.
  • apt purge package_name: Deletes the package AND its configuration files, for a cleaner uninstall.
sudo apt remove libreoffice-writer

Package Management Quiz

You've learned about the two main package management tools on Debian-based systems. Let's test your understanding!

Summary: `apt` & `dpkg`

Great job! You've learned about Debian's powerful package management system:

  • dpkg: The low-level tool for individual .deb files, without dependency resolution.
  • apt: The high-level, user-friendly tool for managing packages from repositories, handling dependencies automatically.

Key apt commands include update, install, upgrade, remove, and purge.

Domande Frequenti

La lezione «Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg`» è gratuita?

Sì — il testo completo di «Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg`» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Linux Command Line Mastery, passa a CoddyKit PRO. Il corso Linux Command Line Mastery include 4 lezioni in totale.

Cosa imparerò in «Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg`»?

Impari a gestire i pacchetti software sui sistemi basati su Debian usando `apt` e `dpkg`. Eserciti Linux Command Line Mastery con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Linux Command Line Mastery?

Non è richiesta alcuna esperienza precedente. Linux Command Line Mastery su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.

Quanto tempo richiede la lezione «Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg`»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Linux Command Line Mastery?

Sì. Ogni lezione Linux Command Line Mastery include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Archiviazione e compressione: `tar`, `gzip`, `bzip2`
  2. Gestione dei pacchetti (Debian/Ubuntu): `apt`, `dpkg`
  3. Gestione dei pacchetti (CentOS/Fedora): `yum`, `dnf`, `rpm`
  4. Compilare dal codice sorgente: configure, make e make install
← Torna a Linux Command Line Mastery