You may have heard of a server system called LAMP, and wondered what it is. Well, the answer is that LAMP isn’t any one thing on its own – it’s actually a combination of four technologies. Together, the LAMP technologies form the most popular overall server system on the web today. LAMP is short for Linux, Apache, MySQL, PHP. This will guide you to install LAMP server on your Linux System.
Note: I assume that, we have server1.linuxarticles.org with 192.168.100.1 IP on CentOS 5.x. You might have to replace them where appropriate.
STEP 1: Installation of Apache on Linux,
# yum install httpd -y
# chkconfig – -levels 235 httpd on
# service httpd restart
Basic Apache Installation is done…!
# firefox http://192.168.100.1
You will see Apache Test page.
Note: Apache’s default configuration file is located at /etc/httpd.conf/httpd.conf. You can do changes as per your requirement.
STEP 2: Install MySQL,
# yum install mysql* -y
This command will install all required rpms for MySQL. Start MySQL,
# service mysqld start ; chkconfig mysqld on
If you want to change root password, follow below steps:
# mysqladmin -u root password mysqlpwd
# mysqladmin -h server1.linuxarticles.org -u root password mysqlpwd
STEP 3: Install PHP with MySQL support,
# yum install php* -y
This will install all required rpms along with PHP-GD, MySQL support. Finally test PHP with Apache,
# cd /var/www/html
# cat > index.php
<?php
phpinfo();
?>
# service httpd restart
# firefox http://server1.linuxarticles.org/index.php
If you have installed all required packages with correct configuration, you will see PHP version information.
phpMyAdmin is one of my favorite web interface for MySQL or you can install MySQL Workbench to manage Database.
To Install phpMyAdmin, you need to first install RPMforge repository as it is not available in CentOS repository.
For 64bit,
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
For 32 bit,
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Now, you can Install phpMyAdmin using,
# yum install phpmyadmin -y
So, we have installed phpMyAdmin but need to configure Apache to use phpMyAdmin.
# vim /etc/httpd/conf.d/phpmyadmin.conf
#
#  Web application to manage MySQL
#
<Directory “/usr/share/phpmyadmin”>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
Alias /mysqlweb         /usr/share/phpmyadmin
Save and exit the file.
# service httpd restart
Open /usr/share/phpmyadmin/config.inc.php and edit
# vim /usr/share/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['auth_type'] = ‘http’;
# /etc/init.d/httpd restart
Afterwards, you can access phpMyAdmin at http://192.168.100.1/mysqlweb.

Related Articles: