Install LAMP Stack on Ubuntu 22.04
LAMP stack is a group of open-source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP, Perl, or Python.
Step 1: Update Your System
sudo apt update
Step 2: Install Apache2
sudo apt install apache2
After installing Apache2, you can verify that Apache2 is running by visiting your server's IP address in your web browser.
Step 3: Install MySQL Server
sudo apt install mysql-server
During the installation, you may be asked to set a root password for MySQL.
Step 4: Secure MySQL Installation
sudo mysql_secure_installation
This script will ask if you want to configure the VALIDATE PASSWORD PLUGIN, remove anonymous users, disallow root login remotely, remove test database and access to it, and finally will reload privilege tables.
Step 5: Install PHP
sudo apt install php libapache2-mod-php php-mysql
This command installs PHP and the PHP Extension and Application Repository (PEAR) packages, along with the necessary PHP modules to interact with MySQL. To install additional PHP modules, use the apt command with php- prefix.
Step 6: Restart Apache2
sudo systemctl restart apache2
This ensures that all of the new configurations are loaded.
Step 7: Install PhpMyAdmin (Optional)
sudo apt install phpmyadmin
During the installation, you will be asked to choose the web server (select apache2) and configure database settings with dbconfig-common. Enter your MySQL password when prompted and choose whether or not to configure the database for phpMyAdmin with dbconfig-common.
Access PhpMyAdmin by navigating to your server IP in your web browser, followed by /phpmyadmin (http://your_server_ip/phpmyadmin).
Note: The steps and packages mentioned are specific to Ubuntu 22.04 and may vary slightly for other versions or distributions.
If you have any questions or need further assistance, don't hesitate to reach out for support.