Install LAMP server in CentOS 6.4 / RHEL 6.4
LAMP is a short form of Linux, Apache, MySQL and PHP. In this tutorial i will show you how to install LAMP server in CentOS 6.4. My testbox hostname and IP Address are “server.unixmen.com” and “192.168.1.200/24″ respectively.
[root@server ~]# yum install httpd -y
Start Apache and make it to start automatically on every reboot.
[root@server ~]# /etc/init.d/httpd start [root@server ~]# chkconfig httpd on
Open your Browser and Enter “http://192.168.1.200″. Now you will see the Apache home page.
[root@server ~]# yum install mysql mysql-server -y
Start the MySQL service and make to start automatically on every reboot.
[root@server ~]# /etc/init.d/mysqld start [root@server ~]# chkconfig mysqld on
Setup MySQL root password
[root@server ~]# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ## Press Enter ## OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] ## Press Enter ## New password: ## Enter new password ## Re-enter new password: ## Re-enter new password ## Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ## Press Enter ## ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ## Press Enter ## ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] ## Press Enter ## - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. 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!
[root@server ~]# yum install php -y
Restart Apache server
[root@server ~]# /etc/init.d/httpd restart
Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below.
[root@server ~]# vi /var/www/html/testphp.php <?php phpinfo(); ?>
Now open the testphp.php file in browser using http://192.168.1.200/testphp.php. It will display the details about php package.
If you wanna to get MySQL support in your PHP, you should install “php-mysql” package. If you want to install all php modules just you use the command “yum install php*”
[root@server ~]# yum install php-mysql -y
Now open the phptest.php file in your browser using http://192.168.1.200. Scroll down and you will see the mysql module will be presented there.
phpMyAdmin is a free open source web interface tool, used to manage your MySQL databases. By default phpMyAdmin is not found in CentOS official repositories. So let us install it using EPEL repository.
Download and install EPEL Repository first.
[root@server ~]# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm [root@server ~]# rpm -ivh epel-release-6-8.noarch.rpm
Now install phpMyAdmin
[root@server ~]# yum install phpmyadmin -y
Open the phpmyadmin.conf file and make the changes as shown below.
[root@server ~]# vi /etc/httpd/conf.d/phpMyAdmin.conf Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin ## Comment the following Section ## #<Directory /usr/share/phpMyAdmin/> # <IfModule mod_authz_core.c> # # Apache 2.4 # <RequireAny> # Require ip 127.0.0.1 # Require ip ::1 # </RequireAny> # </IfModule> # <IfModule !mod_authz_core.c> # # Apache 2.2 # Order Deny,Allow # Deny from All # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> #</Directory>
Open the “config.inc.php” file and change from “cookie” to “http” to change the authentication in phpMyAdmin.
[root@server ~]# cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php [root@server ~]# vi /usr/share/phpMyAdmin/config.inc.php /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'http';
Restart the Apache service.
[root@server ~]# /etc/init.d/httpd restart
Now you can access the phpmyadmin console using http://ipaddress or domainname/phpmyadmin/.
Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “centos”.
Now you will get the phpmyadmin page as shown below.
Thats it. Now the LAMP server is up and running.
Like us on Facebook
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Twelve Vulnerabilities Have Been Fixed In Ubuntu 12.04, Time To Update : Canonical has released security updates for Ubuntu 12.04 LTS and advices to update your system as so...0 comments |
- TeamViewer 9 Final Has Been Released! : TeamViewer is a commercial all-in-one software that can be used for remote control, desktop sharing,...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint : Tor, The Onion Router, is a network of Virtual Tunnels that allows users to communicate securely and...1 comment |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comments |
- TeamViewer 9 Final Has Been Released!
- Twelve Vulnerabilities Have Been Fixed In Ubuntu 12.04, Time To Update
- OpenLDAP Installation and Configuration in Ubuntu 12.10/13.04/13.10 And Debian 6/7
- Configure Your Browser To Use Tor On Ubuntu/Debian/Linux Mint
- Setup A Full Featured ITIL Management System Using Integria IMS On CentOS 6
- Install LibreOffice 4.1.3 in Elementary OS ‘Luna’
- How To Install Simple Scan in Crunchbang ‘Waldorf’
- Selene Media Encoder: Convert Audio, Video Files To Most Popular Formats
- Linux Kernel 3.12.2 Is Available For Download! Install / Upgrade Instructions
- CentOS 6.5 Has Been Officially Released!
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .