Configure Ubuntu repository




If you use a Debian based system(Ubuntu etc) with a slow/no Internet connection, you will be limited to installing only those applications that come with the installation CD/DVD set. The issue is more serious with Ubuntu like operating systems where there is only one installation CD/DVD. But there is a way in which the required files can be downloaded on a machine with fast Internet connection and then copied over to your local machine(using a media like CD etc) and make them available to the Advanced Package Manager(apt). Below is the complete procedure to do the same.
Note to Ubuntu users: You need to add “sudo” before all the commands specified below.
1.    On your local machine, run the following command to generate a list of files needed for the application(s) you wish to install:
sh# apt-get –qq ––print-uris install {packagelist} | awk -F\‘ ‘{ print $2}‘ > get.lst
2.    The URIs from where to download all the files needed to install the packages listed in {packagelist} will be added to the get.lst file. Copy this file over to the machine with fast Internet connection and run the following commnad there:
sh# wget -c -i get.lst
This will download all the .deb files listed in get.lst file in the current directory. Copy all these .deb files to your local machine in a directory, say /root/sharedebs.
3.    Move to /root directory and run the following command:
sh# dpkg-scanpackages sharedebs /dev/null | gzip > sharedebs/Packages.gz
4.    Now add the following line to your /etc/apt/sources.list file:
deb file:/root sharedebs/
Run the command ‘apt-get update’ once to update the apt cache.
Now you can install the applications in the normal way by running the
‘apt-get install’ command or using Synaptic Package Manager like tools.

You can also use the above procedure to share the .deb files that you have downloaded on your machine to install any applications with another machine(say your friend’s machine) if you want to install the same applications on it without having to download the same .deb files again. Just copy all your .deb files from /var/cache/apt/archives/partial/ to your friend’s machine(in /root/sharedebs directory) and follow the steps from Step 3 on your friend’s machine.
Here is an example of how you can install the package lynx on your local machine using the above procedure:
1.    On local machine:
sh# apt-get -qq ––print-uris install lynx | awk -F\‘ ‘{ print $2 }‘ > get.lst
sh# cp get.lst /media/cdrom
sh# umount /media/cdrom

Update: If you are getting errors with the above awk command, you can try with a perl script. More details in this comment.
2.    Copy the file get.lst to the machine with fast Internet connection(using a CD etc):
sh# mkdir /home/user/debs
sh# cp /media/cdrom/get.lst /home/user/debs
sh# cd /home/user/debs
sh# wget -c -i get.lst
sh# cp *.deb /media/cdrom
sh# umount /media/cdrom

3.    Copy all the .deb files to the local machine(again, using CD etc) in
/root/debshare directory:

sh# mkdir /root/debshare
sh# cp /media/cdrom/*.deb /root/debshare
sh# cd /root
sh# dpkg-scanpackages sharedebs /dev/null | gzip > sharedebs/Packages.gz

4.    Add a line in the /etc/sources.list file and install the application using apt-get:
sh# emacs -nw /etc/apt/sources.list
deb file:/root sharedebs/
sh# apt-get update
sh# apt-get install lynx


No comments:

Post a Comment

Thank You for your Comments, We will read and response you soon...