LAMP Install

MySQL
Install MySQL
Run security script
Accept almost everything, and add secure root password:
Change authentication method
If you don’t change the authentication method from auth_socket
to mysql_native_password
then anyone with a sudo user password can log in as root.
To check the authentication method, enter MySQL:
And type:
To configure the root account to authenticate with a password, run the following ALTER USER
command.
Be sure to change password to a strong password of your choosing,
and note that this command will change the root password you set in the security script:
Then, run FLUSH PRIVILEGES
which tells the server to reload the grant tables and put your new changes into effect:
Check again the authentication method, to confirm the changes:
Exit the MySQL shell:
Create new user with all privileges
Enter mysql:
Create a new user and give it a strong password:
Grant your user the appropriate privileges:
Exit the MySQL shell:
Apache
Install Apache
Adjust the Firewall to Allow Web Traffic
After you have followed the initial server setup and enabled the UFW firewall, make sure that your firewall allows HTTP and HTTPS traffic. You can check that UFW has an application profile for Apache like so:
Look at the full Apache Full
profile, it should show that it enables traffic on port 80 and 443:
Allow incoming HTTP and HTTPS traffic for this profile:
Verify your installation, visiting your servers IP:
You will see the default Ubuntu 18.04 Apache web page
PHP
Install PHP and helper packages
phpMyAdmin
Install phpMyAdmin
This will ask you a few questions in order to configure your installation correctly:
- For the server selection, choose apache2.
- Select Yes when asked whether to use dbconfig-common to set up the database.
- You will be asked to choose a MySQL application password for phpMyAdmin
- It will be the password for the phpmyadmin user for MySQL.
Enable the mbstring PHP extension
Restart Apache
Securing Your phpMyAdmin Instance
If you want to secure more the phpMyAdmin instance, by having one extra authentication, follow the guide below for phpMyAdmin.