Difference between revisions of "Createrepo"
m |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[System administration tools]] > [[Package management tools]] > [[Createrepo|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: | 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 rpmfusion, rpmforge and epel repositories | ||
*Install createrepo package using '<tt>yum -y install createrepo</tt>' | *Install createrepo package using '<tt>yum -y install createrepo</tt>' | ||
*Configure yum to keepcache for current server by making '<tt>keepcache="1"</tt>' | *Edit '<tt>/etc/yum.conf</tt>' as follows: | ||
* | ** Configure yum to keepcache for current server by making '<tt>keepcache="1"</tt>' | ||
*For each folder in /var/ | ** Configure yum to store cache in /var/www/html by making '<tt>cachedir=/var/www/html/$basearch/$releasever</tt>' | ||
**Go to /var/ | *For each folder in /var/www/html/x86_64/6 such as base, epel, etc. do following: | ||
**Go to /var/www/html/x86_64/6/<folder_name>/packages | |||
**Run '<tt>createrepo -c cache_dir --update .</tt>' | **Run '<tt>createrepo -c cache_dir --update .</tt>' | ||
*Create repository configuration file 'local.repo' with following contents: | *Create repository configuration file 'local.repo' with following contents: | ||
Line 88: | Line 88: | ||
For all new packages following steps can be used: | For all new packages following steps can be used: | ||
*yum -y install <package> on repository server | *yum -y install <package> on repository server | ||
*For each folder in /var/www/html/x86_64/6 such as base, epel, etc. do following: | |||
*For each folder in /var/ | **Go to /var/www/html/x86_64/6/<folder_name>/packages | ||
**Go to /var/ | |||
**Run '<tt>createrepo -c cache_dir --update .</tt>' | **Run '<tt>createrepo -c cache_dir --update .</tt>' | ||
Line 98: | Line 97: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[System administration tools]] > [[Package management tools]] > [[Createrepo|createrepo]] |
Latest revision as of 12:18, 28 July 2022
Home > CentOS > CentOS 6.x > System administration tools > Package management tools > 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'
- Edit '/etc/yum.conf' as follows:
- Configure yum to keepcache for current server by making 'keepcache="1"'
- Configure yum to store cache in /var/www/html by making 'cachedir=/var/www/html/$basearch/$releasever'
- For each folder in /var/www/html/x86_64/6 such as base, epel, etc. do following:
- Go to /var/www/html/x86_64/6/<folder_name>/packages
- Run 'createrepo -c cache_dir --update .'
- Create repository configuration file 'local.repo' with following contents:
[local-base] name=RHEL - repo.<organization>.com - base baseurl = http://repo.<organization>.com/x86_64/6/base/packages/ enabled = 1 gpgcheck = 0 keepcache = 0 metadata_expire = 0 [local-epel] name=RHEL - repo.<organization>.com - epel baseurl = http://repo.<organization>.com/x86_64/6/epel/packages/ enabled = 1 gpgcheck = 0 keepcache = 0 metadata_expire = 0 [local-extras] name=RHEL - repo.<organization>.com - extras baseurl = http://repo.<organization>.com/x86_64/6/extras/packages/ enabled = 0 gpgcheck = 0 keepcache = 0 metadata_expire = 0 [local-rpmforge] name=RHEL - repo.<organization>.com - rpmforge baseurl = http://repo.<organization>.com/x86_64/6/rpmforge/packages/ enabled = 1 gpgcheck = 0 keepcache = 0 metadata_expire = 0 [local-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 gpgcheck = 0 keepcache = 0 metadata_expire = 0 [local-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 gpgcheck = 0 keepcache = 0 metadata_expire = 0 [local-updates] name=RHEL - repo.<organization>.com - updates baseurl = http://repo.<organization>.com/x86_64/6/updates/packages/ enabled = 1 gpgcheck = 0 keepcache = 0 metadata_expire = 0
- Replace <organization> with organization name everywhere. Ensure that repo.<organization>.com points to repository server being configured using /etc/hosts or DNS
- Copy local.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
The purpose of various options in repository configuration file is:
- name
- This is used to give a description name to repository
- baseurl
- Location where repository is located
- enabled
- Use this repository for yum updates. Hence enabled=1.
- gpgcheck
- Check signature on packages. Since all packages have been signed using different keys and already been verified when they are downloaded on repository machine using yum, we do not need to check signatures again. Hence gpgcheck=0
- metadata_expire
- How long to wait before reconnecting to repository server to get fresh list of packages. For local repository it can be set to 0 so that for every yum update fresh metadata is used.
To install package only using local repository use:
yum -y install <package> --disablerepo='*' --enablerepo='local*'
Updating repository with new packages
For all new packages following steps can be used:
- yum -y install <package> on repository server
- For each folder in /var/www/html/x86_64/6 such as base, epel, etc. do following:
- Go to /var/www/html/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.
Home > CentOS > CentOS 6.x > System administration tools > Package management tools > createrepo