Create Debian repository with multiple packages verions
I need to create debian repository to keep our software packages, but the main point here is to allow multiple versions of software be keep in it to rollback if needed. reprepo is unable to do that, and it seems that debarchiver is also can't
I can just use dpkg-scanpackage -m to generate packages.gz but more interesting is to create fully featured repo, with pinning and gpg signatures support
Any advice? Thanks
Solution 1:
I do it the way the postgresql project does it http://apt.postgresql.org/pub/repos/. I add one more directory level for dist (ie. ubuntu or debian).
There is almost no mention of how to use components this way anywhere. What I am about to show is probably the most you will find on the subject in any one place.
So let's say you have your own app call foobar
. My suggested directory structure would be /var/www/repos/apt/debian/
with repos
being the root web folder. You could also make apt
the root web folder if you only have apt
and no yum
or ? repos.
/conf/distributions
file below that directory would be something like:
Origin: foobar project
Label: foobar project
Codename: foobar
Architectures: i386 amd64
Components: main v1 v2 3 7.1
Description: Apt repository for project foobar
SignWith: XXXXXXX
In addition to the main
component that all the documentation talks about, we are adding our own custom component names v1
, v2
, 3
, 7.1
. You can use any string and add as many as you like. You are not limited to the standard ones all the documentation talks about.
If you do not use the -C
flag it defaults to main
. To copy into the v1
component directory and assuming those debs are located in /usr/src/
cd /var/www/repos/apt/debian
reprepro -C v1 includedeb foobar /usr/src/*.deb
Or if you want to create a 7.1
component directory and assuming we have those debs in /usr/src/7.1/
(for example):
reprepro -C 7.1 includedeb foobar /usr/src/7.1/*.deb
That will create a 7.1
component directory in /var/www/apt/debian/pool/7.1
Then you add your repo in /etc/apt/sources.list.d/mycustomrepo.list
deb http://packages.mydomain.com/repos/apt/debian foobar main v2 3 7.1
Now you have access to versions in main
, v2
, 3
, and 7.1
. You can also change what versions you have access to all on that one line in mycustomrepo.list
If this is not your own project but say a repo with stock and/or custom debian OS packages, then instead of foobar
you would just use the debian os name such as stretch
which is how most documentation talks about it when explaining repos.
This is probably the best way but if you don't want to use components you could do the versioning in the app name. So foobar_v1
, foobar_v2
, foobar_3
, foobar_7.1
. But now your repo file would need a separate line for each version you want access to. It also changes your workflow when doing changes adds/removes.
There is also the way mariadb does it with separate root folders for versions. http://mariadb.mirror.globo.tech/repo/
But that assumes you are only using apt and the repo is only for one specific app/project. So I don't think it is as flexible.