Quantcast
Channel: TheTechnicalstuff » Installation
Viewing all articles
Browse latest Browse all 10

Install, configure and setup LAMP(Linux, Apache, Mysql and PHP) environment in Redhat/Centos Linux

$
0
0

Install, configure and setup LAMP(Linux, Apache, Mysql and PHP) environment in Redhat/Centos Linux

LAMP environment is a combination of Linux, Apache, Mysql and Php. Now a days most of the successful website are runs under LAMP environment in internet. It is totally free and easy to setup LAMP environment in linux.

 

Install, configure and setup LAMP(Linux, Apache, Mysql and PHP) environment in Redhat/Centos Linux

 

Okay friends I don’t want you to wait. Lets start install and configure LAMP(Linux, Apache, Mysql and PHP) environment in Redhat/Centos Linux.

Step 1: Install Redhat or Centos Linux server.

Initially we need a Linux server to setup LAMP environment, so install Redhat or Centos linux server and make it ready to connect to the internet. In this example I am using Redhat linux.

Step 2: Install and configure Apache(httpd) webserver.

Then we need to install and configure apache webserver in linux. We have already seen how to install and configure apache webserver in linux.

I have copied all my RPM files from Redhat/Centos DVD to local path /var/ftp/pub/Server/ and configured Yum repository Server.

Install apache using rpm command

rpm -ivh httpd-2.2.3-11.el5.i386.rpm
rpm -ivh httpd-devel-2.2.3-11.el5.i386.rpm
rpm -ivh httpd-manual-2.2.3-11.el5.i386.rpm

Install apache using Yum repository server use below command

yum install httpd-*

Verify that apache is installed or not using below command

rpm -qa | grep -i httpd-

Verify the apache version using following command

httpd -v

The configuration file of apache is “/etc/httpd/conf/httpd.conf”. Open the apache configuration file and copy the last 7 lines and paste at the end of the file. Then unhash the first 3 line and last line. First add domain name or IP address in virtualhost line then add email ID in serveradmin line then finally add the pointed document root path in the document root line. Add your php content in to the document root location.

<VirtualHost example.com:80>
ServerAdmin admin@tts.com
DocumentRoot /var/www/html/ftpuser
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

Once every thing is done save the file and restart the httpd service.

/etc/init.d/httpd restart

or

service httpd restart

Check the apache service is running or not using netstat command

netstat -ntpl | grep -i http

Step 3: Install and configure Mysql in linux

Then install Mysql 5.1 or 5.5 in linux server. In our earlier blog we have seen about how to install mysql5.1 and 5.5 in linux.

Step 1: Download the remi repository rpm using following command.
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Step 2: Install the remi repository rpm.
rpm -ivh remi-release-5.rpm

If it show some dependency error then fire below command
rpm -ivh remi-release-5.rpm –nodeps

Step 3: Check required mysql packages are available.
yum –enablerepo=remi  list all | grep mysql

Step 4: Install the required mysql5.1 packages.
yum –enablerepo=remi install mysql.i386  mysql-devel.i386  mysql-embedded.i386  mysql-embedded-devel.i386 mysql-libs.i386 mysql-server.i386 mysql-test.i386

Step 5: Verify the mysql version.
mysql -V

Start mysql service

/etc/init.d/mysqld start

or

service mysqld start

Add password to the root user
mysqladmin -u root password mysql

Login in to the mysql server
mysql -u root -pmysql

Check mysql service is running or not using netstat command

netstat -ntpl | grep -i http

Step 4: Install php5.3 in linux.

If your website is developed with php language we have to install php rpm in linux. We have already seen about how to install php 5.3 in linux.

Step 1: Check the availablity of php package.
yum list all | grep -i php53

Step 2: Install the php package using yum command.
yum install php53.x86_64 php53-common.x86_64  php53-cli.x86_64 php53-devel.x86_64 php53-mysql.x86_64 php53-ldap.x86_64 php53-odbc.x86_64

Step 3: Verify the installed php version.
php -v

Step 5: Install and configure FTP to transfer files between client and server

Client will have all the php and mysql data with them self. To transfer the data from client machine to server we need to install and configure FTP in linux.We have published a post regarding how to install, configure and setup FTP server in linux already.

Install vsftpd and ftp rpm files

rpm -ivh vsftpd-3.0.2-1.el5.i386.rpm
rpm -ivh ftp-0.17-33.fc6.i386.rpm

Command to verify ftp version
vsftpd -v

Start ftp service

/etc/init.d/vsftpd start

Another Method

service vsftpd restart

Check the ftp service is running or not using netstat command

netstat -ntpl | grep -i http

Every thing is done apache, mysql, php and ftp server are installed, configured and live. Now the data has to copied from the client machine to server. Hence client needs user credentials to transfer the data to server. Add a ftp user in folder “/var/www/ftpuser” because which is pointed in document root in apache webserver.

useradd -d /var/www/html/ftpuser ftpuser
password ftpuser

Restart apache once

/etc/init.d/httpd restart

That’s it LAMP(Linux, Apache, Mysql and PHP) setup is  done and the site is up and live.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images