Latest News: Linux shell script to change you ssh port

Install LAMP Server (Apache, MariaDB, PHP) On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3

Tutorial willing 481View(s) 0Comment

LAMP is a combination of operating system and open-source software stack. The acronym LAMP is derived from first letters of Linux, Apache HTTP Server, MariaDB database, and PHP/Perl/Python.

In this tutorial let us see how to setup LAMP server on RHEL/CentOS/Scientific Linux 6.x. Here x stands for version such as 6.1, 6.2, 6.3, 6.4, 6.5 etc.

My testbox hostname and IP address are server.unixmen.com and 192.168.1.200/24, respectively.

Install Apache

Apache is an open-source multi-platform web server. It provides a full range of web server features including CGI, SSL and virtual domains.

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

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

Allow Apache server default port 80 through your firewall/router if you want to connect from remote systems. To do that, edit file /etc/sysconfig/iptables,

Add the following lines.

Restart iptables:

Test Apache:

Open your web browser and navigate to http://localhost/ or http://server-ip-address/.

Apache HTTP Server Test Page powered by CentOS - Mozilla Firefox_001Install MariaDB

MariaDB is a drop in replacement for MySQL. It is a robust, scalable and reliable SQL server that comes rich set of enhancements.

First you have to remove existing MySQL packages if any:

Install REMI Repository to resolve MySQL Compatibility issue

You will probably get dependencies errors while installing MariaDB. So let us add REMI Repository to solve dependencies problems:

Thanks to AskMonty Knowledgebase to help me to solve the dependencies issues.

Install compat-mysql55 package now:

Create a repository file for MariaDB and add the following lines:

For 32bit systems:

For 64bit systems:

Save and exit the file and run yum update command:

Now start installing MariaDB:

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

Set MySQL root password

By default MySWL root password is empty. So to prevent unauthorized access to MySQL, let us set root user password:

Install PHP

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:

Test PHP

Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:

Add the following lines.

Restart httpd service:

Navigate to http://server-ip-address/testphp.php. It will display all the details about php such as version, build date and commands etc.

phpinfo() - Mozilla Firefox_002If you want to install all php modules, enter the command yum install php* -y and restart the httpd service. To verify for the modules, open web browser and navigate to http://server-ip-address/testphp.php. You will able to see all php modules.

Install phpMyAdmin (Optional)

phpMyAdmin is a free open-source web interface tool used to manage your MySQL databases. By default phpMyAdmin will not be not found in CentOS/RHEL/Scientific Linux official repositories. So let us install it from EPEL repository.

To add EPEL repository, just follow the link.

Install EPEL Repository on RHEL/CentOS/Scientific Linux 6

Now install phpMyAdmin:

Configure phpMyAdmin

Edit the phpmyadmin.conf file.

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

Open “config.inc.php” file and change from “cookie” to “http” to change the authentication in phpMyAdmin:

Change cookie to http.

Restart the Apache service:

Now you can access the phpmyadmin console by navigating to http://server-ip-address/phpmyadmin/ from your browser.

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

Mozilla Firefox_003You will be redirected to PhpMyAdmin main web interface.

192.168.1.200 - localhost | phpMyAdmin 2.11.11.3 - Mozilla Firefox_004Now you will able to manage your MariaDB databases from phpMyAdmin web interface.

That’s it. Your LAMP server is up and ready to use.

Cheers!

Source:https://www.unixmen.com/install-lamp-apache-with-mariadb-and-php-on-centosrhelscientific-linux-6/

Please give credit to the original author when you use it elsewhere: VPS List Agent » Install LAMP Server (Apache, MariaDB, PHP) On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3

Login to post a comment!