Createrepo
From Notes_Wiki
<yambe:breadcrumb>Package_management_tools|Package management tools</yambe:breadcrumb>
createrepo
A local yum repository server can be setup to allow caching of packages locally for various clients. To configure local repository server following steps can be used:
- Install rpmfusion, rpmforge and epel repositories
- Install createrepo package using 'yum -y install createrepo'
- Configure yum to keepcache for current server by making 'keepcache="1"' in /etc/yum.conf
- Rsync /var/cache/yum to /var/www/html (or appropriate document root folder for web server)
- For each folder in /var/cache/yum/x86_64/6 such as base, epel, etc. do following:
- Go to /var/cache/yum/x86_64/6/<folder_name>/packages
- Run 'createrepo -c cache_dir --update .'
- Create repository configuration file '<organization>.repo' with following contents:
[<organization>-base] name=RHEL - repo.<organization>.com - base baseurl = http://repo.<organization>.com/x86_64/6/base/packages/ enabled = 1 protect = 0 gpgcheck = 0 keepcache = 0 [<organization>-epel] name=RHEL - repo.<organization>.com - epel baseurl = http://repo.<organization>.com/x86_64/6/epel/packages/ enabled = 1 protect = 0 gpgcheck = 0 keepcache = 0 [<organization>-extras] name=RHEL - repo.<organization>.com - extras baseurl = http://repo.<organization>.com/x86_64/6/extras/packages/ enabled = 0 protect = 0 gpgcheck = 0 keepcache = 0 [<organization>-rpmforge] name=RHEL - repo.<organization>.com - rpmforge baseurl = http://repo.<organization>.com/x86_64/6/rpmforge/packages/ enabled = 1 protect = 0 gpgcheck = 0 keepcache = 0 [<organization>-rpmfusion-free-updates] name=RHEL - repo.<organization>.com - rpmfusion-free-updates baseurl = http://repo.<organization>.com/x86_64/6/rpmfusion-free-updates/packages/ enabled = 1 protect = 0 gpgcheck = 0 keepcache = 0 [<organization>-rpmfusion-nonfree-updates] name=RHEL - repo.<organization>.com - rpmfusion-nonfree-updates baseurl = http://repo.<organization>.com/x86_64/6/rpmfusion-nonfree-updates/packages/ enabled = 1 protect = 0 gpgcheck = 0 keepcache = 0 [<organization>-updates] name=RHEL - repo.<organization>.com - updates baseurl = http://repo.<organization>.com/x86_64/6/updates/packages/ enabled = 1 protect = 0 gpgcheck = 0 keepcache = 0
- Replace <organization> with organization name everywhere. Ensure that repo.<organization>.com points to repository server being configured using /etc/hosts or DNS
- Copy this <organization>.repo file to some other machine at /etc/yum.repos.d/ Do not use the repository on same machine else /var/cache/yum of this machine would have additional folders for the same machines repository.
- Try to use yum and verify that local repository is visible
Updating repository with new packages
For all new packages following steps can be used:
- yum -y install <package> on repository server
- rsync /var/cache/yum/ to /var/www/html/
- For each folder in /var/cache/yum/x86_64/6 such as base, epel, etc. do following:
- Go to /var/cache/yum/x86_64/6/<folder_name>/packages
- Run 'createrepo -c cache_dir --update .'
Securing setup using HTTPS
The setup can be secured by using HTTPS certificates and by change baseurl to https://. For self-signed certificates refer to easy-rsa to learn how to create certificates and also to learn how to add certificate to host so that yum can use it.
<yambe:breadcrumb>Package_management_tools|Package management tools</yambe:breadcrumb>