USD ($)
$
United States Dollar
Euro Member Countries
India Rupee
د.إ
United Arab Emirates dirham
ر.س
Saudi Arabia Riyal

Installing and Updating Software with APT

Lesson 22/49 | Study Time: 20 Min

APT (Advanced Package Tool) is a powerful and user-friendly command-line package management system widely used in Debian-based Linux distributions such as Ubuntu, Linux Mint, and Kali Linux.

It automates the process of installing, updating, and managing software packages from online repositories, ensuring users can access the latest, most secure, and compatible versions with ease. 

Updating Package Information with apt update

Before installing or upgrading software, it is essential to synchronize local package databases with the latest information from software repositories. This ensures your system knows about all available updates and new packages.


Basic command:

text
sudo apt update


When executed, APT fetches the latest package lists from the URLs configured in /etc/apt/sources.list and other source files. This command does not upgrade any installed packages; it only refreshes metadata such as package versions and dependencies.


Output includes a summary of packages that can be upgraded.

Upgrading Installed Packages with apt upgrade

After updating package lists, apt upgrade installs the newest versions of all currently installed packages without removing anything.


Command:

text
sudo apt upgrade


apt upgrade compares currently installed package versions with those available in updated repositories and prompts for confirmation before proceeding. It only upgrades packages that can be updated without uninstalling or adding new dependencies.


To upgrade a specific package:

text
sudo apt upgrade package_name


Use the -y flag for automatic yes to prompts:

text
sudo apt upgrade -y

Full System Upgrade with apt full-upgrade

The full-upgrade command is more aggressive and can remove or install packages to resolve complex dependency changes.


Command:

text
sudo apt full-upgrade


Useful for major system upgrades, such as between distribution releases. It should be used with caution as it may uninstall packages.

Installing New Software with apt install

To install new packages, use:

text
sudo apt install package_name

APT automatically resolves dependencies and prompts for confirmation before downloading and installing packages.


Example:

text
sudo apt install firefox


To install multiple packages in one command:

text
sudo apt install package1 package2

Additional Useful Commands

Best Practices


1. Always run sudo apt update before installing or upgrading packages to prevent installing outdated software.

2. Use apt upgrade regularly to keep packages current and secure.

3. For major upgrades or system migrations, use apt full-upgrade or carefully plan upgrades.

4. Regularly clean unused packages with apt autoremove.

5. Use apt show to verify package details before installation.

Andrew Foster

Andrew Foster

Product Designer
Profile

Class Sessions

1- What is Linux and Operating System Concepts 2- Linux History and Evolution 3- Linux Distributions and Their Purposes 4- Open Source Software and Licensing 5- Graphical User Interface (GUI) and Desktop Environments 6- Terminal Access and Command-Line Fundamentals 7- Getting Help and Command Documentation 8- File System Hierarchy and Directory Structure 9- Navigating Directories and Listing Contents 10- Creating, Copying, and Moving Files and Directories 11- Deleting Files and Directories 12- Symbolic and Hard Links 13- Understanding File Permissions Model 14- Modifying Permissions and Ownership 15- User and Group Management 16- Sudo and Privilege Escalation 17- Text Searching and Pattern Matching 18- Text Processing and Stream Editing 19- Compressing and Archiving Files 20- Text Editing and File Creation 21- Package Management Systems Overview 22- Installing and Updating Software with APT 23- Installing and Updating Software with YUM/DNF 24- Managing Software from Non-Repository Sources 25- Understanding Processes and Process Management 26- Viewing Running Processes 27- Process Control and Termination 28- Task Scheduling with Cron 29- Networking Concepts and IP Addressing 30- Viewing and Configuring Network Interfaces 31- Basic Network Troubleshooting 32- Shell Script Basics 33- Variables and Data Types 34- Conditional Logic in Scripts 35- Loops and Iteration 36- Functions and Code Reuse 37- Input/Output and User Interaction 38- System Authentication and Access Control 39- File System Security 40- Software Updates and Patching 41- Basic Firewall Concepts 42- System Information and Monitoring 43- Service and Daemon Management 44- System Boot Process and Runlevels 45- System Backup and Disaster Recovery 46- Comprehensive File System Management 47- System Automation Workflows 48- Multi-Concept Troubleshooting Scenarios 49- Continued Learning Pathways