In order to install extra packages like PHP, MySQL and other cool stuff in RHEL based distros like CentOS, it’s usually a pretty good idea to configure Yum to make use of the EPEL repository. EPEL stands for Extra Packages for Enterprise Linux.
CentOS 5.x
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm sudo rpm -Uvh epel-release-5*.rpm rm epel-release-5*
CentOS 6.x
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm sudo rpm -Uvh epel-release-6*.rpm rm epel-release-6*
The rm command at the end is optional, it just removes the downloaded .rpm file as it’s no longer needed.
Output from running the command below will verify a successful installation.
ls -1 /etc/yum.repos.d/epel*
As so..
/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo