Hello in this tutorials i will show you how to install Lamp stack in ubuntu 18.04 on digital ocean or any vps lets gets started.
Table of Contents
Step1. Installing Apache
You know apache is popular web server in all over the world lets install it just follow this command
$ sudo apt update
$ sudo apt install apache2
$ sudo systemctl restart apache2
he need some permission click y and hit enter
After installing Apache2 lets config firewall

Step2. Config Firewall
$ sudo ufw allow in "Apache Full"
After setup firewall go to browser and type your server ip and hit enter he show apache2 default page.
Also Read: Install Phpmyadmin on digital ocean
Step3. Install Mysql Database
$ sudo apt install mysql-server
after install mysql next you need to mysql secure installation
$ sudo mysql_secure_installation
He access for permission hit y,y,y,y,y he askes for password type secure password like Jonsuper123@ok after thats lets go to next setup
Step4. Setting Password in Root User
$ sudo mysql
you can in mysql is not set in password we need to setup password
type your password in yourpassword
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword';
after setup your mysql root password you need to flush privileges type typing command
mysql> FLUSH PRIVILEGES;
mysql> exit
Step5. Install PHP
Type Below command becuase it connect php to mysql
mysql> sudo apt install php libapache2-mod-php php-mysql
After installing php you need to config file
$ sudo nano /etc/apache2/mods-enabled/dir.conf
it look like this
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
Change the value index.html to index.php and index.php to index.html
and restart your apache server
$ sudo systemctl restart apache2
If any question or suggestion comment below or contact to mail.
Learn More: Click Here
All done your lamp is installing successfull.
Leave a Reply