Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Some situations call for manually installing a local package using dpkg -i <packagename>. Sometimes it may be further useful to leverage the functionality of apt with that package so the question is:

How do you quickly create a local repository for random packages using a Debian based linux distribution - like Xubuntu 13.04/Ubuntu?

share|improve this question
    
Just FYI. The usual thing is to follow dpkg -i <packagename> with apt-get -f install to pull in required packages. Also, the usual thing to create an apt repos for Debian is reprepro. –  Faheem Mitha Aug 17 '13 at 17:38
    
I've found reprepro helpful –  Gilles Aug 17 '13 at 21:11
    
Thank you for your comments. @Faheem Mitha: can you please briefly expand on why running apt with --fix-broken would be required after installing a local package with dpkg -i? Wouldn't dpkg take care of that? I read it may be required the first time apt is run? @FM&Gilles: About reprepro. Seems useful if I could get it to work (not sure about dir struct, contents of 3 files or params at runtime). Will try again and update or post full question. –  Amphiteóth Aug 18 '13 at 3:49
1  
@illuminÉ : dpkg does not resolve dependencies, but apt does. dpkg will warn of broken dependencies, but is low level, so will not attempt to fix them. The dpkg -i *.deb followed by apt-get -f install is standard procedure. There is a wishlist bug to have apt itself handle the case of local package installation, and there is even a patch, I think, but it has not yet been implemented. See apt-get install could install local package files, too, originally filed in 1999. –  Faheem Mitha Aug 18 '13 at 8:39
    
@illuminÉ Expressing interest in this feature will not hurt. I think the more people who (politely) express interest, the more likely it is that it will be implemented. Note also that gdebi is an alternative, as noted in the bug report. That is part of the reason it has not been implemented, I think. Though having such core functionality part of apt would be better than having this functionality as part of another package. –  Faheem Mitha Aug 18 '13 at 8:42

1 Answer 1

up vote 9 down vote accepted

This should be distinguished from the situation where you're trying to replicate a full package tree from an official repository and fine tuning sources priority. Random packages mean virtual packages, packages which are compiled locally or copied in a piecemeal fashion for testing purposes. Here's a simple setup based on now obsolete documentation.

First, make a directory to host the packages:

mkdir <packagedir>

Then move your .deb package files there. Execute this command from the directory above the one we just created (make sure permissions allow this!):

dpkg-scanpackages packagedir | gzip > packagedir/Packages.gz

Now create a file with extension .list in /etc/apt/sources.list.d/ with the contents:

deb file:///path_to_dir_above_packagedir packagedir/

and update the apt database:

apt-get update

At this point the packages in our local repository can be installed like any other package using apt-get install <packagename>. When new packages are added to the local repository, the prescribed dpkg-scanpackages command must be issued again to update the Packages.gz file and apt must be updated before the new packages are made available. Hopefully this can be useful for testing purposes.

share|improve this answer

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.