Test Your LAMP Setup: Create a test PHP file to ensure that PHP is working correctly with Apache:
echo"" | sudo tee /var/www/html/info.php
You can access this file in your web browser by visiting http://your_server_ip/info.php. Replace your_server_ip with your server's IP address or domain name.
(Optional) Secure MySQL Installation: You can further enhance the security of your MySQL installation by running the MySQL security script:
sudo mysql_secure_installation
This script will allow you to set a new root password, remove anonymous users, and more.
That's it! You've successfully installed a LAMP server on Ubuntu 20.04. You can now start building and hosting web applications on your server.
sudo mysql_secure_installation
Running sudo mysql_secure_installation is an important step in securing your MySQL installation on Ubuntu. When you run this command, you'll be guided through a series of prompts to improve the security of your MySQL server. Here's a step-by-step breakdown of what happens when you run sudo mysql_secure_installation:
Set Root Password: You will be prompted to set a new root password for MySQL. This is the password you'll use to log in as the MySQL root user, which has administrative privileges. Enter a strong password and make sure to remember it.
Remove Anonymous Users: You'll be asked if you want to remove anonymous MySQL users. It's a good idea to remove anonymous users, as they can potentially be a security risk. Answer "Y" (yes) to this prompt.
Disallow Root Login Remotely: You'll be asked if you want to disallow root login from remote machines. It's generally a good security practice to disallow root login remotely. Answer "Y" (yes) to this prompt.
Remove Test Database: You'll be asked if you want to remove the test database that is included by default with MySQL. Answer "Y" (yes) to this prompt. This is another security measure to prevent unauthorized access.
Reload Privilege Tables: The script will reload the privilege tables to apply the changes you've made.
After completing these steps, your MySQL installation will be more secure. Make sure to keep your MySQL root password in a safe place, as it's essential for administrative tasks on the MySQL server.