Introduction
A LAMP stack is a popular set of open-source software used to host websites and web applications. LAMP stands for Linux, Apache, MySQL, and PHP. This tutorial will walk you through the process of setting up a LAMP stack on your Linux VPS.
Step-by-Step Guide
Step 1: Update Your System
- Log in to your Linux VPS via SSH.
- Update your package manager and upgrade existing packages:
sudo apt update && sudo apt upgrade
Step 2: Install Apache
- Install the Apache web server package:
sudo apt install apache2
- Enable Apache to start at boot and start the service:
sudo systemctl enable apache2
sudo systemctl start apache2
Step 3: Install MySQL
- Install MySQL server:
sudo apt install mysql-server
- Run the secure installation script to set your MySQL root password and secure the installation:
sudo mysql_secure_installation
Step 4: Install PHP
- Install PHP and its Apache module:
sudo apt install php libapache2-mod-php php-mysql
- Restart Apache to enable PHP:
sudo systemctl restart apache2
Step 5: Test Your LAMP Stack
- Create a PHP info page to test PHP processing:
echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/info.php
- Open a web browser and visit http://your-server-ip/info.php to view the PHP info page.
- Delete the page after testing for security reasons:
sudo rm /var/www/html/info.php
Conclusion
Your LAMP stack is now ready to host websites and web applications. You can start deploying your projects on this robust and versatile stack. Be sure to follow