How to install (LAMP) Stack Linux,Apache,MySQL,PHP in Ubuntu
A “LAMP” stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. LAMP stack stands for Linux,Apache,MYSQL,PHP in Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.
Step 1: Install Apache2.
Apache is a free open source software which runs over 45% of the world’s web servers.
Open your terminal OR simply press Ctrl + Alt + T and add below code to your terminal to install Apache.
sudo apt-get update
sudo apt-get install apache2
To check if Apache is installed or not go to your browser and add http://localhost and you will get below apache page.
Step 2: Install MySQL
MYSQL is an powerful data management system using this you can manage manage,organise and retrieve data from database
To install MyQL open your terminal OR simply press Ctrl + Alt + T and add below code to your terminal and it will install latest MySQL.
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
During the installation, MySQL will ask you to set a root password. during this time you can set password for your database access also you can change,update or add new user for your database using mysql terminal.
You can check your MySQL version by adding below command to your terminal.
mysql -V
Step 3: Install PHP
- PHP is an acronym for "PHP: Hypertext Preprocessor"
- PHP is a widely-used, open source scripting language
- PHP scripts are executed on the server
- PHP is free to download and use
Open your terminal OR simply press Ctrl + Alt + T and add below code to your terminal to install PHP.
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Step 4: Check which PHP version install on your system.
First create a new file info.php inside your /var/www/html/ Directory. or you can create file using terminal add below code to your terminal.
sudo nano /var/www/html/info.php
Add below code to this newly open file
After adding above code to file Save and Exit also restart apache.
sudo service apache2 restart
After go to your browser and add below line of code to check php version.
http://localost/info.php
NOTE:- If you have any query or want to ask any question add your comment in below comment section.
Thank you.