Setting up a personal debian repository
A Debian repository is a set of Debian packages organized in a special directory tree which also contains a few additional files containing indexes and checksums of the packages.
Background
If a user adds your repository to her /etc/apt/sources.list file, she can easily view and install all the packages available in it.
If your repository is listed in sources.list, apt-get will fetch the Packages.gz index if the binary packages are listed (with the deb keyword) and Sources.gz if the sources are listed (with the deb-src keyword).
Packages.gz contains the name, version, size, the short and the long description, and the dependencies of each package
Sources.gz contains the name, version and the build dependencies (the packages needed to build) of each package
Repositories can offer different packages for each supported distribution and for each of the supported architectures; apt will automatically fetch the right one for a user's machine, without her even having to know about all the different architectures.
It also allows grouping of your packages into components, just as Debian's packages are divided into main, non-free, contrib and so on.
Distributing the packages in many different directories can however become unmanageable.
It is also a waste of space and bandwidth, as there are many packages (for example documentation packages) which are the same for all architectures. In such cases, a possible solution is a pool. A pool is an additional directory under the repository root containing all packages (the binaries for all architectures, distributions, and components, and all the sources).
Set up
Reprepro makes it very easy to set up APT repositories that use a common /pool directory to store all the package files.
Repositories will go under /var/packages/ and it will be set up for the Ubuntu Gutsy distribution.
The directory /var/packages/ubuntu/ is going to be the base of the Ubuntu repository.
root@host:/var# mkdir packages;cd packagesinside this file put:
root@host:/var/packages# mkdir ubuntu;cd ubuntu
root@host:/var/packages/ubuntu# mkdir conf;cd conf
root@host:/var/packages/ubuntu/conf# vi distributions
Origin: IansThe Origin, Label and Description field can be filled with whatever you want.
Label: Ians Personal Debs
Codename: gutsy
Architectures: i386 amd64 source lpia
Components: main
Description: Ians Personal Debian Repository
SignWith: yes
DebOverride: override.gutsy
DscOverride: override.gutsy
The Codename is the specific distribution/version that this block of settings applies to. In this case it's gutsy.
The Architectures can be any of the 11 debian builds for and the Components can be of your choosing such as main non-free contrib and so on.
SignWith indicates that you want to create a Release.gpg file, creating a signed APT repository.
The DebOverride and DscOverride fields tell reprepro what files to use for the override rules. Override rules can be used to override .deb and .dsc configuration fields. Now create an options file:
root@host:/var/packages/ubuntu/conf# vi optionsinside this file put:
verbose(ask-passphrase is used if you created a signed repo)
ask-passphrase
basedir .
root@host:/var/packages/ubuntu/conf# cd ..this creates the override file if we need to use it later.
root@host:/var/packages/ubuntu/# mkdir override;cd override
root@host:/var/packages/ubuntu/override# touch gutsy.override
Adding a deb
root@host:/var/packages/ubuntu# $ reprepro includedebso for my repo I did:
root@host:/var/packages/ubuntu# $ reprepro includedeb gutsy /home/debs/liferea_1.4.4-0ubuntu4_i386.deb(notice the full path to the deb itself) More info about adding/removing debs and general repo 'good practice' is here
Setting up Apache
I am running mod_python so I control which urls are served with python or apache using apache's httpd.conf. First of all, make an Alias to the repository
root@host:/var/packages/ubuntu# cd /etc/apache2/sites-enabled/this file should look like (the part below and including Alias /packages/ "/var/packages/" ) :
root@host:/etc/apache2/sites-enabled# vi 000-default
NameVirtualHost *then add a SetHandler in httpd.conf to let apache handle the repo and not mod_python
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
Alias /packages/ "/var/packages/"
<Directory "/var/packages">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.html
AllowOverride Options
Order allow,deny
allow from all
</Directory>
<Directory "/var/packages/*/conf">
Order allow,deny
Deny from all
Satisfy all
</Directory>
<Directory "/var/packages/*/db">
Order allow,deny
Deny from all
Satisfy all
</Directory>
</VirtualHost>
root@host:/etc/apache2/sites-enabled# cd ..and restart apache (/etc/init.d/apache2 restart)
root@host:/etc/apache2# vi httpd.conf
<location "/packages">
SetHandler None
</location>
The repository is browsable at: http://<somehost.com>/packages/
To check out your debs using apt you need to add:
deb http://<somehost.com>/packages/ubuntu gutsy mainto /etc/apt/sources.list and do an apt-get update
deb-src http://<somehost.com>/packages/ubuntu gutsy main
tags:




