How to configure repos to not overwrite base packages?

The greatest fear with adding additional and especially third party repos such as EPEL (we did a blog post on how to install EPEL earlier) is that it MAY overwrite base packages and bring the system to an unstable state.

We can fix this issue by installing Yum Priorities plugin

on CentOS 5:

yum install yum-priorities

on CentOS 4 or CentOS 6:

yum install yum-plugin-priorities

Then make sure that the plugin is enabled

nano /etc/yum/pluginconf.d/priorities.conf

Now there are two ways to do it, either set HIGHEST priority to CentOS repos OR set lowest priority to other repos. This is done by adding the line

# N=1 highest priority
# N=99 lowest priority
priority=N

In this blog post, I will set 1 as the priority (highest) for my CentOS Base repo

nano /etc/yum.repos.d/CentOS-Base.repo

So that it becomes

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
...
...
...

Other repos do not need updating since I have assigned CentOS repos with the highest priority. The default priority for repositories is 99.

Build-Essentials in CentOS?

If you are like me, you may be doing this to install essential build libraries to compile something from source

# wrong method
yum install build-essential

🙂 Build essential is a Ubuntu / Debian package. On CentOS, you need to do this

yum groupinstall "Development Tools"

Warning: This will install all development tools approx 49 packages closing to 65MB

To update or not to update?

All my technical life, I knew and followed this simple rule

New updates to any application or component are meant to improve and fix the bugs present in it. Downloading new updates ensures that you system is up-to-update, has fixes to all those bugs you have been getting annoyed with and more stable.

Unfortunately not every IT department thinks that, especially the one I am facing at work. According to them, the new updates should only be applied IF and only IF they offer some new functionality (duhh!). Hello! what happened to the bug-fixes that are promised with these updates?

Continue reading

CentOS yum update missing dependency error

If you are using

yum update

on CentOS and getting the following errors

Missing Dependency: /usr/lib/python2.4 is needed by package libxml2-python-2.6.26-2.1.2.7.i386 (installed)
gamin-python-0.1.7-8.el5.i386 from installed has depsolving problems
Missing Dependency: /usr/lib/python2.4 is needed by package gamin-python-0.1.7-8.el5.i386 (installed)
Error: Missing Dependency: /usr/lib/python2.4 is needed by package libxml2-python-2.6.26-2.1.2.7.i386 (installed)
Error: Missing Dependency: /usr/lib/python2.4 is needed by package gamin-python-0.1.7-8.el5.i386 (installed)

Don’t panic, the solution is simple … just run the following command

yum clean all

Then do

yum update

Installing PHP 5.2.6 on CentOS box

If you want to install PHP 5.2.x instead of the PHP 5.1.6 offered with default CentOSPlus repo. Please consider installing the utterramblings repo. Setting up this repo is a breeze … just follow these steps

Continue reading

How to Install Apache, PHP and MySQL on CentOS

I have seen people installing Apache, PHP and MySQL from source code on a production server. You should NEVER, NEVER, NEVER install these packages from source on an RPM or DEB based Linux distributions. Did I say “NEVER” enough times to make your realize that it is not a good practice?

Installing from source is bad idea; there are many reasons for this but the major one is that you will be spending a lot of time keeping the system updated. If you love installing from source then I would suggest using a different distribution e.g. Gentoo.

You can build from source if the package is not available in yum but still, try to use “yum” (or “apt-get” on Ubuntu) because it will save a lot of your time when upgrading your packages.

Continue reading