Wednesday, June 11, 2008

GNU/Linux package installation without Internet

Now, I found out a better simple solution for this. You can use an online tool described here:

Updated on July 4, 2008.

Hi friends,

Many of you may be in a situation that, you installed GNU/Linux in your computer but couldn't setup internet in it and many of your favorite packages are not available in the installation media. Package installation in GNU/Linux system is a bit difficult if you don't have Internet and don't have complete local repository, because you will have to resolve all dependencies yourself.

This was a major complaint of many of my friends who are new to GNU/Linux. MP3 support, video codecs etc. are not usually available in the installation media. This is also the same with Ubuntu. "Ubuntu looks good but it can't play my MP3s or videos". :-) I recently got a nice solution for this (from different sources in internet). Local update and install for APT. This trick will work on all distributions with APT as its package manager (Debian, Ubuntu etc.). You will need to work in command line a bit. But it's easy. Here is how to do it in Ubuntu 8.04:

1) You need to enable repositories and get packages list. Usually you do this by opening System->Administration->Synaptic Package Manager and selecting Settings->Repositories and then enabling universe, restricted, multiverse etc.

The package list is located in /var/lib/apt/lists/ directory. So, you can simply copy your friend's(who have internet in Linux) package list(all files in the above directory) to your system. Make sure that your friend also uses the same version og Ubuntu as yours. To paste files into this directory, you need root privileges. To get a file browser with root privileges, type:
sudo nautilus /var/lib/apt/lists
in a terminal.

If you have to download the package list yourself from another system or from MS Windows, then you can do this:
Enable the repositories you need. Then type:
sudo apt-get update --print-uris > ~/Desktop/update.txt
in a terminal.
This will give you the list of files to be downloaded in the file update.txt in your desktop. Here is the format of each line in that file:
'download_location' filename 0
You need to download each file and rename it to corresponding "filename" and then copy them to /var/lib/apt/lists/ .

I haven't tested this offline APT update. But I hope that it will work.

2) Now you can download packages. Use synaptic package manager to find out the name of package you need to download. Here, I am gonna install "cheese" (a software to capture video). Use the --print-uris option to get the list of packages to be downloaded.
sudo apt-get install cheese --print-uris > ~/Desktop/packages.txt
The packages.txt will contain the packages to be downloaded. Download all those packages and then copy them to /var/cache/apt/archives/

Then, we can install the package without Internet.
sudo apt-get install cheese

That's all.
Have fun with GNU/Linux. If you have any doubt, leave a comment.


Vivek said...

Copying the contents of /var/cache/apt/archives from a person who has internet is enough na.
Then doing dpkg -i *.deb.
Any problems with that?
Or u can get an AptOncd from the friend and use it as a source to install.

Technomaniac said...

there are repo dvds also na??

Jain Johny said...

That will work. But why should we copy and install all files in his cache? If the package we need is in his cache, take that; else download.

Ya, there are. But to get up-to-date packages, online repositories are best na? And what is the use of downloading all the packages from repositories?