Install Apache, PHP, and MySQL on Ubuntu 22.04 (Jammy Jellyfish)
Ubuntu is one of the most popular Linux distributions in the market due to its ease of use and interoperability. If you are a web developer or need to configure a project developed in PHP with Apache and MySQL, this tutorial will guide you step by step to set up the necessary packages for such purposes in version Jammy Jellyfish of this operating system.
You can see this same tutorial for other Ubuntu versions in the following links:
- Install Apache, PHP, and MySQL on Ubuntu 20.04 (Focal Fossa)
Installation
The first step is to install the packages for the web server and the PHP language.
sudo apt-get install apache2 php
We can then install the MySQL server with the following command.
sudo apt-get install mysql-server
Once this is done, the next step will be to make the installation secure. This means making some configurations such as verifying that the passwords created are secure (length, special characters, uppercase and lowercase), removing anonymous users, disabling remote login, and deleting test databases. You can use the following command and follow the instructions.
sudo mysql_secure_installation
And that's it, you can now log in. Don't forget to check out our post on Terminal Connection to MySQL to see the different options for connecting.
Configuration
Once Apache, PHP, and MySQL are installed, it is advisable to make some configurations. To see a complete Apache configuration from scratch, you can follow the link below.
Configure Apache from scratch on Linux