This guide installs WordPress on a self-hosted Linux server.
For Docker installation, see Docker.
| Component | Minimum | Recommended |
|---|---|---|
| PHP | 7.4 | 8.3+ |
| MySQL | 8.0 | 8.0+ |
| MariaDB | 10.6 | 10.6+ |
| RAM | 512MB | 1GB+ |
| Disk | 1GB | 5GB+ |
Install a LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack:
Ubuntu/Debian (LAMP):
sudo apt update
sudo apt install apache2 mariadb-server php php-mysql php-gd php-xml php-mbstring php-curl unzip
RHEL/CentOS:
sudo dnf install httpd mariadb-server php php-mysqlnd php-gd php-xml php-mbstring php-curl unzip
Create a MySQL database and user for WordPress:
mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'strong-password-here';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Download and extract WordPress:
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo mv wordpress /var/www/html/
sudo chown -R www-data:www-data /var/www/html/wordpress
Copy the sample configuration file and set unique keys:
cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php
Edit wp-config.php and update:
Apache: Create a virtual host pointing to /var/www/html/wordpress
Nginx: Configure server block with PHP-FPM support
Open http://YOUR-SERVER/wordpress in your browser and complete the setup wizard.
You’ll need to provide:
See WordPress Configuration for configuration guidance.
See WordPress Security for hardening guidance.
Prefer automation? See these Ansible setup options:
Prefer containers? See WordPress Docker Setup.
Setting up Wordpress can be complex. We offer consulting services for:
Contact us at office@linux-server-admin.com or visit our contact page.