How to add my own .deb file to my local mirror to use with apt?

5,235

Solution 1

If you plan to update your packages in the future, or add new ones, I would strongly recommend not relying on kludges, but instead use the right tools.

So rather than mixing your own packages with a Ubuntu mirror, consider putting together your own little repo to keep things neat and isolated, and also sign your packages for authentication.

This will take a little time to set things up, but will save you a ton of maintenance headaches down the road.

I've found that the best tool for that task is reprepro.

Some links to get you started:

  1. https://www.digitalocean.com/community/tutorials/how-to-use-reprepro-for-a-secure-package-repository-on-ubuntu-14-04
  2. http://kaivanov.blogspot.com.by/2012/08/creating-apt-repository-with-reprepro.html
  3. https://wiki.debian.org/SettingUpSignedAptRepositoryWithReprepro

Solution 2

Create a directory and place you .deb package within.

Remind yourself of some of the info present in the debian file:

dpkg --info <yourpackage.deb>

Move to your directory and enter sudo dpkg-scanpackages . /dev/null | gzip -c9 > Packages.gz

Add this line to your sources.list: deb file:///path/to/directory / - yes, include the whitespace :)

sudo apt-get update
sudo apt-get install <packagename>
Share:
5,235

Related videos on Youtube

Arronical
Author by

Arronical

Always learning, normally trying not to offend.

Updated on September 18, 2022

Comments

  • Arronical
    Arronical over 1 year

    I've created a full local mirror of the 14.04 repositories using apt-mirror and connect to it over LAN using apache. I have adapted my sources.list file on the machine that I wish to update from the local mirror.

    What is the process required to add my own .deb file (mypackage.deb) and make it available through apt-get install mypackage?

  • Arronical
    Arronical over 8 years
    Then this could be hosted alongside the full local Ubuntu mirror, and wouldn't require much extra apt configuration right?
  • A.P.
    A.P. over 8 years
    Yes, that would be a separate repo you would host alongside your other mirror. Not sure what you mean by "extra apt configuration", could you clarify?
  • Arronical
    Arronical over 8 years
    I just meant any further work on each client machine, other than updating the source.list files. I should probably digest those links first though!
  • A.P.
    A.P. over 8 years
    Correct. You'll just drop a sources file into /etc/apt/sources.list.d with your repo information and you're done.
  • TellMeWhy
    TellMeWhy over 8 years
    @Arronical re-enter the dpkg-scanpackages command when you add a new package
  • TellMeWhy
    TellMeWhy over 8 years
    @Arronical I made a mistake - the file:/// part shouldn't be to the package itself, but to it's parent directory