LAMP_Stack_Installation
How to Install LAMP (Linux Apache MySQL PHP) Stack​
- To Get Access via SSH
Syntax:- ssh -p PORT USERNAME@HOSTIP
Example:- ssh -p 22 root@216.32.44.12
- Updates the package lists for Upgrades then Upgrade
apt update
apt upgrade
- Install Apache
apt install apache2
- (Optional) If Get Error While Installation "cannot stat '/usr/share/apache2/default-site/index.html': No such file or directory dpkg: error processing package apache2 (--configure)" then Try to Install Again
apt purge apache2-data
- Allow Apache through Firewall
ufw allow "Apache Full"
- Check Server IP on Web Browser You will see Apache Default Page
- Install MySQL
apt install mysql-server
- Install PHP
apt install php libapache2-mod-php php-mysql
The above command includes three packages:-
php - To Install PHP
libapache2-mod-php - It is Used by apache to handle PHP files
php-mysql - It is a PHP module that allows PHP to connect to MySQL
- To Restart Apache
service apache2 restart