There are many ways to install software packages on Ubuntu, some of them you have not mentioned. In order to give a complete answer, I want to describe all of them:
Installation by package manager, default repositories
The package manager (no matter if apt
, apt-get
, aptitude
or whatnot) has a list of locations to download software from. This software is generally trustworthy, known to work and mostly well maintained. Such a location is called a "repository". The repositories' URLs are stored in /etc/apt/sources.list
. When running apt update
, the package manager queries the repository so it knows which software packages are available. It stores the information in a local cache.
When installing a package by apt install
, the package manager checks its local cache to determine where to download the package from. Then it downloads the package. The package is provided as an archive in the DEB format. The archive is unpacked into your local file-system. Additionally, the package may contain some code which will be automatically executed once for setting up the newly installed software.
When updating software by apt upgrade
or apt dist-upgrade
, new versions of existing packages are downloaded. The current version is removed from the system. The package manager knows which files to remove as it knows which file was provided by which package. The new version is then installed as described above.
Installation by package manager, custom repositories
It is also possible to expand upon the default repositories by adding URLs to /etc/apt/sources.list
, although these days /etc/apt/sources.list.d/
should be used. The package manager will regard them just like the default repositories. Installing, removing and updating works exactly the same. The user must take care when adding custom repositories – they must be made for the system.
On a side-note: From personal experience, I advise to remove all packages installed from non-default repositories before doing an upgrade from one Ubuntu release to the next one.
Installation by package manager, manual download
You can also download DEB files manually. You can install the package via dpkg -i
. The package manager will never update this package since it does not know where it came from.
Installation via snap
snapcraft is an alternative to the package manager geared towards being compatible not only with Debian-derived Ubuntu, but with all Linux distributions. A snap package is not unpacked into the system. Moreover it is mounted (its contents made visible directly) and the software is executed in a controlled environment inside your system (think of sandboxing and virtual machines). When removing a snap, the package is unmounted and removed. Updates happen analogous.
Fully manual installation
You can also download a bunch of files and place them in appropriate places on your hard-drive. Custom software often goes into /opt. Binaries (or links to them) are installed into a directory in $PATH
. This way, the software can be accessed easily. The package manager does not know anything about this software. Updates need to be installed manually, too (sometimes the software features a self-update function, tough). Custom software can also be installed to places like /usr/local
or even /usr
. The latter should not be done unless you really know what you are doing. Custom software can clash horribly with software controlled by the package manager.
Similar questions:
Ubuntu software updates with apt-get
Does it make a difference whether I update packages via Apper or the Software Center in Debian?