Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I copied "archives" folder (/var/cache/apt/archives) from another computer which was fully updated and had some packages that i want. Can someone guide me how to add my USB drive in repository list so that i can install those packages from it?

Thanks.

share|improve this question
    
add comment

2 Answers 2

up vote 10 down vote accepted

You should build a repository in a local directory and point a file: URI entry to your APT sources (see URI SPECIFICATION in man sources.list):

deb file:/home/user/repository

To make apt work, you need to create a list of packages (Packages.gz) for APT to consume. This is explained in detail here. For your case, it should be quite easy. I refer you to the "Trivial Repositories" section of the manual. It should be as easy as changing to, say, /home/user/repository and running

dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz

Then after a apt-get update, the packages should become available. Perhaps if you want to make this source take precedence over others, you need to assign it a higher priority; for that see the APT manual pages.

share|improve this answer
    
n.b. the local directory in question can of course also be a USB drive, such as /media/usbdrive/repository –  loevborg Sep 6 '10 at 11:25
add comment

I don't think there is a way to add this as a repository but you can use it to install the packages by copying the contents to your /var/cache/apt/archives. To do this, press alt-f2, enter gksudo nautilus and do the copy. Once you have done, make sure you close the file manager window because it is not a good idea to use the file manager as root except for the tasks that absolutely require it.

To view/install these packages, run System -> Administration -> Synaptic Package Manager, click the 'Origin' button and choose 'Local' from the list.

In the future, you are better off using a program called aptoncd which can be installed from the repositories. It can be used to create a CD image that can be added as a software source. This image can be transported on a usb stick.

The easiest way to add the image as a software source is to burn it to a CD/DVD. You then need to go to System -> Administration -> Software Sources, click 'Other Software' and click 'Add CD-ROM...'.

If you want to use the ISO image as a software source without burning it, the process will be a bit more complicated. You will need to open a terminal Applications -> Accessories -> Terminal and run these commands:

sudo mkdir /aptoncd-mountpoint
sudo mount /media/USB/aptoncd.iso ~/aptoncd-mountpoint -oloop
sudo apt-cdrom -d=/aptoncd-mountpoint add

(source: http://www.debianhelp.org/node/10486)

If you want to download packages on one computer (Linux, Mac or Windows) and install them on an Ubuntu system, you can use keryx.

share|improve this answer
1  
I don't think this is accurate. There is a file:// URI type. Making an iso image is really much too complicated for this simple task. –  loevborg Sep 6 '10 at 8:39
1  
It doesn't work. It still tries to mount /dev/sr0. –  int_ua Dec 29 '11 at 15:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.