How to install & Configure LAMP STACK in Ubuntu
In this article we will learn how to install LAMP STACK in UBUNTU 16.04. where we need to install 4 packages which is mentioned below. Please follow all the steps and get it done by this article and let us know if you are facing any kinds of issue during installation of LAMP stack in Ubuntu.
We need to install 4 packages to install lamp stack:-
1.Apache
2.My SQL
3.PHP
4.PHP My admin
STEP : 1
Before that we need to update and install the new version of packages in Ubuntu 16.04
Use this command for Update
1. sudo apt-get update
and
2. sudo apt-get upgrade
STEP :2
So now we can install the Apache packages in ubuntu 16.04 by
using this command:
sudo apt-get install apache2
we can verify through following command:
sudo dpkg -l apache2
Now open the browser and check wether apache 2 is working by entering http://localhost
STEP 3:
So now we can install the php packages in ubuntu 16.04 by
using the command:
sudo apt-get install libapache2-mod-php php
we can verify through following command:
sudo dpkg -l php
now restart the apache2 service
sudo /etc/init.d/apache2 restart
So now we can test wether php is working fine for that we can create a file under Document Root of apache i.e. “/var/www/html” and then enter <?php phpinfo(); ?> to check php information.
Using this command we create a file
sudo nano /var/www/html/file.php
and enter this code in this file i.e
<?php
phpinfo();
?>
And check through by entering the “http://localhost/file.php” in your browser wether it is working or not
STEP 4:
So now we can install the mysql packages in ubuntu 16.04 by
Using this command :
sudo apt-get install mysql-server
we can verify through following command:
sudo dpkg -l mysql-server
let’s check if mysql-server is working properly by creating a database
To login mysql-server as a user root:
mysql -u root -p
To create database
mysql> create database usersdb;
i.e :- CREATE DATABASE dbname;
To check the database list or not
mysql> show databases;
To exit for MySQL program type:-
/q & exit
STEP 5:
So now we can install the phpmyadmin packages in ubuntu 16.04 by
using the command:
sudo apt-get install phpmyadmin
Select apache2 and then press OK to proceed the installation process
we can verify through following command:
sudo dpkg -l phpmyadmin
As shown on above snapshot phpmyadmin package installed.
We can open phpmyadmin web access by using URL “http://localhost/phpmyadmin” but before that we have to configure “php.ini” and “apache.conf” file, so Follow the below steps to do the same.
edit the “php.ini” and search for extension=msql.so
To edit the php.ini file:
sudo nano /etc/php/7.0/apache2/php.ini
To find out particular word in nano editor
ctrl+w
After uncomment extension=msql. so it would look like this as shown above on the snapshot, then save php.ini file.
Now edit the “apache2.conf” file by using below command.
To edit the apache2.conf file:
sudo nano /etc/apache2/apache2.conf
Then go to the end of the configuration file and add the below line.
Include /etc/phpmyadmin/apache.conf
To restart apache :
sudo /etc/init.d/apache2 restart
0 comments:
Post a Comment