This is because the Linux ecosystem contains many many different sub branches (click on the image for a larger version)1:
Now, one of the basic differences between these distributions is the package manager they use. Debian and its derivatives (one of which is Ubuntu) use
dpkg which deals with
.deb packages. The other large player is the RedHat Package Manager (
rpm) which works with
.rpm packages. Other distributions have their own system or use a wrapper to install directly from source or even have no package manager at all.
In any case, the
.tar.gz format is
Not actually a format. That is what is known as a compressed tarball.
tar creates archives (
.tar) which are then passed through
gzip to compress them (
.gz). See here for more details.
Not an installer. It is just a collection of files/directories, in the case of source tarballs, the source code of a program.
Not in any way specific to source codes or programs. You can think of
.tar.gz as an equivalent to Windows (and not only)
.zip files. They can contain an installer or they can contain word documents or whatever else.
The reason why all Linux programs are not packaged as
.deb files is because while
.deb is indeed popular, it does not work for all distributions. Therefore, a developer can either attempt to package their app for as many distributions as they can or simply make the source code available and let users compile it themselves. Up until a few years ago, the vast majority of Linux programs were only distributed in this way. The variety of pre-packaged programs was quite small.
This has changed in recent years with the huge increase of popularity of the
.deb format, which was largely due to the corresponding popularity of Ubuntu and Linux Mint.
The reason why not everyone uses
.deb is that each approach (
pacman etc) has its diehard fans. And if I only release my program as a
.deb not everyone will be able to use it. The only way to make sure that any GNU/Linux user will be able to use my software is to release it as source and let them compile it manually.
As a final note, you really shouldn't be scared of such programs. While it is true that sorting out the dependencies can be a pain, most devs will clearly state the dependencies on their webpage and as long as you have them installed, installing software from a source tarball is really quite easy:
Extract the file
tar xvzf software.tar.gz
Move into the newly created directory where the files were extracted
sudo make install
This can all be condensed to:
tar xvzf software.tgz; cd software; ./configure && make && make install
1 Image taken from this Wikipedia page.