How to Install LAMP server in ubuntu through terminal

how  to install php , mysql and Apache server

L-linux(probably you already having linux)

Installing LAMP On Ubuntu

In this guide I will show you how to install a LAMP system. LAMP stands for Linux, Apache, MySQL, PHP. The guide is intended to help those who have very little knowlegde of using Linux.

Install Apache

To start off we will install Apache.
  1. Open up the Terminal (Applications > Accessories > Terminal). (Ctrl+T also works)
  2. Copy/Paste the following line of code into Terminal and then press enter:

    sudo apt-get install apache2

  3. The Terminal will then ask you for you’re password, type it and then press enter.

Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.
  1. Open up any web browser and then enter the following into the web address:

 if this page opens it means apache is installed and working properly

Install PHP

In this part we will install PHP
Step 1. Again open up the Terminal (Applications > Accessories > Terminal). Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql 

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:
sudo /etc/init.d/apache2 restart
Test PHP — To ensure there are no issues with PHP let’s give it a quick test run.
Step 1. In the terminal copy/paste the following line: updated
sudo gedit /var/www/html/testphp.php
This will open up a file called phptest.php.
Step 2. Copy/Paste this line into the phptest file:
<?php phpinfo(); ?>
Step 3. Save and close the file.
Step 4. Now open you’re web browser and type the following into the web address:
The page should look like this:

Install mysql

sudo apt-get install mysql-server 

  you will see this


enter password here

enter the same password here.

Install php myadmin

(this is required to handle database in mysql)

sudo apt-get install phpmyadmin

Create Database

You can now access the web interface by visiting your server’s domain name or public IP address followed by /phpmyadmin:

when you will open  http://localhost/phpmyadmin you will see this page

 you can login here with username root and password that you have given for mysql that is in the first time during mysql installation.

you can see that there is user accounts tab after databases ,SQL,status and a new option in the left side bar that means you can handle that database with admin rights

but when you will login with username phpmyadmin and password that you have given during phpmyadmin installation you will not find the new and user accounts .

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat