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:
projectname.local)This guide explains everything step by step in a simple and practical way.
Before installing anything, update your Linux packages.
sudo apt update && sudo apt upgrade -y| Command | Purpose |
|---|---|
apt update | Refreshes package lists |
apt upgrade | Updates installed packages |
-y | Automatically confirms installation |
Apache is the web server that will run your PHP, Laravel, and WordPress projects.
sudo apt install apache2 -ysudo systemctl start apache2Enable Apache on system boot:
sudo systemctl enable apache2Open your browser and visit:
http://localhostIf you see the Apache default page, the installation worked successfully
Now install the database server.
sudo apt install mysql-server -yRun the MySQL security script:
sudo mysql_secure_installationDuring setup:
You can safely choose Y for most options.
sudo systemctl start mysqlEnable MySQL on boot:
sudo systemctl enable mysqlPHP is required for Laravel, WordPress, and other PHP applications.
sudo apt install php libapache2-mod-php php-mysql -yModern PHP frameworks require additional extensions.
sudo apt install php-cli php-curl php-zip php-mbstring php-xml php-bcmath unzip curl git -yphp -vAfter installing PHP modules, restart Apache.
sudo systemctl restart apache2If you want a graphical interface for managing databases:
sudo apt install phpmyadmin -yDuring installation:
Visit:
http://localhost/phpmyadminApache stores websites inside:
/var/www/htmlMove into that directory:
cd /var/www/htmlsudo mkdir myprojectGive ownership permissions:
sudo chown -R $USER:$USER /var/www/html/myprojectInstead of using:
localhost/myprojectYou can create a clean local domain like:
myproject.localThis is how professional local development environments are configured.
sudo nano /etc/apache2/sites-available/myproject.local.confPaste 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>| Line | Purpose |
|---|---|
ServerName | Defines your custom local domain |
DocumentRoot | Defines the project folder |
AllowOverride All | Enables .htaccess |
Require all granted | Allows browser access |
Required for Laravel routing.
sudo a2enmod rewritesudo a2ensite myproject.local.confOpen the hosts file:
sudo nano /etc/hostsAdd this line at the bottom:
127.0.0.1 myproject.localsudo systemctl restart apache2Open:
http://myproject.localYour local project should now load successfully
sudo systemctl restart apache2sudo systemctl stop apache2sudo systemctl status apache2sudo systemctl status mysqlsudo systemctl restart mysqlLinux
↓
Apache
↓
PHP
↓
MySQL
↓
Laravel / WordPress
↓
myproject.local
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 -yReady to take the first step towards unlocking opportunities, realizing goals, and embracing innovation? We're here and eager to connect.
01 Comment
A WordPress Commenter,
05 May, 2026Hi, 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.