Search our database

How To Setup LAMP Configuration On CentOS

You need to setup a LAMP server if you are planning to run your site using content management system such as WordPress or Joomlah.

LAMP is an acronym for Linux, Apache, MySQL and PHP; four of the most commonly used software to host and run virtually all websites on the Internet.

Linux = Choice of operating system, ie: Red Hat, CentOS, Ubuntu.

Apache = Web server application.

MySQL = World’s second most widely used relational database management system (RDBMS).

PHP = Server-side scripting language designed for web development and general-purpose programming language.

To start, you will need access to your web server. Kindly refer to our article on “How to SSH into Your Cloud Linux“.

To Install Apache

1) Run the following command using the server’s terminal.

yum install httpd

 

2) Start Apache service after installation is completed.

service httpd start

 

2) Stop iptables and set Apache to start itself after server reboots.

service iptables stop
chkconfig iptables off
chkconfig httpd on

*You’ll not be able to access the Apache Test Page if iptables is not turned off.

 

3) Type http://your-ip-address-here in your browser’s address bar to check if you have performed step 2 correctly.

If successful, you should see the Apache Test Page.

Apache Test Page

 

To Install MySQL

1) Run the following command using the server’s terminal.

yum install mysql-server

 

2) Start MySQL service after installation is completed. MySQL database will initialize and start. You do not have any login credentials to MySQL at this stage.

service mysqld start

 3) There are two ways to create a user account to access MySQL.

/usr/bin/mysqladmin -u root password 'insert-your-desire-password-here'

OR

/usr/bin/mysql_secure_installation

The first method will grant you a direct access to MySQL. The second method, which is the preferred method, will guide user through a series of steps and options to remove test database and anonymous user created by default.

You can now access MySQL database by typing the command into your server’s terminal.

mysql -u root -p

 

To Install PHP

 1) Run the following command using your server’s terminal.

yum install php php-mysql

 

2) Create a new file by running the command below to check if PHP has been successfully installed and is now working on your server.

vi /var/www/html/info.php

 

3) Type and save the command below into the newly created file.

<?php
phpinfo();
?>

 

4) Restart Apache service.

service httpd restart

 

5) By now, your server is able to run any PHP-scripted software. Type http://your-ip-address-here/info.php into your browser’s address bar and if successful, you should see something similar as below else repeat Step 1.

PHP-info

 

You have successfully installed LAMP on your server and ready to run your website using WordPress or Joomlah.

 

Read more: How to Install WordPress in Centos

 

Affordable but Powerful Cloud Hosting Package

Check out IPServerOne’s Cloud Hosting Packages.
Contact us @ +603-6259-5625 or email @ sales@ipserverone.com

Tags: , , , , , , , ,