How to Install LAMP Stack

Prerequisites

The only prerequisite is that you should have, or apply for, an Alibaba Cloud account.

Installing LAMP Stack

Step 1: Launch an Alibaba Cloud ECS Server

Alibaba Cloud Elastic Compute Service (ECS) is a virtual cloud server product that offers excellent elasticity and computer performance. You can easily launch an Alibaba Cloud ECS instance installed with Linux, or in our case, Ubuntu. Follow the steps below to execute this application:

Step 2: Install Apache Server

The Apache web server helps in accepting HTTP requests that come from browsers and allow them to serve them HTTP responses.

apt-get update
apt-get install apache2
http://ip_of_server

Step 3: Install MySQL

MySQL is the open-source database management system used to store and manage the structured collection of data. It can store videos, pictures, along with several other data types. Follow the steps below to install MySQL.

sudo apt-get install mysql-server

Step 4: Install PHP

PHP is an acronym that stands for Hypertext Preprocessor. It is an open source scripting language that aids web development and can be used with HTML.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt libapache2-mod-auth-mysql php5-mysql
  • php5-mcrypt enables the data encryption for added security reasons.
  • libapache2-mod-auth-mysql, an Apache 2 module that enables extra HTTP authentication for data stored in MySQL.
  • php5-mysql includes the generic "MySQL" module which can be used to connect to all versions of MySQL.
vim  /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c >   DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml  index.htm    </IfModule >

Step 5: Confirm Installation

To verify a successful installation, deploy a sample PHP page with these configurations:

vim /var/www/html/info.php
<?php phpinfo(); ?>
sudo service apache2 restart
http://IPAddress/info.php

Original Source:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store