2008/03/24

Create a debian repository for APT

Source: http://hausheer.osola.com/docs/14
By: David Hausheer

Config files:

/etc/apt/apt-ftparchive.conf
/etc/apt/apt-custom-release.conf

Create tree layout under /path/to/myrepository:

dists
+-custom
+-main
|-binary-i386
+-source

Put binary deb files into binary-i386
Put source files into source

Create archive config file under /etc/apt/apt-ftparchive.conf:

Dir {
ArchiveDir "/path/to/myrepository";
};

BinDirectory "dists/custom/main/binary-i386" {
Packages "dists/custom/main/binary-i386/Packages";
Contents "dists/custom/Contents-i386";
SrcPackages "dists/custom/main/source/Sources";
};

Tree "dists/custom" {
Sections "main";
Architectures "i386 source";
};

Create release config file under /etc/apt/apt-custom-release.conf:

APT::FTPArchive::Release::Origin "myrepository";
APT::FTPArchive::Release::Label "myrepository";
APT::FTPArchive::Release::Suite "custom";
APT::FTPArchive::Release::Codename "custom";
APT::FTPArchive::Release::Architectures "i386 source";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Description "Custom debian packages for myrepository";

Script: /etc/apt/update-archive.sh:

apt-ftparchive generate apt-ftparchive.conf
apt-ftparchive -c apt-custom-release.conf release /path/to/myrepository/dists/custom > /path/to/myrepository/dists/custom/Release

Add repository to /etc/apt/sources.list:

deb file:/path/to/myrepository/ custom main