User Tools

Site Tools


create_your_repository

This is an old revision of the document!


Create your repository

The purpose of this HowTo is to make your own repository to share RPM that your are developing for our marvellous project. I use a CentOS server to host my repository mirror.de-labrusse.fr<br />

In a first time you have to parameter a web area where you can upload packages, you can do it by many ways, it is not the purpose of this howTo.

Repository Architecture

A repository is made with a special architecture which becomes from CENTOS/REDHAT that we need to make.

For example this is the path of my web area, you need to adapt it to your configuration.

mkdir -p /var/www/vhosts/myrepo.xxx/mirror/smeserver/5/{SRPMS,noarch,i386,x86_64}
mkdir -p /var/www/vhosts/myrepo.xxx/mirror/smeserver/6/{SRPMS,noarch,i386,x86_64}

SME Server 8 = Centos5

SME Server 9 = Centos6

Upload RPM to Web Folder

The manner to upload packages to your repository could be done by many ways, “rsync, scp, ftp…” you have to find your manner. After that you could see packages in browsing your web area, if it is not the case, you may see if the parameter below is included in your httpd VirtualHost.

Options +Indexes

Of course you must respect the architecture of the rpm you have builded, you need to upload noarch.rpm to noarch, src.rpm to SRPMS, i386 to i386 and x86_64.rpm to x86_64

Create repository metadata

you need to install a package named createrepo. See [http://docs.fedoraproject.org/en-US/Fedora/14/html/Software_Management_Guide/Gesti%C3%B3n_avanzada_de_repositorios_yum.html Here] for more documentation on createrepo

yum install createrepo

each time you upload a package you have to launch the createrepo command, you can do it in a cron or else do it manually.

createrepo -dvp  /var/www/vhosts/myrepo.xxx/mirror/smeserver/5
createrepo -dvp  /var/www/vhosts/myrepo.xxx/mirror/smeserver/6

you can do something like that in your crontab

crontab -e

 */30    *       *       *       *       createrepo -dvp  /var/www/vhosts/myrepo.xxx/mirror/smeserver/5
 */31    *       *       *       *       createrepo -dvp  /var/www/vhosts/myrepo.xxx/mirror/smeserver/6

Create Repoview

Additionally you can make a nice view for you repository, it is not a mandatory

yum install repoview

then make a cron like above

*/35    *       *       *       *       repoview  /var/www/vhosts/myrepo.xxx/mirror/smeserver/5
*/36    *       *       *       *       repoview  /var/www/vhosts/myrepo.xxx/mirror/smeserver/6

Clean Your repository

first we need to install yum-utils, take a look to the documentation, it is really interesting

yum install yum-utils

Now we will use repomanage, this command is only made to list either old or new package, matter of choice.

repomanage --keep=2 --old /var/www/vhosts/de-labrusse.fr/mirror/smeserver

or

repomanage --keep=1 --new /var/www/vhosts/de-labrusse.fr/mirror/smeserver

here I want to list and keep only two versions of each rpm. Put this command in a cron job

rm $(repomanage --keep=2 --old /var/www/vhosts/de-labrusse.fr/mirror/smeserver) -rf

Sign your RPM

Now we can sign package before to upload them, it is an additional way to increase security for people who will download your rpm. You can see this wiki page Sign_your_RPM

Declare your repository on the client side

This is how you need to allow your repository on the client side, on each SME Server which wants to reach your repository.

Copy the configuration setting to your server as is, do not modify anything as that might harm your installation. To use it to install package enable it using the option '–enablerepo=FOO' at the SME Server shell. Below you find the installation command for the pagename repository which can be entered on the SME Server shell.

db yum_repositories set '''FOO''' repository \
BaseURL http://myrepo.xxx/smeserver/\$releasever \
EnableGroups no GPGCheck yes \
Name "Mirror FOO" \
GPGKey http://myrepo.xxx/RPM-GPG-KEY \
Visible yes status disabled

After adding it to the database updating the configuration file is required:

signal-event yum-modify

for nethserver/centos you can take example on the rpm I made

create_your_repository.1430686871.txt.gz · Last modified: 2019/06/05 21:48 (external edit)