Tuesday, February 23, 2021

Install LAMP in ubuntu




APACHE 2 INSTALLATION
    sudo apt update
    sudo apt install apache2

sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo ufw app list
1
2
3
4
5
OutputAvailable applications:
  Apache
  Apache Full
  Apache Secure
  OpenSSH

As indicated by the output, there are three profiles available for Apache:

  • Apache: This profile opens only port 80 (normal, unencrypted web traffic)
  • Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
  • Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)
sudo ufw allow 'Apache Full'
 

 

 
 




 Press Y and hit ENTER to continue


TEST:
http://your_server_ip

INSTALL MYSQL


1)sudo apt install mysql-server

---------------------------------------------------

  switch its authentication method from auth_socket to mysql_native_password

        sudo mysql
        SELECT user,authentication_string,plugin,host FROM mysql.user;

        ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
        FLUSH PRIVILEGES;

TEST
        SELECT user,authentication_string,plugin,host FROM mysql.user;
        exit

 

---------------------------------------------------
2)sudo mysql_secure_installation

--VALIDATE PASSWORD PLUGIN.-NO
REST- YES






INSTALL PHP MYADMIN
        sudo apt update
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

 adds the phpMyAdmin Apache configuration file into the /etc/apache2/conf-enabled/ directory, where it is read automatically. The only thing you need to do is explicitly enable the mbstring PHP extension, which you can do by typing:

        sudo phpenmod mbstring

SEE PHPMYADMIN IN THE BROWSER

        sudo mysql -u root -p

        GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost';
        FLUSH PRIVILEGES;
        EXIT

 TEST

http://your-server-IP/phpmyadmin

RESTART APACHE2
    sudo systemctl restart apache2

Log in as either your root MySQL user or as a user dedicated to managing databases through the phpMyAdmin

-------------------------------------------------------------------------------------------------

Install PHP8.1

---------------------------------------------------------------------------------------------------

Add PPA for PHP 8.1

 

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

 

Install PHP 8.1

sudo apt install php8.1

 

Install PHP 8.1 Packages

sudo apt install php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-dev php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl -y

 

PHP 8 Enable

sudo a2dismod php8.0

sudo a2enmod php8.1

sudo service apache2 restart

 

php -v

sudo update-alternatives --set php /usr/bin/php8.1

 

 

 

 

 

 

------------------------------------------------------------------------------------------------

Reference:

1) https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

2)https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04

No comments:

Post a Comment