LAMP using yum is very easy and takes only minutes. This is a good option for beginners who don’t feel comfortable installing from source.
Installing Apache, MySQL 5.5.30 & PHP 5.4.12 on RHEL 6.3/6.2/6.1/6.0/5.9/5.8/5.6, CentOS 6.3/6.2/6.1/6.0/5.9/5.8/5.6 (LAMP)
Step 1: Iptables Stop
# service iptables stop
# chkconfig iptables off
Step 2: Installing Repository
Install Remi & Epel Repository on RHEL/CentOS 6.3-6.0 - 32 Bit
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install Remi & Epel Repository on RHEL/CentOS 6.3-6.0 - 64 Bit
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install Remi Repository on RHEL/CentOS 5.9-5.0 - 32 Bit
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Install Remi Repository on RHEL/CentOS 5.9-5.0 - 64 Bit
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Step 3: Installing Apache, MySQL 5.5.30 & PHP 5.4.12 Modules
# yum --enablerepo=remi,remi-test install httpd mysql mysql-server mysql-devel php php-common php-mysql php-pgsql php-mbstring php-mcrypt
Step 4: Starting/Stopping Apache & MySQL 5.5.30
Enable Apache and MySQL on Run-Levels
# /etc/init.d/httpd start
# /etc/init.d/mysqld start
# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on
Step 5: Secure Installation of MySQL
# mysql_secure_installation
During the installation, MySQL will ask you for your permission twice. After you say Yes to both, MySQL will install.
Once it is done installing, you can set a root MySQL password:
The prompt will ask you for your current root password.
Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Then the prompt will ask you if you want to set a root password. Go ahead and choose Y and follow the instructions.
CentOS automates the process of setting up MySQL, asking you a series of yes or no questions.
It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
By default, a MySQL installation has an anonymous user, allowing anyone
To run a quick test, use the command line program mysql:
you can login to mysql root account without providing any password as shown below.
# mysql -u root
1. Create a page called phpinfo.php under your Apache root directory and add the following lines to it. For example (/var/www/html/phpinfo.php).
<?php
phpinfo ();
?>
2. Now access the page via web browser like http://localhost/phpinfo.php. You will see below screenshot.
Installing Apache, MySQL 5.5.30 & PHP 5.4.12 on RHEL 6.3/6.2/6.1/6.0/5.9/5.8/5.6, CentOS 6.3/6.2/6.1/6.0/5.9/5.8/5.6 (LAMP)
Step 1: Iptables Stop
# service iptables stop
# chkconfig iptables off
Step 2: Installing Repository
Install Remi & Epel Repository on RHEL/CentOS 6.3-6.0 - 32 Bit
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install Remi & Epel Repository on RHEL/CentOS 6.3-6.0 - 64 Bit
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install Remi Repository on RHEL/CentOS 5.9-5.0 - 32 Bit
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Install Remi Repository on RHEL/CentOS 5.9-5.0 - 64 Bit
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Step 3: Installing Apache, MySQL 5.5.30 & PHP 5.4.12 Modules
# yum --enablerepo=remi,remi-test install httpd mysql mysql-server mysql-devel php php-common php-mysql php-pgsql php-mbstring php-mcrypt
Step 4: Starting/Stopping Apache & MySQL 5.5.30
Enable Apache and MySQL on Run-Levels
# /etc/init.d/httpd start
# /etc/init.d/mysqld start
# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on
Step 5: Secure Installation of MySQL
# mysql_secure_installation
During the installation, MySQL will ask you for your permission twice. After you say Yes to both, MySQL will install.
Once it is done installing, you can set a root MySQL password:
The prompt will ask you for your current root password.
Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Then the prompt will ask you if you want to set a root password. Go ahead and choose Y and follow the instructions.
CentOS automates the process of setting up MySQL, asking you a series of yes or no questions.
It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
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] y
... 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] y
... 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] y
- 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] y
... 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!
Test MySQLTo run a quick test, use the command line program mysql:
you can login to mysql root account without providing any password as shown below.
# mysql -u root
Enter Password of root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.5.30 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>
Step 6: Verifying Apache, MySQL 5.5.30 & PHP 5.4.121. Create a page called phpinfo.php under your Apache root directory and add the following lines to it. For example (/var/www/html/phpinfo.php).
<?php
phpinfo ();
?>
2. Now access the page via web browser like http://localhost/phpinfo.php. You will see below screenshot.