Welcome Demo
Setting up a LAMP (Linux, Apache, MySQL, PHP) server on Debian involves several steps. Here's a step-by-step guide to help you get started:
Step 1: Install Debian
Step 2: Update the System
sudo apt update
sudo apt upgrade
Step 3: Install Apache Web Server
Install Apache using the package manager:
sudo apt install apache2
Start the Apache service and enable it to start on boot:
sudo systemctl start apache2
sudo systemctl enable apache2
Verify that Apache is running by opening a web browser and entering your server's IP address or domain name.
Step 4: Install MySQL Database Server
Install MySQL server and client packages:
sudo apt install mysql-server mysql-client
During the installation, you will be prompted to set the root password for MySQL. Choose a strong password and remember it.
Start the MySQL service and enable it to start on boot:
sudo systemctl start mysql
sudo systemctl enable mysql
Secure your MySQL installation by running the security script:
sudo mysql_secure_installation
Step 5: Install PHP
Install PHP and necessary modules:
sudo apt install php libapache2-mod-php php-mysql
After installation, restart Apache for the PHP module to be loaded:
sudo systemctl restart apache2
Step 6: Test PHP
Create a PHP info file to check if PHP is working correctly:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php
Open a web browser and access http://your_server_ip/phpinfo.php
. You should see the PHP info page displaying various PHP configuration details.
Step 7: Configure Firewall (Optional)
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
Step 8: Optional Steps
That's it! You now have a LAMP server set up on your Debian system. You can proceed to deploy web applications or host websites on your server. Remember to keep your system and software up-to-date and maintain security best practices.