Install & Setup Apache, MySQL, PHP (LAMP) Stack on Ubuntu 20.04

Install & Setup Ubuntu Configuration Aws

Install Apache, MySQL, PHP (LAMP) Stack on Ubuntu 20.04 1

Install Apache, MySQL, PHP (LAMP) Stack on Ubuntu 20.04

1. Install Apache


sudo apt update && sudo apt install apache2

2. Configure Firewall


sudo ufw allow OpenSSH

sudo ufw allow in "Apache Full"

sudo ufw enable

sudo ufw status

3. Test Apache


sudo service apache2 status

4. Install MySQL


sudo apt update && sudo apt install mysql-server

sudo service mysql status

5. MySQL Security


sudo mysql_secure_installation

-> ENTER | Y | Y | Y | Y

sudo mysqladmin -p -u root version

6. Install PHP


sudo apt update && sudo apt install php libapache2-mod-php php-mysql

php -version

7. Installing phpMyAdmin


sudo apt update && sudo apt install phpmyadmin php-mbstring

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

sudo a2enconf phpmyadmin.conf

sudo service apache2 reload

8. Create MySQL User


sudo mysql

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

FLUSH PRIVILEGES;

exit

9. Secure PhpMyAdmin


sudo nano /etc/apache2/conf-available/phpmyadmin.conf

Alias /your_url /usr/share/phpmyadmin

sudo service apache2 reload

10. Install ZIP/Unzip


sudo apt-get update

sudo apt-get install zip unzip

11. Enable .htaacess


sudo apt-get update

sudo a2enmod rewrite

systemctl restart apache2

sudo nano /etc/apache2/sites-enabled/000-default.conf

<Directory "/var/www/html">
  AllowOverride All
</Directory>

12. Configure Apache File


sudo nano /etc/apache2/apache2.conf

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
 </Directory>

 <Directory /var/www/html>
    Options -Indexes
 </Directory>

 ServerSignature Off
 ServerTokens Prod

13. install SSL Certificate


sudo apt update && sudo apt install certbot python3-certbot-apache

sudo certbot --apache

sudo service apache2 restart

13. Permissions


sudo chmod -R 777 /var/www
sudo chown -R www-data:www-data /var/www

14 Php My admin Php memory limit change

sudo chown -R ubuntu /var/www/html 

sudo chmod -R 755 /var/www/html

sudo chmod -R 777 /etc/php/7.4/apache2
sudo service apache2 restart

15 Compress a directory in Ubuntu Linux

The zip command syntax is as follows to compress a directory in Ubuntu Linux:


zip -r compressed_data.zip /path/to/foldername

zip -r compressed_data.zip /home/vivek/Jan-2018
Shopping Cart
x
Scroll to Top