CentOS Web server with Latest Apache, PHP and MySQL

Setup perfect CentOS Web server with latest Apache, PHP and MySQL.

CentOS with Apache PHP MYSQL Webmin

Make sure you have installed CentOS with minimal system tools.

I am going to use my home directory as root folder.

cd ~

import RPM-GPG-KEY

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

Update Everything using YUM

yum -y update

Reboot your Server.

reboot

Install Some Required Packages

yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils

Setup System Time

yum install ntp
chkconfig ntpd on
ntpdate pool.ntp.org
/etc/init.d/ntpd start

Install RPMForge Repo

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm
 
yum clean all
yum update

Use Remi’s Repo for Latest PHP and MySQL

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Enable Remi’s Repo

nano /etc/yum.repos.d/remi.repo
 
[remi]
enabled=1

Install Apache and PHP Server

yum install httpd
chkconfig --levels 235 httpd on
yum install php php-mysql php-gd php-odbc php-pear php-xml php-xmlrpc curl perl-libwww-perl ImageMagick libxml2
 
## Edit Apache Configuration, if you need.
nano /etc/httpd/conf/httpd.conf

Install MySQL Server

yum install mysql mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
 
## Change your MySQL Password
mysql_secure_installation
 
## Check if MySQL is running
netstat -tap | grep mysql
 
## Edit MySQL Configuration, if you need.
nano /etc/my.cnf

Install eAccelerator – PHP Caching, Makes your php load faster

yum install php-eaccelerator

Install PhpMyAdmin

yum install phpmyadmin

Start Apache Server

service httpd restart

Check Apache

apachectl -M

Output

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 ...
Syntax OK

Check PHP

php -v

Output

PHP 5.3.6 (cli) (built: May 16 2011 19:18:00)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator

Web server with Latest PHP and MySQL is done!

Install Webmin if you want

yum install openssl perl-Net-SSLeay
rpm --import http://www.webmin.com/jcameron-key.asc

Add Webmin Repo

nano /etc/yum.repos.d/webmin.repo

Add This

[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1

Install Webmin

yum install webmin