I would like to set up an APT repository on a server that will provide a couple of packages.
Is there a way to set one up without installing any software on the server?
How do the files have to be organized?
Edit: I must be doing something wrong... can someone please help me? I have the repository at http://quickmediasolutions.com/apt/dists
I'm not sure where or what, but something's misconfigured. I only currently have one package and it's for all architectures.
Here's what's been added to my /etc/apt/sources.list
:
deb http://quickmediasolutions.com/apt stable main
Just set up a simple but signed repository on a webserver. Because most other tutorials are somewhat dated or cumbersome, I'll try to replicate the procedure here. The initial configuration takes a bit of effort, but the simple build script keeps it easy to manage. And you can just drop in new
*.deb
files, then update, or let a cron job handle that.Generate some signing keys
First you need to create a
gpg
signing key for packages and your repository. Make it a (4) RSA signing key, no password, and give it a unique$KEYNAME
when asked for. (Further examples assume "dpkg1
" as keyname.)I said no password, because your webserver has no builtin monkey to type it in repeatedly. And the signed packages and repository are only meant to satisfy the update-managers complaints about that. Just upload both keys to the new
/apt/
repository directory on your webserver, but delete thesecret.gpg
key after initialization.Update CGI script
This is the simple update shell/CGI script for it:
The three
gpg
lines only need to be executed once, to initialize the GPG setup in some directory$GNUPGHOME
(above the document root). Delete only thesecret.gpg
after success.One unique feature of this small shell script is that it accepts any
*.deb
files that you drop in, but also searches recursively (starting from one level up) for others, and symlinks them in. (Needs .htaccessOptions FollowSymLinks
eventually.)You can either execute this script manually as CGI or per cron-job. But hide it, or better yet move it out of the document root.
Because it's a "trivial" apt repository it needs the following
apt-sources.list
entry:That's suitable for single-architecture repositories, and if you don't expect hundreds of packages.
Package signing
Signing your individual packages is also trivial, once you've set up your gpg keys:
(This should be done on the workstation where packages are built, not on the repository webserver.)
Unsigned repository
If you don't need signed packages, then you could slash the update script down to just:
Which can still be used by average users, but needs a custom flag for
apt.sources
:But please don't use the
trusted=yes
flag habitually for everything, or if you're not actually sure about the package origin.For usability
For end users, just drop a
HEADER.html
into the repository directory. Apachesmod_auto_index
will prepend that note:Alternatives
There are a few tools to automate repository management these days. And there are even repository online hosters and package build services (gemfury, packagecloud, bintray etc.)
A rather convenient alternative is prm. It's a Ruby script, which builds complex APT and YUM repos. (But let's just hope RPM finally dies out sometime soon..) - It's best installed per
gem install prm
.And I've also written a small script to automate this similarly: http://apt.include-once.org/apt-phparchive - Please not that it's not overly robust and written in PHP (for once, this is coincidental), and was originally meant for DEB, and RPM-over-APT and Phar bundles.
Since this is closely related to the original question, there are also tools to build Debian packages more easily. Somewhat outdated: EPM. Much more contempoary: FPM. And my personal fork thereof: XPM (more lazy approach for packaging scripting language apps.)
Setting up a trivial repository is very easy using dpkg-scanpackages. This page explains how to set up a trivial repo, and this one explains how to use it (scroll down to example 4).
Yes. You can do this. You just need to organize the files in the right way and create the index files. If you put the directory structure inside the document root of your web server the packages can just be accessed via the web server.
Here is a detailed description how the files need to be organized and how the index files are created.
You can also use a tool called reprepro if you are willing to install that one package. This will make the administration a little more convenient.
You can perhaps also consider a Launchpad PPA
For anyone facing this error after following mario's answer:
do the following:
I put my
*.deb
files indebs
folder.