Friday, January 30, 2015

Farewell, apt-get install

One reason behind many people liking Ubuntu is the availability of a tremendous number of free software, and the relative easiness of installing them (most of the time, all that takes is a simple apt-get install).

However, things get nasty when you need to install software on a machine with limited or no internet connectivity. The repository URLs may be inaccessible, or downloads may be restricted on the network. Even if everything goes fine, in the end you will be left with a huge degree of data usage and time spent (since everything would have to be redownloaded separately for every instance of the installation on different machines).

Nevertheless, if you are not too uncomfortable with digging around a bit, you will be able to copy most of the already installed applications from machine to machine, in no time.

(Please note that this approach is not recommended (and probably not applicable) for services like mysql or apache, which usually inject configurations to /etc and other locations.)

Generally, the bulk of an application installed via apt-get goes into /usr/lib, and a launcher script is created in /usr/bin. Some more stuff may go into /usr/share and /usr/share/doc, but you can live without them most of the time.

Configuration and customization settings are usually confined to your user directory (/home/[username]), which can usually be ignored. If you want an exact clone of the application, you can copy them as well.

Locating the necessary files correctly and completely is the next biggest challenge. However, thanks to proper naming conventions used by Linux packages, the directory names (and executable or launcher script names, if any) are almost always identical to the base package name (e.g. eclipse, firefox, chromium-browser, etc). Besides, you can always use a command like sudo find /usr -name chromium* to locate the relevant directories and files (in this case, for an application having a name starting with 'chromium').

For example, once I managed to get a working copy chromium-browser (which would consume a few hundred megabytes of bandwidth if retrieved via apt-get), just by cloning the /usr/lib/chromium-browser directory, and the /usr/bin/chromium-browser script.

For licensed software such as IntelliJ IDEA, if you copy the .IntelliJIDEA directory inside your user directory, you will get a working licensed copy on the target machine as well! (Please note, however, that such copying may violate the license terms and conditions.)

The copying process can be facilitated by any of the popular Linux remote copy tools, such as scp, rsync, or even netcat.

Depending on any errors you get upon invoking the newly copied application's launcher, you may also need to set executable permissions on certain files such as scripts and executables (in case they do not get replicated correctly during copying).

So, that's it, folks! No more apt-get!

[Please note that the content in this article is based solely on my experience with Ubuntu Linux. There is no guarantee that this approach would work on a given Linux distro or version, regardless of the consistency of Linux culture across platforms.]