Package Installation
01
Debian / Ubuntu: APT
Update the package list
bash
apt update
Install a package
bash
apt install package-name
# Multiple packages together
apt install nginx curl wget git unzip
Update all packages
bash
apt upgrade -y
# Full upgrade (includes kernel and changed dependencies)
apt full-upgrade -y
Remove a package
bash
apt remove package-name
# Also remove configuration files
apt purge package-name
# Remove packages that are no longer needed
apt autoremove -y
Search for a package
bash
apt search keyword
02
CentOS / AlmaLinux / Rocky Linux: DNF
Install a package
bash
dnf install package-name -y
Update all packages
bash
dnf update -y
Remove a package
bash
dnf remove package-name
Search for a package
bash
dnf search keyword
03
Useful commands
Find which package provides a command
bash
# Debian/Ubuntu
dpkg -S $(which command)
# CentOS
dnf provides command
See installed packages
bash
# Debian/Ubuntu
dpkg -l | grep name
# CentOS
rpm -qa | grep name
04
Software not in official repositories
For software that is not in standard repositories, you often use:
Snap:
bash
apt install snapd
snap install package-name
Flatpak (less common on servers):
bash
apt install flatpak
From source or script:
bash
# Example: installing Node.js via official script
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
Before executing scripts from the internet with curl | bash, always verify that the source is official and trustworthy.
Related articles
Software
Web Server: Nginx
Installation and basic configuration of Nginx on your server
2 min read
Software
Web Server: Apache
Installation and basic configuration of Apache on your server
2 min read
Software
Nginx as Reverse Proxy
How to configure Nginx to act as a reverse proxy towards Node.js, Python, and other services
3 min read
