Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Ubuntu for Developers Guide

By Kokil Thapa | Last reviewed: September 2026

You picked Ubuntu because it matches most production servers and CI runners. This Ubuntu for Developers Guide walks through a stack I ship daily: PHP 8.5, Laravel 13, Node.js 26 LTS, MySQL 9.7 or PostgreSQL 18, Redis 8.10, and Docker on Ubuntu 24.04 LTS. If you already run a Ubuntu server for Laravel or WordPress, the same patterns apply on your laptop. The goal is one environment that behaves like production, not a fragile local-only setup.

Which Ubuntu version should developers use in 2026?

Ubuntu 24.04 LTS (Noble Numbat) is the default choice for new machines in 2026. It is supported until 2029 with standard security updates. Ubuntu 22.04 LTS still runs on many VPS plans and client servers I maintain. Both work fine for PHP and Laravel work.

Pick Desktop if you want GNOME, a browser, and IDE on one box. Pick Server if the machine lives in a data centre or runs only services. For remote work from Kathmandu or abroad, Server plus SSH from your laptop is often cheaper than a heavy local VM.

Ubuntu Developer StackUbuntu 24.04 LTSPHP 8.5 + ComposerLaravel 13, Symfony 8.1Node.js 26 LTSnpm 12, Vite 8.xMySQL 9.7PostgreSQL 18Redis 8.10Nginx, Docker, Git, UFW
Ubuntu for Developers Guide — typical full-stack layers from OS to web server and containers
EditionBest forTrade-off
Ubuntu 24.04 DesktopLocal dev, design review, daily driverUses more RAM; extra packages you may not need
Ubuntu 24.04 ServerVPS, staging, production, CI runnersNo GUI; you work over SSH
Ubuntu 22.04 LTSExisting hosts, managed VPS defaultsNewer PHP repos target 24.04 first
WSL2 on WindowsWindows users who want Linux toolingFile I/O and Docker networking differ from bare metal

Before you install anything, run a full update. This matches what I do on every fresh VPS before Laravel or WordPress goes live.

sudo apt update && sudo apt full-upgrade -y
sudo apt install -y curl wget git unzip build-essential software-properties-common

Set your timezone if the server sits in Nepal or serves Nepali users. Use Asia/Kathmandu so cron jobs and log timestamps align with business hours.

sudo timedatectl set-timezone Asia/Kathmandu
timedatectl

How do you install PHP 8.5 and Composer on Ubuntu for Laravel 13?

Laravel 13 needs PHP 8.3 or higher. PHP 8.5 is the current anchor version in 2026. Laravel 12 still runs on PHP 8.2 and is supported until February 2027. On greenfield projects, standardise on 8.5 unless a legacy host blocks you.

I add the Ondřej Surý PPA on Ubuntu. It is the standard path for multiple PHP versions side by side. Full install steps live in the dedicated PHP on Ubuntu guide.

  1. Add the PPA and install PHP 8.5 with common extensions.
  2. Switch the CLI default with update-alternatives if you keep older versions.
  3. Install Composer 2.10 globally.
  4. Verify versions before you clone any project.
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install -y php8.5 php8.5-cli php8.5-fpm php8.5-mysql php8.5-pgsql \
  php8.5-redis php8.5-xml php8.5-mbstring php8.5-curl php8.5-zip php8.5-intl \
  php8.5-bcmath php8.5-gd php8.5-readline

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version
php -v

Create a new Laravel 13 app once PHP and Composer are ready. Use the official installer or composer create-project.

composer global require laravel/installer
laravel new myapp
cd myapp && php artisan serve

On production Laravel apps I maintain, opcache and realpath cache matter more than micro-optimisations in PHP code. Tune /etc/php/8.5/fpm/php.ini after your first deploy, not on day one of local setup.

How do you set up Node.js 26, databases, and Redis on Ubuntu?

Modern Laravel front ends use Vite 8.x. That needs Node.js 26 LTS and npm 12. Install Node from NodeSource rather than the outdated Ubuntu default package.

curl -fsSL https://deb.nodesource.com/setup_26.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm -v

Pick one primary database per project. MySQL 9.7 remains the common choice on shared hosting. PostgreSQL 18 is excellent for Laravel apps with JSON columns or strict constraints. Redis 8.10 handles cache, sessions, and queues.

MySQL install on Ubuntu is documented in the MySQL on Ubuntu tutorial. For PostgreSQL with Eloquent, see the PostgreSQL for Laravel developers guide.

sudo apt install -y mysql-server
sudo mysql_secure_installation

sudo apt install -y postgresql postgresql-contrib
sudo -u postgres createuser --interactive

sudo apt install -y redis-server
sudo systemctl enable redis-server
redis-cli ping

Point your Laravel .env at local services. Match driver names to the extensions you installed.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=myapp
DB_PASSWORD=secret

CACHE_STORE=redis
SESSION_DRIVER=redis
QUEUE_CONNECTION=redis
REDIS_HOST=127.0.0.1
Developer Setup Workflow1. Base OS2. Runtimes3. Database4. Web tier5. Clone app6. .env + migrate7. npm run build8. RunningCommon gotcha: wrong PHP-FPM socketMatch Nginx fastcgi_pass to /run/php/php8.5-fpm.sock
Step-by-step Ubuntu for Developers Guide workflow from fresh install to a running Laravel app

How do you configure Nginx and Docker for local and staging environments?

php artisan serve is fine for quick checks. It is not how I run staging or production. Nginx plus PHP-FPM matches real hosting and catches path and permission bugs early.

Follow the Nginx on Ubuntu install guide for package setup. A minimal site block for a Laravel app in /var/www/myapp/public looks like this.

server {
    listen 80;
    server_name myapp.test;
    root /var/www/myapp/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.5-fpm.sock;
    }
}

Add a local hostname in /etc/hosts if you are not using Laravel Valet or Docker-based reverse proxies.

Docker isolates services when you juggle multiple client projects. The Docker on Ubuntu guide covers engine install. Laravel Sail wraps Docker for teams that want one command to boot the stack.

curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world

On a booking platform like Adventure Third Pole Trek, I run queue workers and scheduler via systemd or Supervisor on Ubuntu. Docker handles local parity; systemd handles long-running processes on the VPS.

What security and maintenance steps matter before production?

Developers often skip hardening on laptops. That habit follows you to production. Lock down SSH, enable a firewall, and keep packages current before the first deploy.

  • Create a sudo user; disable root SSH login.
  • Enable UFW: allow OpenSSH, then HTTP and HTTPS only when needed.
  • Install fail2ban for brute-force protection.
  • Turn on unattended security upgrades on servers.
  • Set correct ownership on storage/ and bootstrap/cache/.

The Ubuntu security hardening guide and security updates guide cover details. File permissions break Laravel after every bad chmod -R 777. Read Ubuntu file permissions explained before you “fix” upload errors.

sudo adduser deploy
sudo usermod -aG sudo deploy
sudo ufw allow OpenSSH
sudo ufw enable
sudo apt install -y fail2ban

Schedule backups and cron on the same user context as deployment. Stale paths in crontab are a recurring production bug I see after symlink-based deploys. The Ubuntu cron jobs guide shows how to pin absolute paths.

Desktop vs Server for DevUbuntu DesktopGNOME + browser + IDELocal artisan serveDocker Desktop optionalBest: solo dev daily driverPros: fast feedback loopCons: heavier RAM useUbuntu ServerSSH-only headless hostNginx + PHP-FPM + RedisGitLab CI or Deployer 7Best: staging + productionPros: matches live VPSCons: no local GUIUse both: Desktop locally, Server remotely
Ubuntu for Developers Guide — when to use Desktop versus Server editions

How do you deploy Laravel and WordPress projects from Ubuntu dev to production?

Local Ubuntu should mirror production Ubuntu. Same PHP minor version, same extensions, same queue driver. Surprises show up when staging runs PHP 8.1 and production runs 8.5.

I deploy most Laravel sites with Deployer 7 and GitLab CI. The pipeline runs tests, builds front-end assets with Vite, then releases to a symlinked directory on Ubuntu. PHP-FPM reload clears opcache after each swap. Sister legal-tech sites on shared EC2 use this exact pattern.

Environment variables belong in .env on the server, never in Git. The Ubuntu environment variables guide explains persistence across shells and systemd units. For JSON API payloads during integration work, keep the JSON formatter tool open in a tab.

WordPress 7.1 and WooCommerce 11.1 run well on the same LAMP or LEMP stack. Point the web root at public_html or map a vhost to the WordPress directory. Magento 2.4.x and Shopify theme work still benefit from Linux tooling even when production sits elsewhere.

Performance tuning on Ubuntu covers opcache, MySQL buffers, and Redis memory limits. See speed up Ubuntu performance before you upsize a VPS. Network changes on cloud hosts go through Netplan — the Ubuntu Netplan tutorial saves hours when a static IP or secondary NIC appears after reboot.

Deploy Pipeline on UbuntuGit pushGitLab CInpm buildDeployer 7Ubuntu VPSsymlink releaseRollbackdep rollbackReload PHP-FPM after deploy to flush opcache
Production deploy flow used in this Ubuntu for Developers Guide — Git, CI, Deployer, and PHP-FPM reload

Official references worth bookmarking: the Ubuntu Server documentation, Laravel 13 deployment docs, and Node.js release schedule. They stay current when distro packages lag by a few weeks.

If you need hands-on help tuning Ubuntu for client workloads, see Linux system administration in Nepal or broader web development services. Full-stack hiring context lives in the full-stack developer in Nepal and Laravel developer in Nepal articles. Desktop users should read the Ubuntu desktop complete guide for GNOME tweaks that do not fight your terminal workflow.

Key Takeaways

  • Standardise on Ubuntu 24.04 LTS with PHP 8.5, Composer 2.10, and Node.js 26 LTS for new Laravel 13 work.
  • Install Nginx, PHP-FPM, Redis, and one database locally so staging matches production behaviour.
  • Harden SSH, enable UFW, and install fail2ban before exposing any dev box to the internet.
  • Use Docker for multi-project isolation; use Deployer 7 or similar for zero-downtime Ubuntu releases.
  • Fix permissions with intent — never chmod 777 on Laravel storage/ directories.
  • Reload PHP-FPM after every deploy so opcache serves fresh code, not stale bytecode.

People Also Ask

Is Ubuntu better than macOS or Windows for web development?

Ubuntu matches most Linux production servers, so deploy surprises are rarer. macOS is strong for local dev with Homebrew. Windows plus WSL2 closes much of the gap. For PHP and Laravel teams, Ubuntu on a VPS plus Ubuntu or WSL locally is the most predictable combo in 2026.

Can I run multiple PHP versions on the same Ubuntu machine?

Yes. The Ondřej Surý PPA installs 8.3, 8.4, and 8.5 side by side. Point Nginx fastcgi_pass at the correct FPM socket per site. Use update-alternatives to switch the CLI default when you run Composer or Artisan.

How much RAM does an Ubuntu developer machine need?

8 GB works for light PHP and Vue work. 16 GB is comfortable with Docker, Chrome, and an IDE open. Queue workers, Elasticsearch, or Android emulators push you toward 32 GB. On budget VPS plans in Nepal, start at 2 GB for staging only — not for Docker-heavy local parity.

Do I need a separate staging server on Ubuntu?

For client-facing Laravel or WooCommerce projects, yes. Staging on the same Ubuntu version as production catches extension gaps and permission bugs. A small 2 vCPU / 4 GB VPS often costs Rs 1,500–3,000/month (~USD 11–22), which is cheap compared to a bad deploy.

Build your Ubuntu dev environment with confidence

This Ubuntu for Developers Guide reflects stacks I run on legal-tech portals, eCommerce builds, and booking systems shipped since 2010. Start with 24.04 LTS, mirror production services locally, harden before you expose ports, and automate deploys once the app earns traffic. When you want someone who handles code, server, and deploy on one Ubuntu pipeline, contact us or browse the portfolio for live examples.

Frequently Asked Questions

Ubuntu 24.04 LTS (Noble Numbat) is the default for new machines, with standard security updates until 2029. Ubuntu 22.04 LTS still runs on many VPS plans and client servers and works fine for PHP and Laravel. Pick Desktop for GNOME, browser, and IDE on one box; pick Server for data-centre hosts or SSH-only remote work from Kathmandu or abroad.

Ubuntu 24.04 LTS with PHP 8.5, Laravel 13, Composer 2.10, Node.js 26 LTS, npm 12, Vite 8.x, MySQL 9.7 or PostgreSQL 18, Redis 8.10, and Docker — one environment that mirrors production.

Laravel 13 needs PHP 8.3 or higher; on greenfield projects standardise on PHP 8.5. Add the Ondřej Surý PPA, run apt update, then install php8.5 with common extensions including mysql, pgsql, redis, xml, mbstring, curl, zip, intl, bcmath, gd, and readline. Install Composer 2.10 globally via getcomposer.org, verify with composer --version and php -v, then create apps with the Laravel installer or composer create-project. Use update-alternatives if older PHP versions stay installed.

Modern Laravel front ends need Node.js 26 LTS and npm 12 from NodeSource, not Ubuntu’s outdated default Node package. Pick one primary database: MySQL 9.7 for shared-hosting parity, or PostgreSQL 18 for JSON columns and strict constraints. Install redis-server, enable it, and confirm with redis-cli ping. Point your Laravel .env at local services with matching drivers for cache, sessions, and queues via Redis on 127.0.0.1.

php artisan serve suits quick checks but not staging or production. Nginx plus PHP-FPM on Ubuntu matches real hosting and catches path and permission bugs early. Point the server root at your Laravel public directory, pass PHP to the php8.5-fpm socket, and add a local hostname in /etc/hosts if needed. Install Docker via get.docker.com, add your user to the docker group, and use Laravel Sail for one-command stacks when juggling multiple client projects.

Lock down SSH before the first deploy: create a sudo user, disable root login, enable UFW allowing OpenSSH first then HTTP and HTTPS when needed, and install fail2ban against brute-force attempts. Turn on unattended security upgrades on servers. Set correct ownership on Laravel storage/ and bootstrap/cache/ — never chmod -R 777. Schedule backups and cron with absolute paths pinned to your deploy user, because stale crontab paths break after symlink-based releases.

Local Ubuntu should mirror production: same PHP minor version, extensions, and queue driver. I deploy most Laravel sites with Deployer 7 and GitLab CI — tests run, Vite builds front-end assets, then releases land in a symlinked directory with PHP-FPM reload to clear opcache. Keep secrets in server .env, never Git. WordPress 7.1 and WooCommerce 11.1 run on the same LAMP or LEMP stack; point the web root at public_html or map a vhost to the WordPress directory.

Ubuntu matches most Linux production servers, so deploy surprises are rarer. macOS is strong for local dev with Homebrew. Windows plus WSL2 closes much of the gap, though file I/O and Docker networking differ from bare metal. For PHP and Laravel teams in 2026, Ubuntu on a VPS plus Ubuntu or WSL locally is the most predictable combo. WSL2 suits Windows users who want Linux tooling without a dedicated Linux laptop.

Yes. The Ondřej Surý PPA installs 8.3, 8.4, and 8.5 side by side; point Nginx fastcgi_pass at the correct FPM socket per site and use update-alternatives for the CLI default.

8 GB for light PHP work; 16 GB with Docker, Chrome, and an IDE; 32 GB for queue workers or emulators. Budget VPS staging starts at 2 GB — not for Docker-heavy local parity.

For client-facing Laravel or WooCommerce projects, yes. Staging on the same Ubuntu version as production catches extension gaps and permission bugs before users see them. A small 2 vCPU / 4 GB VPS often costs Rs 1,500–3,000/month (~USD 11–22), which is cheap compared to a bad deploy. Match PHP minor versions between staging and production — surprises appear when staging runs PHP 8.1 and production runs 8.5.

php artisan serve is fine for quick checks after you clone a project or run composer install. It is not how I run staging or production. Nginx plus PHP-FPM on Ubuntu matches real hosting and surfaces rewrite, path, and permission issues early. A minimal site block listening on port 80 with try_files routing to index.php and fastcgi_pass to the php8.5-fpm socket mirrors what runs on VPS plans I maintain for legal-tech and eCommerce clients.

Run a full update first — sudo apt update and sudo apt full-upgrade -y — then install curl, wget, git, unzip, build-essential, and software-properties-common. This matches what I do on every fresh VPS before Laravel or WordPress goes live. Set timezone to Asia/Kathmandu if the server sits in Nepal or serves Nepali users so cron jobs and log timestamps align with business hours. Verify with timedatectl before you install databases or web servers.

File permissions break Laravel after every bad chmod -R 777. Storage and bootstrap/cache need correct ownership for the web server and deploy user, not world-writable directories. Developers who skip hardening on laptops often carry that habit to production. Read Ubuntu file permissions guidance before you “fix” upload errors — the right fix is intentional ownership on storage/ and bootstrap/cache/, not opening every directory to any process on the box.

Docker isolates services when you juggle multiple client projects locally and gives parity without polluting the host PHP or database versions. Laravel Sail wraps Docker for teams wanting one command to boot the stack. On a VPS, queue workers and the Laravel scheduler run via systemd or Supervisor — long-running processes that must survive reboots. Docker handles local parity; systemd handles production workers on Ubuntu servers I deploy with Deployer 7 and GitLab CI.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: