Install LAMP in Ubuntu
--Resource --
Install Apache2
Update your system:
sudo apt update
Install Apache using apt:
sudo apt install apache2
Confirm that Apache is now running with the following command:
sudo systemctl status apache2
If it is not working !
sudo systemctl stop apache2 # to stop if running
sudo systemctl start apache2 # to start if not running
Once installed, test by accessing your server’s IP in your browser:
http://127.0.0.1/
http://localhost/
Install mariadb
sudo apt install mariadb-server mariadb-client
sudo systemctl status mysql # to check status
sudo systemctl start mysq # if not running
sudo mysql_secure_installation # Secure your newly installed MariaDB servic
Install PHP and commonly used modules
sudo apt install php libapache2-mod-php php-opcache php-cli php-gd php-curl php-mysql
sudo systemctl restart apache2
Test PHP Processing on Web Server
sudo nano /var/www/html/phpinfo.php
Inside the file, type in the valid PHP code:
<?php
phpinfo ();
?>
Press CTRL + X to save and close the file. Press y and ENTER to confirm
Open a browser and type in your IP address/phpinfo.php
http://127.0.0.1/phpinfo.php
Install phpmyadmin
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
sudo systemctl restart apache2
Open a browser : http://localhost/phpmyadmin
username : root
password : yourpassword
If phpmyadmin page not found :
nano /etc/apache2/apache2.conf
Add this line to last of the file.
Press CTRL + X to save and close the file. Press y and ENTER to confirm
Include /etc/phpmyadmin/apache.conf
restart apache2 - now try : http://localhost/phpmyadmin
sudo systemctl restart apache2
If any problem for login run the following command
sudo mysql
ALTER USER root@localhost IDENTIFIED BY "yourpassword";