iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Install (Local / Host)

Installing WordPress for local development: Docker, native LAMP, or LocalWP. Pick the friction level that fits the project.

WordPress — install

EXAMPLE
# ===== Option 1: Docker (recommended for dev) =====
# docker-compose.yml
version: '3.9'
services:
  wp:
    image: wordpress:6.5
    ports: ['8000:80']
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wp
      WORDPRESS_DB_PASSWORD: wp
      WORDPRESS_DB_NAME: wp
    volumes:
      - ./wp-content:/var/www/html/wp-content
    depends_on: [db]
  db:
    image: mariadb:11
    environment:
      MARIADB_DATABASE: wp
      MARIADB_USER: wp
      MARIADB_PASSWORD: wp
      MARIADB_ROOT_PASSWORD: rootpw
    volumes: [db-data:/var/lib/mysql]
volumes: { db-data: {} }

docker compose up -d
# Open http://localhost:8000; finish install via the web wizard.

# ===== Option 2: LocalWP (free GUI) =====
# https://localwp.com/
# - One-click site creation
# - Per-site PHP / MySQL versions
# - SSL out of the box
# - 'Live Link' to share with clients
# Best for non-engineers / quick sites.

# ===== Option 3: native LAMP / LEMP =====
# macOS:
brew install php composer mariadb
brew services start mariadb
# Then download WordPress from wordpress.org and unzip into a web-served folder.

# Ubuntu:
sudo apt install -y apache2 mariadb-server php php-mysql php-curl libapache2-mod-php
# Create DB, drop WP files into /var/www/html/, configure wp-config.php.

# ===== Option 4: XAMPP / WAMP / MAMP =====
# Windows / macOS one-click bundles (Apache + MySQL + PHP).
# Drop wordpress into htdocs/, browse to http://localhost/wordpress.

# ===== Verify =====
# Browse to your install URL.
# Run through the 5-minute wizard:
#   1. Choose language
#   2. DB connection (Docker compose env already wires this)
#   3. Site title + admin user + password + email
#   4. Install
# Log in at /wp-admin

# ===== WP-CLI (the under-loved superpower) =====
brew install wp-cli
# or: curl -O https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash

wp core download
wp config create --dbname=wp --dbuser=wp --dbpass=wp --dbhost=localhost
wp core install --url=http://localhost --title='My Site' --admin_user=admin --admin_password=admin --admin_email=a@x.io
wp theme install twentytwentyfour --activate
wp plugin install woocommerce --activate

# ===== Patterns to internalise =====
# - Docker for ephemeral dev sites
# - LocalWP for client work + previews
# - WP-CLI for everything repeatable (deploys, migrations, backups)
# - Mount wp-content as a volume; the rest can be replaced cleanly

# ===== Pitfalls =====
# - Default admin credentials left in place -> compromised within hours on public sites
# - Editing wp-config.php inside the container without volume -> wiped on rebuild
# - Mixing PHP versions across themes/plugins -> hard to debug
# - Skipping HTTPS in dev -> some features (REST cookies) misbehave

Why it matters

For dev WordPress: Docker for speed, LocalWP for clicks, WP-CLI for everything repeatable. Get the volume mounts right, never ship default admin credentials, and you have a stable development environment that mirrors most production hosts.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
# Easiest: managed host (Bluehost, WP Engine, Kinsta).
# Local: install LocalWP — one-click site.
Try it Yourself »

Discussion

Loading…