Oct 31, 2007

Centos: Habilitando repositorio en centos 4

En la página oficial de centos encontré una manera de habilitar repositorios:

The CentOSPlus Repository

The CentOSPlus repository contains packages that are upgrades to the packages in the CentOS base + CentOS updates repositories. These packages are not part of the upstream distribution and extend CentOS's functionality at the expense of upstream compatibility. Enabling this repository makes CentOS different from upstream. You should understand the implications of this prior to enabling CentOSPlus. Here is the CentOSPlus Readme file for CentOS 4 and CentOS 5. You should also browse the CentOSPlus directory for CentOS 4 or CentOS 5 on our mirrors for the architecture you intend to use.

The CentOSPlus repository contains a group of packages, all of which are updates. You probably do not want to enable CentOSPlus as a whole, but instead want to pick the exact packages that you want to use.

Note: The CentOSPlus repository also contains the CentOS Web Stack. If you are interested in upgrading to the CentOS Web Stack please see this page instead. The CentOS Web Stack contains updates to Apache (httpd) 2.0.58, MySQL 5.0, PostgreSQL 8.1, Perl 5.88, mod_perl 2, PHP 5.1.6, and ODBC.

For example, you may want php-5.x and mysql-5.x from CentOSPlus but you may not want the postfix with mysql_pgsql capability, the kernel with unsupported items turned on, etc. Prior to enabling the CentOSPlus repository you should read about the includepkgs= and/or exclude= options in yum. To read about these options use this command at the command line:

man yum.conf

Enabling the CentOSPlus repository

To enable the CentOSPlus repository, edit the file /etc/yum.repos.d/CentOS-Base.repo and look for the [centosplus] section. Here is how it looks by default:

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4 <== -CentOS-5 in CentOS5

Example 1: (CentOS 4) We want the new CentOSPlus postfix with mysql_pgsql support. Here is how to setup /etc/yum.repos.d/CentOS-Base.repo:

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
includepkgs=postfix-*
exclude=postfix-*plus*

Note: If you want to use postfix compiled for the CentOS Web Stack versions of pgsql and mysql, you would not need the "exclude=postfix-*plus*"

You would also want to add this to both the [base] and [update] sections of /etc/yum.repos.d/CentOS-Base.repo, so as not to get postfix packages from there anymore:

exclude=postfix-*

Example 2: We want to use CentOSPlus kernel to be able to use the jfs or reiserfs file system and the creation tools. We would edit /etc/yum.repos.d/CentOS-Base.repo and modify the following in the [centosplus] section:

enabled=1
includepkgs=kernel* jfsutils reiserfs-utils

In the [base] and [update] section you would do the following:

exclude=kernel kernel-devel kernel-smp-* kernel-hugemem* kernel-largesmp*  (CentOS 4 only)
exclude=kernel kernel-devel kernel-PAE-* (CentOS 5 only)

Note: If you want to use the XFS file system there are kernel modules to do that, so see examples 3 and 4.


Example 3: We want to use the XFS file system with the regular kernel ... this does not require the CentOSPlus repo at all, you would just do this:

yum list available kmod-xfs\*

The results would be something like this:

Available Packages
kmod-xfs.i686 0.4-1.el4.2.6.9_55.0.9 extras
kmod-xfs-hugemem.i686 0.4-1.el4.2.6.9_55.0.9 extras
kmod-xfs-smp.i686 0.4-1.el4.2.6.9_55.0.9 extras
kmod-xfs-xenU.i686 0.4-1.el4.2.6.9_55.0.9 extras

I would then pick the module that I need ... in my case kmod-xfs-smp.i686 and install it with this command:

yum install kmod-xfs-smp.i686 xfsdump xfsprogs

Note: The kernel module also has dmapi support, so you can add dmapi to the above install line if you want to use it. XFS usage details are beyond the scope of this page.


Example 4: We already have the CentOSPlus kernel (for a different reason ... otherwise see example 3) AND we want to add XFS filesystem. We would edit /etc/yum.repos.d/CentOS-Base.repo and modify the following in the [centosplus] section:

enabled=1
includepkgs=kernel* xfs* dmapi*

In the [base] and [update] section you would do the following:

exclude=kernel kernel-devel kernel-smp-* kernel-hugemem* kernel-largesmp*  (CentOS 4 only)
exclude=kernel kernel-devel kernel-PAE-* (CentOS 5 only)

In the [extras] section you would do the folowing:

exclude=xfs* kmod-xfs* dmapi*

yum-plugin-priorities

Another way to protect your system from updates from the CentOSPlus repository is to use the yum-plugin-priorities plugin. This is the recommended method. Follow the instructions shown in the link and set up yum-plugin-priorites. Edit /etc/yum.conf and add this line:

plugins=1

You would set priorities in /etc/yum.repos.d/CentOS-Base.repo like this:

[base]
exclude=foo bar
priority=1

[update]
exclude=foo bar
priority=1

[centosplus]
enable=1
priority=2

This will make the [base] and [update] repositories have higher priority over the [centosplus] repository, so the only items in CentOSPlus that will update either [base] or [update] are items that are excluded from those repositories with an exclude= setting.

Therefore, using yum-plugin-priorities allows you to skip setting up the includepkgs= for the [centosplus] section of CentOS-Base.repo, but it still only allows updates of packages that you exclude= from the [base] and [update] repositories.


Summary

Using the CentOSPlus repository is more dangerous than using other CentOS repositories, as it is designed to have several updated packages and it is not really designed to be completely enabled.

You can use all the packages in CentOSPlus, but normally one will pick only the packages they are looking for and use exclude= and includepkgs= (or exclude= and yum-plugin-priorities) to load only those packages from the CentOSPlus repository.

Please ensure that you understand all these concepts before you use the CentOSPlus repository.

No comments:

Post a Comment