Development

When using a Linux system, many developers do not use XAMPP like they do on Windows.
Instead, Linux developers usually install a native development stack manually.

This setup is faster, cleaner, more stable, and more professional.

A typical Linux local development environment includes:

  • Apache Web Server
  • MySQL or MariaDB
  • PHP
  • phpMyAdmin
  • Custom Local Domains (projectname.local)

This guide explains everything step by step in a simple and practical way.

Step 1 — Update Your System

Before installing anything, update your Linux packages.

sudo apt update && sudo apt upgrade -y

What does this do?

CommandPurpose
apt updateRefreshes package lists
apt upgradeUpdates installed packages
-yAutomatically confirms installation

Step 2 — Install Apache

Apache is the web server that will run your PHP, Laravel, and WordPress projects.

Install Apache

sudo apt install apache2 -y

Step 3 — Start Apache

sudo systemctl start apache2

Enable Apache on system boot:

sudo systemctl enable apache2

Step 4 — Test Apache

Open your browser and visit:

http://localhost

If you see the Apache default page, the installation worked successfully

Step 5 — Install MySQL

Now install the database server.

sudo apt install mysql-server -y

Step 6 — Secure MySQL

Run the MySQL security script:

sudo mysql_secure_installation

During setup:

  • Create a root password
  • Remove anonymous users
  • Disable remote root login
  • Remove test database

You can safely choose Y for most options.

Step 7 — Start MySQL

sudo systemctl start mysql

Enable MySQL on boot:

sudo systemctl enable mysql

Step 8 — Install PHP

PHP is required for Laravel, WordPress, and other PHP applications.

sudo apt install php libapache2-mod-php php-mysql -y

Step 9 — Install Important PHP Extensions

Modern PHP frameworks require additional extensions.

sudo apt install php-cli php-curl php-zip php-mbstring php-xml php-bcmath unzip curl git -y

Step 10 — Check PHP Version

php -v

Step 11 — Restart Apache

After installing PHP modules, restart Apache.

sudo systemctl restart apache2

Step 12 — Install phpMyAdmin

If you want a graphical interface for managing databases:

sudo apt install phpmyadmin -y

During installation:

  • Select Apache2
  • Choose “Yes” for dbconfig-common

Step 13 — Open phpMyAdmin

Visit:

http://localhost/phpmyadmin

Step 14 — Default Web Root Directory

Apache stores websites inside:

/var/www/html

Move into that directory:

cd /var/www/html

Step 15 — Create a Project Folder

sudo mkdir myproject

Give ownership permissions:

sudo chown -R $USER:$USER /var/www/html/myproject

Step 16 — Create a Professional Local Domain

Instead of using:

localhost/myproject

You can create a clean local domain like:

myproject.local

This is how professional local development environments are configured.

Step 17 — Create a Virtual Host File

sudo nano /etc/apache2/sites-available/myproject.local.conf

Step 18 — Add Virtual Host Configuration

Paste this configuration:

<VirtualHost *:80>
    ServerName myproject.local

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/myproject/public

    <Directory /var/www/html/myproject/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

What does this configuration do?

LinePurpose
ServerNameDefines your custom local domain
DocumentRootDefines the project folder
AllowOverride AllEnables .htaccess
Require all grantedAllows browser access

Step 19 — Enable Apache Rewrite Module

Required for Laravel routing.

sudo a2enmod rewrite

Step 20 — Enable Your Virtual Host

sudo a2ensite myproject.local.conf

Step 21 — Edit Hosts File

Open the hosts file:

sudo nano /etc/hosts

Add this line at the bottom:

127.0.0.1 myproject.local

Step 22 — Restart Apache

sudo systemctl restart apache2

Step 23 — Test Your Local Domain

Open:

http://myproject.local

Your local project should now load successfully

Useful Apache Commands

Restart Apache

sudo systemctl restart apache2

Stop Apache

sudo systemctl stop apache2

Check Apache Status

sudo systemctl status apache2

Useful MySQL Commands

Check MySQL Status

sudo systemctl status mysql

Restart MySQL

sudo systemctl restart mysql

Final Development Flow

Linux
   ↓
Apache
   ↓
PHP
   ↓
MySQL
   ↓
Laravel / WordPress
   ↓
myproject.local

Quick Full Installation Command

Install everything together:

sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mysql-server php
libapache2-mod-php php-mysql php-cli php-curl
php-zip php-mbstring php-xml php-bcmath
composer unzip curl git -y

Decoding the Cloud A Deep Dive into SaaS Trends.

01 Comment

  • A WordPress Commenter,
    05 May, 2026

    Hi, this is a comment.
    To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
    Commenter avatars come from Gravatar.

Leave a comment

Your email address will not be published. Required fields are marked *

DROP US A LINE

Connect with Tawakkul Soft

Ready to take the first step towards unlocking opportunities, realizing goals, and embracing innovation? We're here and eager to connect.

image
To More Inquiry
+880 178 560 0347

Your Success Starts Here!