LAMP INSTALLATION CENTOS-6.4

LAMP INSTALLATION CENTOS-6.4

In this post we’will discuss how to install apache2, mysql & php on centos-6.4

For Basic Installation Part you can use our earlier post on CENTOS-6.4 Installation http://how2install.in/index.php/linux-centos-distro-installation

Before proceeding the installation our server needs to be fully updated with latest repositories,

You can use this link (http://how2install.in/index.php/updating-centos-repository) to update yum repositories.

Now we assume your system is fully updated.

1. Installing Apache2

[root@centos ~]# yum install httpd 
It will simply install http server

[root@centos ~]# chkconfig --level 235 httpd on
To make it start automatically in case system reboots

[root@centos ~]#
/etc/init.d/httpd start
It will start http server, now we can check whether its working or not
 

apache-install

 

 

 

 

 

 

 In CentOS Apache’s default document Root is /var/www/html/

Main Configuration File Location is /etc/httpd/conf/httpd.conf

Remaining Configuration files are under /etc/httpd/conf.d  directory

2. Installing MYSQL Server & Client

[root@centos ~]# yum install mysql-server mysql 
-----------------------------
----------------------------
Total download size: 17 M
Installed size: 75 M
Is this ok [y/N]: y (Write y & press Enter)
----------------------------
----------------------------
Complete!


[root@centos ~]# chkconfig --levels 235 mysqld on
To make it Start automatically in case system reboots
[root@centos ~]# /etc/init.d/mysqld start
-----------------
-----------------
Starting mysqld: [ OK ]
  •  Now mysql is running & for basic configuration we have to follow below steps
[root@centos ~]# mysql_secure_installation 

Enter current password for root (enter for none): (Press Enter as we haven't set mysql root user password yet)
OK, successfully used password, moving on...

Set root password? [Y/n] (Press Enter)

New password: ENTER-PASSWORD
Re-enter new password: REPEAT-PASSWORD
Password updated successfully!
Reloading privilege tables..
... Success!


Remove anonymous users? [Y/n] (Press Enter to remove anonymous user, you can type n in case you don't want to remove anonymous user, But its better to remove it)

... Success!

Disallow root login remotely? [Y/n] (Press Enter only if you want root user to access the database from localhost only)

... Success!

Remove test database and access to it? [Y/n] (Press Enter to remove test database, which comes up by-default with mysql)

- Dropping test database...
... Success!

- Removing privileges on test database...
... Success!


Reload privilege tables now? [Y/n] (Press Enter)

... Success!
Cleaning up...


All done! If you've completed all of the above steps, your MySQL installation should now be secure.

Thanks for using MySQL!
  •  You can now check the same by login to database with root user & the password mentioned during installation
[root@centos ~]# mysql -u root -p 
Enter password: your-root-user-password
Welcome to the MySQL monitor.
Commands end with ; or \g. Your MySQL connection id is 13
Server version: 5.5.32 MySQL Community Server (GPL) by Remi
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

3. Installing PHP

[root@centos ~]# yum install php 

It will install php & to make it work we have to restart apache

[root@centos ~]# /etc/init.d/httpd restart

4. Testing PHP

  • To Test whether php is working propely or not, we’ll just add few lines in a text file & save it with .php
[root@centos ~]# vim /var/www/html/info.php

< ?php 
phpinfo();
?>

php

 

 

 

 

 

  

  • To have MYSQL Support in PHP, we have to install some more packages 
[root@centos ~]# yum install php-mysql 

[root@centos ~]# /etc/init.d/httpd restart

5. Installing phpmyadmin

[root@centos ~]# yum install phpMyAdmin
It will simply install phpMyAdmin 

By default phpMyAdmin is accessible from localhost only, to access it on the network you have to modify few parameters in below file

[root@centos ~]# vim /etc/httpd/conf.d/phpMyAdmin.conf
Just Comment below lines,then save & exit

#
# Apache 2.2
# Order Deny,Allow
# Deny from All
# Allow from 127.0.0.1
# Allow from ::1
#

[root@centos ~]# /etc/init.d/httpd restart
Now you can access it other than localhost
 

php-myadmin

 

 

 

 

 

 

  Just Login with desired username & password.

php-myadmin2

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.