Tutorial - How to install LAMP on CentOS

Datacentreplus

Member
Registered
Joined
Dec 13, 2016
Messages
62
Points
0
If you're looking to use your server to host a website, you may want to start installing the LAMP stack if you haven't done so already.
LAMP stands for Linux, Apache, MySQL and PHP.

Once installed, you will be able to host your website on the sever you it installed on.

This tutorial is for servers running CentOS, Linux.

Step 1: Bring up your terminal and type the below command.

Code:
sudo yum install httpd
You should see the download processing before it asks you if you want to install:
Type y” and press Enter.

Step 2: Start your Apache server by typing:

Code:
sudo service httpd start
Apache should now be installed. To check this, navigate to your IP Address by typing it in the address bar of your browser. You should see a test page letting you know that Apache has been installed correctly.

Step 3: Installing MySQL

MySQL is an open source database management system. It is often used to store user data on a web server.
With your terminal still open, type in the following command:

Code:
sudo yum install mysql-server
If you are running CentOS 7+, then you'll need to install MySQL using the following commands:

Code:
yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
Once MySQL is installed, start the service by typing:

Code:
sudo service mysqld start
You will need to set up a root password:

Code:
sudo /usr/bin/mysql_secure_installation
When asked for a current root password, leave the field blank and hit Enter.
Type "y" and hit the Enter button again if it asks you if you would like to set a Root Password.
When asked for your current root password, leave the field blank and hit Enter. Type y” and hit Enter again when it asks if you would like to set the root password.

Set the password and be sure to store the password somewhere safe.

Next you will be asked a series of questions. Read through them and determine what you want your answers to be.

Step 4: Installing PHP
PHP is a server-side scripting language designed for web development.

Type the command below to install PHP

Code:
sudo yum install php php-mysql
Then follow the prompts to install PHP.

You have now successfully installed LAMP.

I hope that is of use to those who are just entering the realm of their own server hosting solution.
Any questions, give us a shout.
 
Last edited:

StartVM

Well-known member
Registered
Joined
Aug 5, 2016
Messages
241
Points
18
Thank you for your time, but consider adding a bit to this tutorial, as there isn't anything here that the first 10 results for "install centos lamp stack" wouldn't pull up on Google.

> Securing Apache
> Auto starting services
> MariaDB alternative to MySQL (really everyone should be using Maria so I would consider revising that)
> Installing PHP 7 (the way you are installing PHP will put 5.4 or something similar, which has been long deprecated)
> SSL Options such as LetsEncrypt

Again, I appreciate you sharing, but I am trying to pick your brain a bit to add some more substance to the tutorial :cheers:
 

David Beroff

Well-known member
Registered
Joined
Jun 14, 2016
Messages
1,498
Points
63
David Beroff
It would be great if these tutorials are added to the tutorial of @Datacentreplus.

I also tried to install LAMP as your guide and it worked but still needing security and enhancements to make it better.
 

Datacentreplus

Member
Registered
Joined
Dec 13, 2016
Messages
62
Points
0
Thanks for the feedback.

Thought it'll be a straight forward interesting one, especially how some people on here are making their first venture into the world of servers. As you can see, a lot of people are web designers/developers looking for guidance and help on these forums.

We'll take on board your suggestions on topic. We're rustling up more self help guides as we speak...
 

StartVM

Well-known member
Registered
Joined
Aug 5, 2016
Messages
241
Points
18
StartVM
That's awesome! From what I said, the most important is to ensure that the content is updated, such as the PHP version and MariaDB. Everyone has a responsibility to be as secure as possible, so I urge you to at the very least, update those parts of the tutorial to reflect the current recommendations for best security. We want people to learn the correct way from the start :)
 

HyperVMart

Member
Hosting Provider
Registered
Joined
Mar 21, 2017
Messages
55
Points
8
excellent tutorial, even major webhosting forums don't have that as I've been looking for something like this but glad i already finalized it myself, such tutorials will serve greatly for beginners...
 

SakamHost

Member
Registered
Joined
Apr 30, 2017
Messages
50
Points
6
Great tutorial, with this one newbies can learn how to install lamp in their centos.
Keep making tutorials like this one.
Thanks you.
 

Dr. McKay

Well-known member
Registered
Joined
Nov 26, 2016
Messages
565
Points
28
Dr. McKay
It is not difficult to run those commands in SSH and installing LAMP but for newbies it is not easy to setup a website completely and making it online on the net and other functions such as emails, secure VPS with LAMP..etc
I think the OP should have a next article to guide everyone those points.
 

rfharris

Member
Registered
Hosting Provider
Joined
Mar 15, 2016
Messages
52
Points
8
Thank you for sharing this useful tutorial :) Keep up the good work (Y)
 

hostinfuse

Member
Registered
Hosting Provider
Joined
Apr 17, 2017
Messages
51
Points
0
Thanks for sharing this tutorial, but i agree with @startVm , there are things that have been updated and need additional settings to securly install lamp.

Will be waiting for your next article, good luck
 

HostBastic

Well-known member
Hosting Provider
Registered
Joined
Nov 17, 2016
Messages
320
Points
28
The tutorial might be a little outdated, however its a good starting point for someone which wishes to learn step by step.

Like others have mentioned it requires some security guidelines, I would like to add that some apache optimization wouldn't hurt :)
 

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top