How to host a deb/apt repo on CentOS?

I would like to make a mirror of just the puppet client and its dependencies for Ubuntu Precise, but hosted on my CentOS 6 host.

If I do

cd /var/ftp
wget -A deb -r -np -nH --cut-dirs=1 http://apt.puppetlabs.com/pool/precise/dependencies/
wget -A deb -r -np -nH --cut-dirs=1 http://apt.puppetlabs.com/pool/precise/main/

and then on an Ubuntu Precise add the following to /etc/yum.repos.d/mypuppet.repo

deb ftp://puppet.example.com precise main
deb ftp://puppet.example.com precise dependencies

then I get

W: Failed to fetch ftp://puppet.example.com/dists/precise/dependencies/binary-amd64/Packages  Unable to fetch file, server said 'Failed to open file.  '

Question

Is there a tool or howto on how to host a deb/apt repo on CentOS?


Solution 1:

I'd say the appropriate tool for this task is debmirror(1), which is available in the CentOS repositories.

Make sure you import the GPG keys of the puppetlabs repository from a keyserver:

# gpg --recv-keys 1054B7A24BD6EC30
gpg: requesting key 4BD6EC30 from hkp server pool.sks-keyservers.net
gpg: key 4BD6EC30: public key "Puppet Labs Release Key (Puppet Labs Release Key) <[email protected]>" imported
gpg: 3 marginal(s) needed, 1 complete(s) needed, classic trust model
gpg: depth: 0  valid:   3  signed:   4  trust: 0-, 0q, 0n, 0m, 0f, 3u
gpg: depth: 1  valid:   4  signed:   6  trust: 3-, 0q, 0n, 0m, 1f, 0u
gpg: depth: 2  valid:   1  signed:   1  trust: 1-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2014-05-11
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Then, grab the packages from their repository:

# debmirror --check-gpg --keyring=/path/to/keyring.gpg --method=http \ 
  --root=/ --arch amd64 --dist precise --section main,dependencies   \
  --nosource --host apt.puppetlabs.com --progress /path/to/local/repo

This way you ensure the directory structure is correct and all the expected files are present.

Solution 2:

You synced only the deb files , you forgot to retrieve package list definition, you can have it at http://apt.puppetlabs.com/dists/precise/ .

I really suggest you to sync all the repository with:

rsync -av --copy-links --del rsync://apt.puppetlabs.com/packages/apt/ /var/ftp/

With Rsync it will easier to keep up to date your files. I'm pretty sure if you have deb files AND the package definition it will work .

http://apt.puppetlabs.com/README.txt

have a nice day.