Build your own LAMP Server under CentOS


Install MySQL

yum install mysql mysql-server

Startup MySQL, then go through the setup process

service mysqld start

You will be prompted for information during the install. Set your root password for the MySQL database at this time, also remove the anonymous user access and the test database.

Now we will add MySQL support for PHP. If you need certain packages installed you can browse the ones available through the yum repository by typing yum search php. This will output all the available packages, and you can search for the ones you need, or use my defaults listed below. The phpmysql is required to get the two working together, and the remainders are up to you based on your needs.

yum install php-mysql php-gd pnp-imap php-ldap php-mbstring php-obdc php-pear php-xml php-xmlrpc php-soap php-devel curl curl-devel ImageMagick libxml2 libxml2-devel

After install, restart Apache

service httpd restart

If you now go to the info.php page created earlier you will see the modules installed.


phpMyAdmin is not available through the yum repository, so we have to add the DAG package.

rpm --import

If installing on a 64bit system (x86_64) do

yum install

On 32bit (i386) use

yum install

Then install

yum install phpmyadmin

Configure to allow access remotely and not just from the localhost.

nano -w /etc/httpd/conf.d/phpmyadmin.conf

Change to look like the following for the section <Directory “/usr/share/phpmyadmin”>

#  Web application to manage MySQL

#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Now we edit the configuration to change from cookie to http:

nano -w /usr/share/phpmyadmin/

Locate and change the following in the file

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';

Restart Apache

service httpd restart

Now you can logon to phpMyAdmin via the browser (ie:

, ,