Development/Howto/CreateRepository

From Mandriva

Jump to: navigation, search
Create a repository of rpm's for fun and profit

How to create your own personal repository of rpm for Mandriva Linux

Contents


[edit]

Why you should not create your own repository

This document shows you how to distribute your own rpm's. However, this leads to work duplication and to problems when the whole set of rpm's is not tested for coherency, and therefor, having your own rpm packaging project is most of the time not a good idea.

People can greatly benefit from a centralized resources, as it eases the use, it gives more visilibility and there are more people to help you with your work. Bigger projects also provide cvs, bugzilla and ftp mirrors, allowing you to concentrate on the packaging instead of losing time on infrastructure problems.

[edit]

Organisation of your repository

First thing, you need to choose the layout of your repository.

There is no real standard for it, but you should separate things as much as possible. Do not mix cooker rpm's with stable release, nor ppc rpm with i586. Try to be clear, and take other projects into account.

Do not forget to place SRPM somewhere on the site, as most free software requires it.

[edit]

Generating hdlist

Once you have produced your various rpms, you can place them on a computer accessed by the network. With current urpmi, you can use rsync, ssh, nfs or samba ( with removable ), ftp or http.

We will choose http for our example, on the server rpm.example.net, with mod_userdir working, on a Mandriva Linux server.

First, create a public_html folder in your home, give the proper permissions ( 755 ), and place all your rpms in this folder. Try to download one of the files to check if everything is working. If directory listing is denied, add "Options + Indexes" in a file called .htaccess.

echo "Options + Indexes" >> ~/public_html/.htaccess

Once the rpms are downloadable, do this to generate all needed files:

cd ~/public_html
genhdlist .

You can also generate them on your workstation and place them on the website afterwards, if this is not a computer running Mandriva.

Then, try to add it as an urpmi source :

urpmi.addmedia test http://rpm.example.net/~mylogin/ with hdlist.cz

If it works, congratulations, you just created your first repository. If it doesn't work, check the server log.

[edit]

Providing an easy way to add your repository to a system

Now, your repository is here, but this is not easy to add it to a system running Mandriva Linux, as it requires typing commandline, and becoming root. However, since 10.1, you can add them quite easily, with a file on your website.

First, the file should be associated with the application/x-urpmi-media mimetype, and end with .urpmi-media extension. All you have to do is to add this to you apache configuration:

echo "AddType application/x-urpmi-media .urpmi-media" >> ~/public_html/.htaccess

Then, you place in the file the argument given to urpmi.addmedia, something like :

$ cat ~/public_html/example.urpmi-media 
test
http://rpm.example.net/~mylogin/
with
hdlist.cz
$ 

Then, by using a recent Mandriva Linux, you should be able to download the file, it will ask for the root passwd, and ask if you want to add this source to the urpmi configuration. Just click yes, and check that everything is working. If it doesn't work, check the file, as it should not have spaces at the beginning or the end of the lines.

[edit]

Managing your repository

In order to manage your project, some tools have been created by external contributors, such as jpackage ( http://jpackage.org ) and plf ( http://plf.zarb.org ). They have created the youri project in order to share the effort of managing a pool of rpms. You can find more information on the web page ( http://youri.zarb.org ). Do not hesitate to ask on the mailling list, even if it seems to be stopped, it is just the sign that code is working well. It is used in production by more important external projects without problems since some years.

Personal tools