Build your own LAMP Server under CentOS


MySQL

Install MySQL

yum install mysql mysql-server

Startup MySQL, then go through the setup process

service mysqld start
mysql_secure_installation

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 php-mysql 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

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

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

If installing on a 64bit system (x86_64) do

yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

On 32bit (i386) use

yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

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 127.0.0.1
#

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/config.inc.php

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: http://192.168.1.200/phpmyadmin/)


Posted

in

, ,

by