Install LAMP server on Ubuntu 16.10


Using following steps we can intall Apache , MySQL and PHP on Ubuntu 16.10 system.

1. First install Apache server

Open Terminal and write following command

 sudo apt-get install apache2 

You will see following information.


Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
0 upgraded, 9 newly installed, 0 to remove and 271 not upgraded.
Need to get 1,536 kB of archives.
After this operation, 6,349 kB of additional disk space will be used.

Do you want to continue? [Y/n] Y

Type Y here and press enter key, installation process will start in your system.  After complete this process you want to know status of apache2 , use following command

 

 sudo service apache2 status 

you will see some information there. In that information above ‘Active’ text its status shown like this “Active: active (running)” That means apache is installed successfully. Now open web browser and type this
http://localhost
to test apache server.

2. Install MySQL for database

open terminal and write following command.

 sudo apt-get install mysql-server mysql-client
 

You will see information like as follows

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libaio1 libevent-core-2.0-5 libhtml-template-perl mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libevent-core-2.0-5 libhtml-template-perl mysql-client
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server
  mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 10 newly installed, 0 to remove and 271 not upgraded.
Need to get 19.7 MB of archives.
After this operation, 170 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Type Y here and press enter key, installation process will start in your system. During MySQL install you need to add password for it,( it not mendatory because a blank passwork will be set)


then password confirmation screen shown , type here password for confirmation. then press enter.

Installation process will start and after its completion you can know its status by write following command.

sudo service mysql status

3. Install php

Now its turn to install php by using following command

 
sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi  php7.0

then press enter so installation process will start.

test php installation
A. In command line use this command php -v
If you see following information that means php7 is installed successfully.

PHP 7.0.15-0ubuntu0.16.10.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-0ubuntu0.16.10.4, Copyright (c) 1999-2017, by Zend Technologies

B. create a file in /var/www/html/test.php and write following code.

<?php
phpinfo();
?>

and save the file. now open web browser and open url http://localhost/test.php
it will show php information on the screen

Done.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s