What is the difference between deb packages and tar balls ? What are the advantages/disadvantages of each?

I don't know about tar balls. Most packages are available in the tar ball forms but Ubuntu packages are Debian packages.

What is the difference between deb packages and tar balls ?

What are the advantages/disadvantages of each ?


Solution 1:

Tar balls are usually source code that you have to compile. Debs are pre-compiled programs, already built and configured for Ubuntu/Debian.

I would strongly suggest using debs when available, as they are easier, and they integrate with the package manager, so you can easily uninstall them.

Debs will also install any dependencies needed. Installing from source can lead to what is affectionately called "dependency hell". Most open-source programs depend on several other programs/libraries to function. When installing from source, it will not install these, and will instead (hopefully) complain that a dependency is not met. You then try to install that dependency and then it bombs out, requiring another dependency, etc, etc.

Installing from source can also put your files in unexpected places, as different distros lay things out slightly different.

When I need to install a program, I try my options in this order:

  1. Look in the Software Center. This is obviously the easiest, although the Software Center is not all-inclusive and is not up-to-date with the latest versions.

  2. Try to find a repository that provides it. Adding a repository will make the program show up in the Software Center, receive timely upgrades, etc.

  3. Look for a .deb package.

  4. Install from source (tar ball).

Solution 2:

tar balls are just another form of compression like zip. Although the formats and techniques of compression differ, it is basically a container for a group of files and folders.

Usually, the source code and the files needed by it will be made available on the internet by the person/group who wrote the software in the form of a tar ball. So you can download it, untar it, compile the software and install it.

However, what deb packages do is to make this installation process easy for you by maintaining a standard. The software available on the internet will be taken by Debian package maintainers, made into their corresponding .deb packages and put into the Debian repository.

enter image description here

You can read about it from a Debian Package maintainer's blog here : http://www.j4v4m4n.in/2012/05/01/debian-utsavam-at-mes-kuttippuram-kerala-2/

As for the advantages and disadvantages, .deb packages are managed by package managers such as apt and aptitude. So whenever you install a software with it, they will automatically figure out if you have the dependencies that are required to run that software on your system and will install them for you.

But if you are using a tar ball install it, you will have to figure out what that software depends on and each time you will have to check manually whether the dependencies of the software you are installing were already installed previously.

But apt does all this for you.

Also, installing from source (installing from tar balls) will have different methods for different software. There is the GNU philosophy of configure-make-make install and there are other methods depending on how the software is written.

However, converting them into deb completely removes all these differences and makes it easier for the user to install and use the software.

One more point. When do you need to install from source? That is from a tar ball? There are basically two situations.

  1. If the debian packaging team has not yet packaged a software.
  2. If you want to contribute to the project. That means you can make changes to the source code, compile it and test the changes.

If you would like to know more about debian packaging, you can read it from here : http://www.debian.org/doc/manuals/maint-guide/

Hope this helps.

Solution 3:

Debian (and hence Ubuntu) packages are collection of binaries and related instructions for their installation. This means that the package itself knows how and where to install, and it also knows the list of packages it depends on.

Source tarballs (files with extension .tar.gz or .tar.bz2 - or even .tgz or .tbz2) are simply sets of files and directories that have been packed together with the tar utility and also compressed with either gzip or bzip2. To build the source code you have to:

  1. unpack the files with tar xvfz file.tar.gz or tar xvfj file.tar.bz2 (in an empty directory)
  2. configure the package with ./configure (the package tests the system to see if everything is ok before starting the compilation)
  3. start the compilation with make
  4. if you want to, run make install to install the application to its "default" locatioon (usually in /usr/{s}bin or /usr/local/{s}bin but it depends on the application and on the distribution)

The main advantages of Debian/Ubuntu packages with respect to source tarballs are that packages are "self-contained" and their binaries are tracked. This means that the unpacking process is transparent to the user who just sees (roughly) one package per application. The user doesn't even need to remember what files a given application has installed and where, so the installation/removal of applications becomes (mostly) a one instruction process.

The main advantages of source tarballs with respect to binary packages are that in the first case the source code is compiled directly on the target machine and can then be optimized accordingly. Moreover, even the best package system can broke in particular cases (e.g. software packages too new or too old) and usually official packages are purged by servers when they become too old. In these cases one has to manually search the Internet for the desired application and for the specific libraries at specific versions to satisfy all its dependencies.

Solution 4:

I can see some pretty good answers already posted. But there are a few things that need to be addressed.

Contrary to what is known as "dependency hell" when it comes to compiling from source, you can actually configure Ubuntu in such a way that it automatically installs those dependencies when you are compiling from a tarball/ any source.

Read how to do this here:

http://www.howtogeek.com/106526/how-to-resolve-dependencies-while-compiling-software-on-ubuntu/

Also, if you keep that dependency problem aside, the good thing about tarballs is that you can configure lot of install related things like where to install etc, very easily in case of installing from source.

Also, the word "Debian Packages" could confuse you in this context. Remember that Debian packages come in two types like it says here:

http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html

Of course, if you are talking only about deb files, then they generally are those compiled software like the above answers already said.