Your cart is currently empty!
Install a Full LAMP Stack on a Debian Server
If you’re building a website or web app on a Debian server, you’ll probably want the tried-and-true LAMP stack: Linux, Apache, MySQL, PHP. Here’s how to get it up and running, fast.
What is LAMP?
- Linux: Your server’s operating system (we’re using Debian).
- Apache: The web server.
- MySQL: The database engine.
- PHP: The scripting language for dynamic sites.
Let’s get started.
1. Update Your Server
First, make sure your server’s package list and installed packages are up to date.
sudo apt update
sudo apt upgrade -y
2. Install Apache
Apache is reliable and easy to set up.
sudo apt install apache2 -y
When it’s done, check Apache is running:
sudo systemctl status apache2
Visit your server’s IP in your browser. You should see the Apache2 Debian Default Page.
3. Install MySQL
Now, install the database engine.
sudo apt install mysql-server -y
Secure your MySQL installation:
sudo mysql_secure_installation
Set a root password, remove test databases, and tighten up security as prompted.
4. Install PHP
Let’s add PHP, which connects Apache and MySQL.
sudo apt install php libapache2-mod-php php-mysql -y
Check PHP is working:
php -v
5. Test PHP with Apache
Create a test file:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Go to http://your_server_ip/info.php
in your browser. You should see PHP info.
Don’t forget to remove this file when you’re done:
sudo rm /var/www/html/info.php
6. Adjust Firewall (If Needed)
If you use UFW (Uncomplicated Firewall):
sudo ufw allow in "Apache Full"
sudo ufw enable
7. Done—You’re Ready!
You now have Apache, MySQL, and PHP running on Debian.
This stack is ready for WordPress, custom PHP apps, or whatever you want to build.
Pro Tip:
Remember to keep your software up to date and always use strong passwords for databases.
Have any questions or hit a snag? Drop a comment below and I’ll help you out.
Ready for more?
Stay tuned for guides on setting up virtual hosts, SSL certificates, or deploying WordPress on your new LAMP stack.
Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!