As I described in Building Custom .deb Packages and Chroots, since we’re using Ubuntu we wanted to use the Ubuntu package management tools—apt and dpkg—to install our custom stuff. After I built the package, I wanted to use apt to install it, because while dpkg will identify the dependencies, it won’t install them (which is lame, but a documented gap).
To do this, we need to tell apt where to find my package, which means we have to create a repository. Don’t worry, this sounded like a big deal to me with custom ftp servers, but apt/sources.list already supports file-based repositories.
Two easy steps:
Create the repository
First you need to create a special file called Packages.gz which lists the available packages. It’s built using the utility program dpkg-scanpackages.
mark@desktop$ mkdir repository mark@desktop$ mv mypackage-0.1.deb repository mark@desktop$ cd repository mark@desktop$ sudo dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
Let apt know about your new repository
Edit /etc/apt/sources.list to tell it about your new file. Here’s why mine (inside my chroot) looked like when I was done:
deb http://us.archive.ubuntu.com/ubuntu/ lucid main universe multiverse deb file:/home/mrisher/repository/ / deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main
After that, you’ll have to tell apt to refresh its cache:
mark@desktop$ sudo apt-get update
That’s it! Now you can install your local packages (assuming no namespace collision, but you’d want to be careful about that anyway) by simply typing
mark@desktop$ sudo apt-get install mypackage
I haven’t figured out how to deal with the unsigned package yet, but I’m not really sure I care.
/m