LAMP Server On RHEL, CentOS,Linux 6.5/6.4

LAMP Server,LAMP is a aggregate of working device and open-source software stack. The acronym LAMP is derived from first letters of Linux, Apache HTTP Server, MySQL database, and PHP/Perl/Python.

In this educational allow us to see the way to setup LAMP server on RHEL/CentOS/Scientific Linux 6.X. Here x stands for model along with 6.1, 6.2, 6.3, 6.Four, 6.5 and so on.

My testbox hostname and IP address are server.Unixmen.Neighborhood and, respectively.

LAMP Server,Install Apache

LAMP Server,Apache is an open-supply multi-platform web server. It affords a complete range of net server functions consisting of CGI, SSL and digital domain names.

To install Apache, enter the following command from your terminal:

# yum install httpd -y

Start the Apache service and let it to start automatically on every reboot:

# service httpd start
# chkconfig httpd on

Allow Apache server default port eighty via your firewall/router if you need to connect from remote systems. To do that, edit document /and so forth/sysconfig/iptables,

# vi /etc/sysconfig/iptables

Add the following lines.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEP

Restart iptables:

# service iptables restart

LAMP Server,Test Apache:

Open your net browser and navigate to http://localhost/ or http://server-ip-deal with/.

LAMP Server,Install MySQL

MySQL is an business enterprise elegance, open supply, global’s 2d most used database. MySQL is a famous choice of database to be used in net applications,

is a vital thing of the broadly used LAMP open source net software software program stack.

To deploy MySQL, input the following command:

# yum install mysql mysql-server -y

Start the MySQL service and make to start automatically on every reboot.

# service mysqld start
# chkconfig mysqld on

Setup MySQL root password

By default, mysql root user doesn’t has password. To cozy mysql, we need to setup mysql root user password.

# 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 comfy it, we’re going to want the contemporary password for the basis person. If you’ve just installed MySQL, and you haven’t set the basis password but, the password could be blank, so you have to simply press input right here. Enter contemporary password for root (input for none): ## Press Enter ## OK, efficiently used password, transferring on… Setting the basis password ensures that no one can log into the MySQL root person without the right authorisation. Set root password? [Y/n] ## Press Enter ## New password: ## Enter new password ## Re-enter new password: ## Re-enter new password ## Password updated efficiently! Reloading privilege tables.. … Success! By default, a MySQL set up has an anonymous user, allowing everyone to log into MySQL while not having to have a consumer account created for them. This is meant handiest for testing, and to make the set up cross a chunk smoother. You have to cast off them before entering into a production environment. Remove nameless customers? [Y/n] ## Press Enter ## … Success! Normally, root have to best be allowed to attach from ‘localhost’. This ensures that someone cannot guess at the basis password from the network. Disallow root login remotely? [Y/n] ## Press Enter ## … Success! By default, MySQL comes with a database named ‘take a look at’ that everyone can get right of entry to. This is also meant only for checking out, and should be removed earlier than stepping into a production surroundings. 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 make sure that every one adjustments made to date will take impact straight away. 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 have to now be secure. Thanks for using MySQL!

Install PHP

PHP (recursive acronym for PHP: php) is a broadly used open-supply standard motive scripting language that is specifically perfect for web development and may be embedded into HTML.

Install PHP with following command:

# yum install php -y

Test PHP

Create a sample “testphp.Hypertext Preprocessor” record in Apache file root folder and append the traces as proven beneath:

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

Restart httpd service:

# service httpd restart

Navigate to http://server-ip-address/testphp.Php. It will display all of the details about Hypertext Preprocessor which includes model, construct date and commands and so forth.

If you wanna to get MySQL help to your PHP, you should set up “php-mysql” package.

If you want to put in all personal home page modules simply you use the command “yum set up Hypertext Preprocessor*”

[root@server ~]# yum install php-mysql -y

Now open the phptest.Php record in your browser the use of http://ip-deal with/testphp.Personal home page or http://domain-call/testphp.Hypertext Preprocessor. Scroll down and you will see the mysql module can be supplied there.

Install phpMyAdmin

phpMyAdmin is a loose open supply net interface device, used to manipulate your MySQL databases.

By default phpMyAdmin is not found in CentOS reliable repositories. So let us set up it the usage of EPEL repository.

To set up EPEL repository, observe the below hyperlink:

Now install phpMyAdmin

# yum install phpmyadmin -y

Configure phpMyAdmin

Edit the phpmyadmin.conf file.

# vi /etc/httpd/conf.d/phpMyAdmin.conf

Find and comment the whole /<Directory> section as shown below:

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

#<Directory /usr/share/phpMyAdmin/>
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     Require local
#   </IfModule>
#   <IfModule !mod_authz_core.c>
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from
#     Allow from ::1
#   </IfModule>

Open “” file and change from “cookie” to “http” to change the authentication in phpMyAdmin:

# cp /usr/share/phpMyAdmin/ /usr/share/phpMyAdmin/ 
# vi /usr/share/phpMyAdmin/

Change cookie to http.

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';

Restart the Apache service:

# service httpd restart

Now you could get entry to the phpmyadmin console by using navigating to http://server-ip-address/phpmyadmin/ out of your browser.

Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “centos”.

Now you will be redirected to the phpmyadmin as shown below.

Now you will able to manipulate your MariaDB databases from phpMyAdmin net interface.

That’s it. Your LAMP server is up and prepared to apply.