guest@linuxthings:~/guides$ man software
Installing Software
Package management depends on your distribution. Not sure which one you run? Check cat /etc/os-release.
Debian / Ubuntu (APT)
sudo apt update # Update package list
sudo apt install pkgname # Install package
sudo apt install ./file.deb # Install a local .deb with its dependencies
sudo apt remove pkgname # Remove package
sudo apt purge pkgname # Remove package and its configuration files
sudo apt autoremove # Remove dependencies nothing needs any more
sudo apt upgrade # Upgrade all packages
sudo apt full-upgrade # Upgrade, adding or removing packages if needed
apt list --upgradable # What would be upgraded
apt search pkgname # Search for package
apt show pkgname # Details about a package
apt list --installed # Everything installed
dpkg -L pkgname # Files installed by a package
dpkg -S /usr/bin/curl # Which package owns a fileAlways run sudo apt update before installing or upgrading so APT knows about the latest versions.
Red Hat / Fedora / CentOS (DNF/YUM)
sudo dnf install pkgname # Install package
sudo dnf install ./file.rpm # Install a local .rpm with dependencies
sudo dnf upgrade # Update system
dnf check-update # List available updates
sudo dnf remove pkgname # Remove package
dnf search keyword # Search for package
dnf info pkgname # Details about a package
dnf provides /usr/bin/dig # Which package provides a file
dnf list installed # Everything installed
dnf history # Past transactions (undo with dnf history undo N)
rpm -qa # List all installed packages
rpm -ql pkgname # Files installed by a package
rpm -qf /path/to/file # Which package owns a file
rpm -ivh file.rpm # Install local .rpm fileyum is the older name for the same tool; on current systems it is an alias for dnf.
Other Package Managers
Task | Arch (pacman) | openSUSE (zypper) |
|---|---|---|
Refresh and upgrade all | sudo pacman -Syu | sudo zypper refresh && sudo zypper update |
Install | sudo pacman -S pkg | sudo zypper install pkg |
Remove | sudo pacman -R pkg | sudo zypper remove pkg |
Search | pacman -Ss term | zypper search term |
Package info | pacman -Qi pkg | zypper info pkg |
Owner of a file | pacman -Qo /path | rpm -qf /path |
Universal Packages (Snap, Flatpak)
Snaps and Flatpaks bundle their own dependencies and run in a sandbox, so the same package works across distributions.
snap find term # Search the Snap Store
sudo snap install pkgname # Install a snap
snap list # Installed snaps
sudo snap refresh # Update all snaps
sudo snap remove pkgname # Remove a snap
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak search term # Search
flatpak install flathub org.gimp.GIMP # Install by ID
flatpak run org.gimp.GIMP # Run it
flatpak update # Update everything
flatpak list # Installed FlatpaksBuilding from Source
When software isn't packaged, the classic build steps are:
tar -tzf project.tar.gz | less # Check the contents first
tar -xzf project.tar.gz && cd project
less README INSTALL # Read the build instructions
./configure --prefix=$HOME/.local # Install into your home directory, no sudo needed
make
make installWithout --prefix, software installs system-wide under /usr/local and make install needs sudo. Prefer your distribution's packages when they exist, because the package manager will keep them updated.