Here’s how you can do it using tasksel for the full LAMP stack setup:
Steps to Install LAMP Stack Using tasksel:
1. Update Package List
First, update your package list to ensure you have the latest packages:
sudo apt update
2. Install tasksel
Install tasksel if it’s not already installed:
sudo apt install tasksel
3. Install LAMP Stack Using tasksel
To install the LAMP stack, simply use tasksel:
sudo tasksel install lamp-server
This command will install:
- Apache2 (web server)
- MySQL (database server)
- PHP (for dynamic content)
- Additional PHP modules needed to integrate with Apache and MySQL
After the installation, Apache2, MySQL, and PHP will be installed and configured.
4. Install phpMyAdmin Using tasksel
If you also want to install phpMyAdmin, you can use tasksel for that as well:
sudo tasksel install phpmyadmin
This command installs phpMyAdmin, which is a web-based interface to manage MySQL databases.
5. Check the Installation
Once the installation is complete, you can check if everything is set up:
Apache: Open your web browser and visit http://localhost/. You should see the Apache2 default page.
phpMyAdmin: Visit http://localhost/phpmyadmin/ in your browser. If everything is set up, you should see the phpMyAdmin login page. Log in with the MySQL root user or any other MySQL user you created during installation.
6. Restart Apache2
In case Apache2 or other services are not running automatically, you can restart Apache2 and MySQL manually:
sudo systemctl restart apache2
sudo systemctl restart mysql
7. Configure Firewall (Optional)
If you have a firewall enabled, allow HTTP and HTTPS traffic:
sudo ufw allow in "Apache Full"
8. Clean Up (Optional)
After confirming everything works, remove any unnecessary files or temporary configurations. For example, remove info.php file (if you created it to test PHP):
sudo rm /var/www/html/info.php
FLUSH PRIVILEGES;