How to Host Your Own Debian Repository

1 min read

With Linus surrendering to the forces that will consume Linux, it’s time to rethink a few things and make some decisions now that could save our nerd bacon, at least locally.
This is for primarily Debian based distributions but all good distros have something in place to help with mirroring.
What you will need:
1. A Debian-based server with plenty of space.
2. Sudo access to the server.
3. Some time.
What I assume:
You know about Debian’s apt repository system. You are familiar with Linux command line and basic administration.
Difficulty level: Low to Medium.
Install apt-mirror.

> sudo apt-get install apt-mirror apache2

Using your preferred editor, edit /etc/apt/mirror.list
Add the repos you want to mirror. For example, if you want to mirror the older Jessie packages, you’d have something like the following:

deb http://deb.debian.org/debian jessie main contrib non-free
deb-src http://deb.debian.org/debian jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

Once you are ready to download the packages for mirroring run

> su - apt-mirror -c apt-mirror

It’s going to take a while. If you have a slow connection, it’s going to take even longer. For the first time, I ran it overnight when I ran it. It will put the mirror data in /var/spool/apt-mirror/mirror/
Once it’s done creating the mirror, you can serve it up through Apache.
For example:

> ln -s /var/spool/apt-mirror/mirror/ftp.us.debian.org/debian /var/www/debian
> ln -s /var/spool/apt-mirror/mirror/security.debian.org/debian-security /var/www/debian-security

Now, on the machine you want to use the local mirror, edit the apt sources to point to the mirror server.
Edit /etc/apt/sources.list
If you are setting it up for the server running the mirror, you can do something like this:

deb http://localhost/debian etch main contrib non-free
deb-src http://localhost/debian etch main contrib non-free
deb http://localhost/debian-security etch/updates main contrib non-free
deb-src http://localhost/debian-security etch/updates main contrib non-free

If you are setting up a different server, replace localhost with the machine’s name.
After that:

> sudo apt-get update

And you’ll be pulling packages from your very own mirror.
If things look stupid, just stop updating your main mirror and you will have working code that could potentially keep going even if the kernel gains diversity, good and hard.

6 Comments

  1. We need an SJW-free distro. What you are doing is worthwhile, but it is at best a temporary band aid. How long are you gonna stick with that version of Debian once they cross your personal line? A year? Two? Five? Five years is a LONG time in the software world.
    Not trying to black pill here, kudos for making a Linux post in the first place, but you’re dealing with symptoms instead of the disease here.
    We need a meritocracy distro for long term usage.

    • I agree, Anonymous.
      But this is something that can be done right now as stop-gap until we have better alternatives.

      • We’ve been discussing this for a while. We just don’t have enough people to do everything.
        If a high level Linux kernel developer wants to jump ship and head up a SJW Free Distro we will figure out way to do the infrastructure.

  2. LOL. SJW?? Telling people to not verbally abuse people is just decency, not SJW, left wing, takeover. So sad, that you feel threatened by a call to be kinder to others you don’t really know. Anyway, this article is great. Thanks for the info

Leave a Reply

Your email address will not be published.

Previous Story

Sunshine and Storm in Rhodesia (Part 15)

Next Story

Jim Acosta's Banishment: A Step Forward For Civility in America

Latest from Technology

Old Ways

Editor’s note: Originally posted by Last Redoubt at https://lastredoubt.substack.com/p/old-ways Paper has a lot of problems. It’s