How to Install LAMP Server on Centos/RHEL 6.X

LAMP Server on Centos/RHEL 6.X

Step 1: Install Apache

# yum -y install httpd httpd-devel

Start httpd Service

#/etc/init.d/httpd start

Edit httpd.conf file

# vi /etc/httpd/conf/httpd.conf

### Just Add this Line
#ServerName www.example.com:80
ServerName (ip address of server):80

--- Save & Quit (:wq) ---

Step 2: Go to /var/www/html and Make A HTML page

# vi index.html

Restart httpd Service:

#/etc/init.d/httpd restart

Step 3: Install MySQL Database Server

# yum -y install mysql mysql-server mysql-devel

Start Mysqld Service

# /etc/init.d/mysqld start

Changing MySQL Root Password:

# mysql
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('sql') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit

Check by logging:

#mysql -u root -p
Enter Password:

mysql> show databases;
++
| Database |
++
| information_schema |
| mysql |
++
2 rows in set (0.00 sec)

mysql> exit

Step 4: Install PHP5 Scripting Language

# yum -y install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml

Step 5: Create a file named /var/www/html/info.php

# vi /var/www/html/info.php

phpinfo();
?>

--- Save & Quit (:wq) ---

# /etc/init.d/httpd restart

Step 6: Then point your browser to http://ip address/info.php

http://(Your-IP/Hostname)/info.php

Step 7: Download this phpMyAdmin rpm

# cd /var/www/html
# wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.14/phpMyAdmin-4.0.10.14-all-languages.tar.gz

Extract the tar File & Rename it :

# tar -zxvf phpMyAdmin-4.0.10.14-all-languages.tar.gz
# ls
# mv phpMyAdmin-4.0.10.14-all-languages phpmyadmin
# ls

Edit the /etc/httpd/conf/httpd.conf File :

# vi /etc/httpd/conf/httpd.conf
Add those Lines :


Options +Indexes +Multiviews
DirectoryIndex index.php index.html
AllowOverride All
Allow from all

--- Save & Quit (:wq) ---

Rename the config.sample.inc.php File

# mv config.sample.inc.php config.inc.php

Step 8: Start the httpd & mysql Service on Boot & stop iptables & Disable the selinux

# chkconfig httpd on
# chkconfig mysqld on
# service iptables stop
# chkconfig iptables off
# setenforce 0

Point your browser to

http://(Your-IP/Hostname)/phpmyadmin

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.