Install Apache2 PHP MYSQL PHPMyAdmin ubuntu; In this tutorial, We will show you how to install Lamp (Apache2 PHP MYSQL PHPMyadmin) on Ubuntu 18.04/20.04 server.
The LAMP stands for Linux, Apache, Mysql, and PHP. It is an open-source platform and works on the Linux operating system. It uses Apache web server, MySQL relational database management system, and PHP object-oriented scripting language.
Before we install Lamp in Ubuntu. Let’s know about lamp:
Lamp
L => Linux operating system
A => Apache web server
M => MySQL relational database management system
P => PHP object-oriented scripting language
Before Install the Lamp on Ubuntu. First update the apt package :
sudo apt-get update
sudo apt-get upgrade
How to Install Apache2 PHP MYSQL PHPMyAdmin ubuntu 18.04/20.04
Steps to install apache2 php mysql phpmyadmin ubuntu 18.04/20.04
- 1. Install Apache 2 On Ubuntu
- 2. Install MySQL on Ubuntu
- 3. Install PHP 7.2 On Ubuntu
- 4. Test PHP Version
- 5. Install PhpMyAdmin
1. Install Apache 2 On Ubuntu
Install apache on ubuntu using this below command :
sudo apt-get install apache2
Check Apache Status :
After the Apache installation process, the web server service should be started automatically, You can check the Apache service status :
sudo systemctl status apache2
Output
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
`-apache2-systemd.conf
Active: active (running) since Sun 2018-12-31 05:18:45 PDT; 2min 30s ago
Main PID: 3143 (apache2)
Tasks: 55 (limit: 2321)
CGroup: /system.slice/apache2.service
|-3143 /usr/sbin/apache2 -k start
|-3144 /usr/sbin/apache2 -k start
`-3145 /usr/sbin/apache2 -k start
Manage the Apache services using these below commands :
To start Apache
sudo systemctl start apache2
To Stop Apache
sudo systemctl stop apache2
Restart Apache
sudo systemctl restart apache2
Disable Apache
sudo systemctl disable apache2
2. Install MySQL on Ubuntu
Execute the following command to install MySQL server into your ubuntu server:
sudo apt install mysql-server
Secure MySQL Server Installation
Default MySQL is insecure , we need to secure the database server.
After installation is complete, the mysql_secure_installation
utility runs.
Run the below command and answer the few questions based on your environment requirements.
sudo mysql_secure_installation
3. Install PHP 7.2 On Ubuntu
Execute the following command to install PHP 7.2 version on ubuntu server:
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php
Install PHP with Exetension
sudo apt-get install php7.2
sudo apt-get install php7.2-<extension-name>
See example below
sudo apt-get install php7.2-fpm php7.2-curl php7.2-mysql \ php7.2-xml php7.2-zip php7.2-gd
4. Test PHP Version
Test your server by executing the following command:
Use the below command to check the PHP version installed on your server :
php -v
Finally, we need to restart the Apache Web Server :
sudo systemctl restart apache2
5. Install PhpMyAdmin
Use the following command to Install PHPMyAdmin:
sudo apt install phpmyadmin
Configuration phpmyadmin for Apache.
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
Enable the configuration.
sudo a2enconf phpmyadmin.conf
Then execute the following command on command prompt to restart apache web server:
sudo service apache2 restart
Now we have installed PHPMyadmin, this can be accessible with this route yourdomain.com/phpmyadmin
.
Conclusion
In this article, we have successfully installed LAMP on Ubuntu 18.04/20.04.
If you have any questions or thoughts to share, use the comment form below to reach us.