How to Install Lamp on Centos 7


Install Lamp on Centos 7
1. Install Apache:

# yum -y install httpd httpd-devel

2. Edit httpd.conf file:

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

add this last line-
RewriteEngine on
CheckCaseOnly On

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

3. make logs directory:

# mkdir /logs

4. Go to /var/www/html :


# vi index.html

Make A HTML
add those line...

<html>
<marquee direction="left">
<font size="12" color="red">
!!!....Restricted zone....!!!
</font>
</marquee>
</html>

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

5. Install MySQL Database Server:

# yum install wget
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# yum install -y mysql-server mysql mysql-devel

6. Start Mysqld Service:

# systemctl restart mysqld

7. Changing MySQL Root Password:


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

8. Check by logging in:


# mysql -u root -p
Enter Password: <your new password>


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


mysql> exit

9. Install PHP5 Scripting Language:

# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

# yum install -y  php56w php56w-cli php56w-mysql php56w-pdo php56w-pecl-memcache php56w-xml php56w-imap php56w-mbstring php56w-mcrypt php56w-common php56w-fpm       php56w-odbc php56w-devel  php56w-xmlrpc php56w-soap php56w-pecl-igbinary php56w-pdo php56w-ldap php56w-xml php56w-imap php56w-pear php56w-gd

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


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


<?php
  phpinfo();
?>

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

11. Restart Apache to load php:

# systemctl restart httpd

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


Ex- http://192.168.72.249/info.php

13. Download this phpMyAdmin rpm:


# cd /var/www/html
# wget https://files.phpmyadmin.net/phpMyAdmin/4.4.10/phpMyAdmin-4.4.10-english.tar.gz

14. Extract the tar File & Rename it :


# tar -zxvf phpMyAdmin-4.4.10-english.tar.gz
# mv phpMyAdmin-4.4.10-english phpmyadmin

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


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

Add those Lines : (line number 158)
<Directory /var/www/html/phpmyadmin>
    Options  -Indexes +Multiviews +FollowSymLinks
        DirectoryIndex index.php index.html
    AllowOverride All
    Allow from all
</Directory>

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

16. Rename the config.sample.inc.php File :

#cd /var/www/html/phpmyadmin

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

17. Now needs a secret passphrase (blowfish_secret):


# vi /var/www/html/phpmyadmin/config.inc.php


$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Just Add Password - $cfg['blowfish_secret'] = 'Your Password but wrong pass'


$cfg['blowfish_secret'] = 'wron pass'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

$cfg['Servers'][$i]['host'] = 'MySQL_Server_Name'; ← Database Server Hostname.

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

18. Start the httpd & mysql Service & stop iptables :

# systemctl enable httpd
# systemctl enable mysqld
# systemctl stop firewalld.service

and stop selinux

19. Point your browser to: http://ip.address/phpmyadmin :


ex- http://192.168.72.249/phpmyadmin
User Name: root
Password: Mysql_Password

---- DONE,Thanks ----