Article Background
Back to Knowledgebase

How to Install, Update, and Remove Software on Ubuntu Using APT

VPS
Cubes Support
July 20, 2026

APT (Advanced Package Tool) is the default package management system used by Ubuntu and Debian Linux distributions. It automates searching for, downloading, installing, updating, and removing software packages from official repositories.

Whether you are setting up web servers, installing developer runtimes (Node.js, Python, Java), or maintaining system security, mastering APT commands is fundamental to managing your Cubes Hosting Linux VPS.

This guide covers all essential APT commands for installing, upgrading, searching, and cleaning up software on Ubuntu.


Step 1: Updating Package Lists (apt update)

Before installing or upgrading software, always update your local package database so APT knows the latest software versions available:

sudo apt update

(This command connects to Ubuntu repositories and downloads the latest list of available software packages. It does not modify installed programs).


Step 2: Upgrading Installed Software (apt upgrade)

To upgrade all installed programs and security patches on your server to their latest versions:

sudo apt upgrade -y

Full System Upgrade (apt full-upgrade):

When major kernel updates or package dependency changes occur, use full-upgrade to allow APT to handle complex dependency updates:

sudo apt full-upgrade -y

If you don't know the exact name of a package:

1. Search for a Package:

apt search nginx

2. View Package Information & Details:

To view package description, version, size, and maintainer details:

apt show nginx

Step 4: Installing Software Packages (apt install)

To install one or more software packages on your VPS:

# Install a single package
sudo apt install -y nginx

# Install multiple packages simultaneously
sudo apt install -y git curl htop screen unzip

(The -y flag automatically answers "yes" to confirmation prompts).

Reinstalling a Corrupted Package:

If a program is misbehaving or missing files, force a clean reinstall:

sudo apt install --reinstall nginx

Step 5: Removing and Uninstalling Software (remove vs purge)

When you no longer need a program, APT offers two ways to remove it:

Option A: apt remove (Keeps Configuration Files)

Uninstalls the software binaries but preserves configuration files in /etc/ in case you reinstall the software later:

sudo apt remove nginx

Option B: apt purge (Deletes Everything)

Completely removes the software binaries AND deletes all configuration files:

sudo apt purge nginx

Step 6: System Cleanup (autoremove & clean)

Over time, installing and removing software can leave behind orphaned dependencies and cached installer files that consume disk space.

1. Remove Unused Dependencies (autoremove):

Removes packages that were automatically installed to satisfy dependencies for other programs, but are no longer needed:

sudo apt autoremove -y

2. Clear Cached Package Downloads (clean):

Clears cached .deb installer files stored in /var/cache/apt/archives/ to reclaim disk space:

sudo apt clean

APT Commands Quick Reference Cheat Sheet

TaskCommand
Update Package Listsudo apt update
Upgrade All Softwaresudo apt upgrade -y
Search Packagesapt search <keyword>
Show Package Detailsapt show <package_name>
Install Packagesudo apt install -y <package_name>
Remove Software (Keep Configs)sudo apt remove <package_name>
Purge Software (Delete Configs)sudo apt purge <package_name>
Clean Orphaned Dependenciessudo apt autoremove -y
Clear Package Cachesudo apt clean

Conclusion

Managing software with APT is fast, automated, and secure. Run sudo apt update && sudo apt upgrade -y regularly to keep your Cubes Hosting Ubuntu VPS updated with the latest performance and security patches!

Special Offer

Ready to Start Your Server?

Get 10% OFF your first month on any server with promo code CUBES10 at checkout!

24/7 Assistance

Need Help With Your Server?

Already a Cubes Hosting customer and couldn't find your answer? Our dedicated support team is available 24/7.