A
Alan Varghese
Guest
Ever wondered how websites like WordPress run behind the scenes? At the heart of many websites lies the LAMP stack β Linux, Apache, MySQL, and PHP.
In this guide, weβll walk through setting up your very own LAMP server at home step by step. By the end, youβll have a fully functioning web server to host your personal projects or learn server administration.
Prerequisites
Step 1: Update Your System
Always start with updating your system packages:
sudo apt update && sudo apt upgrade -y
This will make sure that all the existing softwares are up to date by synchronizing the repository with the version of package files in your local system.
Step 2: Install Apache (Web Server)
Apache is the web server that serves your websites to the visitors.
sudo apt install apache2 -y
Check if the Apache is running:
sudo systemctl status apache2
Now, open your browser and visit:
To see the Apache2 Ubuntu Default Page, that way we can confirm that Apache server is running.
Step 3: Install MySQL (Database Server)
MySQL stores your websiteβs data such as users, posts, and configurations.
sudo apt install mysql-server -y
Secure your MySQL installation:
sudo mysql_secure_installation
During this step, youβll have to:
Step 4: Install PHP (Scripting Language)
PHP allows dynamic content and interaction between Apache and MySQL.
To check its version:
Step 5: Test PHP
Create a PHP test file:
Paste this code:
Save and exit.
This will show the PHP info page.
Now, open your browser:
You should be able to see a PHP info page.
Step 6: Adjust Permissions (Optional)
If you plan to upload files frequently, adjust these permissions:
Step 7: (Optional) Access Your Server from Another Device
If youβre setting this up on a home server, find your local IP:
Then, from another device on the same network, visit:
Conclusion
Youβve successfully set up a LAMP server at home!
With this, you can:
Next steps:
Final Thoughts
Setting up a LAMP server is an excellent way to learn the foundations of web hosting and DevOps. With just a few commands, youβve created the backbone of the modern web, right from your home.
Continue reading...
In this guide, weβll walk through setting up your very own LAMP server at home step by step. By the end, youβll have a fully functioning web server to host your personal projects or learn server administration.

A computer running Linux (Ubuntu/Debian recommended).
Basic knowledge of the terminal.
Internet connection to install packages.
(Optional) A spare machine or virtual machine (VM).

Always start with updating your system packages:
sudo apt update && sudo apt upgrade -y
This will make sure that all the existing softwares are up to date by synchronizing the repository with the version of package files in your local system.

Apache is the web server that serves your websites to the visitors.
sudo apt install apache2 -y
Check if the Apache is running:
sudo systemctl status apache2
Now, open your browser and visit:
http://localhost
To see the Apache2 Ubuntu Default Page, that way we can confirm that Apache server is running.

MySQL stores your websiteβs data such as users, posts, and configurations.
sudo apt install mysql-server -y
Secure your MySQL installation:
sudo mysql_secure_installation
During this step, youβll have to:
Set a root password.
Remove anonymous users.
Disallow root login remotely.
Remove test databases.

PHP allows dynamic content and interaction between Apache and MySQL.
sudo apt install php libapache2-mod-php php-mysql -y
To check its version:
php -v

Create a PHP test file:
sudo nano /var/www/html/info.php
Paste this code:
<?php phpinfo(); ?>
Save and exit.
This will show the PHP info page.
Now, open your browser:
http://localhost/info.php
You should be able to see a PHP info page.

If you plan to upload files frequently, adjust these permissions:
sudo chown -R $USER:$USER /var/www/html

If youβre setting this up on a home server, find your local IP:
hostname -I
Then, from another device on the same network, visit:
http://<your-local-ip>

Youβve successfully set up a LAMP server at home!

With this, you can:
Host static/dynamic websites.
Install WordPress or other CMS.
Learn about databases and server management.

Secure your server with UFW firewall.
Add a domain name.
Explore Letβs Encrypt SSL for HTTPS.

Setting up a LAMP server is an excellent way to learn the foundations of web hosting and DevOps. With just a few commands, youβve created the backbone of the modern web, right from your home.
Continue reading...