This question is very fundamental. But I don't see it answered here. What is the difference between installing a .deb
file and installing a package via sudo apt-get install
When I am going to download for eg ;OSMC here, they have both the options as choice. Is there any benefit from choosing one over the other? What is the technical difference?
A
.deb
file is a package containing all the needed files for the application, plus some utility files used for installation/removal, etc.These are installed via
dpkg
, the "Debian Package Manager".apt-get
is a frontend todpkg
(as isapt
,aptitute
, ...). Simply saidapt
downloads the.deb
from known repository sources and callsdpkg
under the hood to execute actions on them (i.e. install, remove, purge, etc.).But it's not all! The
apt
family do a lot of extra things for you.apt update
), so it will always install the "latest" version available for your OS..deb
files to install (and their correct version) to satisfy the dependencies of the.deb
you want to install.apt
suggests you which other packages were installed as dependencies (or you can instruct it to remove them automatically).Usually, you'll want to use
apt
, as it keeps (or at least it tries hard!) your system clean and functional. There are cases where the "download.deb
file manually and install viadpkg
is preferable.Obvioulsy, if the package maintainer does not publish it on the official repositories, nor on any PPA, nor has any interest of providing a repository. In this case the only option is download +
dpkg
.Or maybe, you customized your system in some non-standard way, so you need to install and manage the package manually as
apt
gets "confused" and cannot resolve conflicts/dependencies/etc...A deb file is a type of format for the packaging Linux programs - specific to Debian-based distributions (in the way in Windows you have the "exe" files). It can be downloaded on your computer and installed.
The installation can be
Among the programs (GUI or CLI) that can manage the installation some
can do both those things (GUI: Ubuntu Software Center, Discover; CLI:
apt
,apt-get
;can only install from a local deb file (GUI: Gdebi, Qapt; CLI:
dpkg
, which is the base for all the other tools mentioned here - as said in the other answer);can only download & install automatically (that's just GUI: Synaptic, Apper, Muon).
So,
apt
orapt-get
(like their GUI equivalents Ubuntu Software Center and Discover) can download the deb packages before installing them if the specific software source (or "repository") is already registered to your system or if you add it yourself OR they can install a program from a deb file that you already have.The main difference is not between the way installation is done in the two cases, but in the origin of the deb file. Just as you can download a file from the internet from a trusted or a less-trusted source, repositories are of different categories. The main difference is between official system sources (those provided by Ubuntu) and those provided by third parties.
There is no point in installing from local file a program that is available in repositories unless you lack internet connection, or you want to install a program version that is not in the repositories.
Usually the main reason for adding a new repo or installing from a local file is the absence in repos of a program or of a certain version of a program.
Remember: on Ubuntu
sudo apt install
command installs from deb anyway. The difference is whether you have the deb already on your computer or the installer will download it for you. In the latter case deb file are downloaded at/var/cache/apt/archives
.Deb files can be found not only on the internet, in some cases they can also be created from sources or converted from other formats (namely from
rpm
packages - specific to RedHat/Fedora - based distributions).