Wednesday, April 21, 2010

Understanding The "yum.conf " and How Does It Like

So, what's a "yum.conf" can do?

yum.conf is where you can meet your specific needs and support your own local repositories. This is the route that will almost certainly be taken by most systems administrators who build their own repository. To do this, start by reading the yum.conf man pages that should have come with your distribution. Look over the default /etc/yum.conf that was installed by the RPM. Finally, browse through the additional examples below. Chances are pretty good that one of these will resources will provide a template that is adequate to get you started, and once you get things running at all a bit of experimentation will soon make you an expert. So let's look at a yum.conf file that is fairly minimal - just enough to get you started:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log

[fedora-core]
name = Fedora Core
baseurl=http://www.myserver.org/fedora/
gpgcheck=1
Systems persons who are building a fedora mirror as we proceed should note that this yum.conf uses the repository we ``built'' in the previous section, where of course the actual URL should point to that repository.   Users who want to accomplish the same thing could instead paste in an entry from the list of public yum repositories linked above.  For example, here is a yum.conf file containing several repositories from that list:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log

[fedora-stable-9]
name=Fedora Project Stable RPMS for RHL 9
baseurl=http://download.fedora.us/fedora/redhat/9/i386/yum/stable/
gpgcheck=1

[fedora-updates-9]
name=Fedora Project update RPMS for RHL 9
baseurl=http://download.fedora.us/fedora/redhat/9/i386/yum/updates/
gpgcheck=1

From the comments, one could hope that these two repositories contain what is effectively Red Hat 9, as ported into the Fedora project, plus updates. Note that we've turned on gpgcheck under the assumption that this is a good thing to do to ensure that the RPMs we grab haven't been trojanned.

Note that yum has many options that can be selected in the yum.conf file, only a few of which are illustrated in these examples. Each baseurl can have additional fallback repositories for additional stability and robustness. gpgchecking can be enabled (causing each rpm to be examined to ensure that it is correctly signed).

The debuglevel can be cranked up or down to help diagnose problems. pkgpolicy can be set to determine the order in which yum chooses to decide between two versions of the same package on different repositories it is using at the same time. Packages can be listed to exclude them from the automated update process.

The failover method yum uses to select a server to use from a list of servers in a baseurl can be chosen. More options may have been added since this article was written, or old options may have gone away.
 
So read the man pages on yum.conf. It is the only thing likely to be authoritative.
At this point we will assume that you are on a client, that you have a functional /etc/yum.conf installed that directs your system to a repository (that you built yourself or not) that is consistent with your system's existing RPM distribution, and that yum list works (as root) to list packages on the repository. Now let's see what yum can do.

Tuesday, April 20, 2010

CentOS php-common during updating PHP 5.2.13 version trouble

I went stumble with this php-common package which errs when I tried to install the PHP 5.2.13 version.

So what I did, I do the command

yum whatprovides php-curl
And the result gives me the following lines below:

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: p3plmirror02.prod.phx3.secureserver.net
* base: p3plmirror02.prod.phx3.secureserver.net
* extras: p3plmirror02.prod.phx3.secureserver.net
* turbopanel-base: p3plmirror02.prod.phx3.secureserver.net
* turbopanel-centos5: p3plmirror02.prod.phx3.secureserver.net
* update: p3plmirror02.prod.phx3.secureserver.net
addons | 951 B 00:00
addons/primary | 201 B 00:00
base | 2.1 kB 00:00
base/primary_db | 1.6 MB 00:00
extras | 1.1 kB 00:00
extras/primary | 107 kB 00:00
extras 325/325
turbopanel-base | 951 B 00:00
turbopanel-base/primary | 72 kB 00:00
turbopanel-base 494/494
turbopanel-centos5 | 951 B 00:00
turbopanel-centos5/primary | 2.1 kB 00:00
turbopanel-centos5 8/8
update | 1.9 kB 00:00
update/primary_db | 463 kB 00:00
php-common-5.1.6-23.2.el5_3.i386 : Common files for PHP
Repo : base
Matched from:
Other : php-curl



php-common-5.1.6-24.el5_4.5.i386 : Common files for PHP
Repo : update
Matched from:
Other : php-curl



php-common-5.3.2-1.i386 : Common files for PHP
Repo : installed
Matched from:
Other : Provides-match: php-curl


Indeed, I do have 5.3.2--the latest PHP release, as of this posting--but I do need yet 5.2 version because of incompatibilities with the code which has done thru a rigorous testing.

Since php-common has (-) dash inside the string, so I issue this command to remove the package php-common

yum remove php*5*3*
My main purpose of removing it was that, I installed the PHP 5.3 which is not the needed version of PHP I want, and php-common confuses the installation/update, indeed backward installation.

After this, installing PHP by issuing the command
yum --disablerepo=* --enablerepo=webtatic --exclude=php*5.3* install php

installs everything that I need. Notice the repository named "webtatic", I installed this repo from it's website, or read this link how did I grab it or you can also try this repo from remi


Issuing the command

php -v

shows

PHP 5.2.13 (cli) (built: Feb 28 2010 16:22:50)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
Hope this makes helpful.