Skip to main content
LinuxLinuxUbuntuOpen Source

How to install WordPress on Ubuntu

Apisylux TeamApril 28, 20232 min read

Knowledge map

Article briefing

Published
Linux
Topic category
2 min read
Estimated reading time
Apisylux Team
Author
April 28, 2023
Published
July 8, 2026
Last updated
5
Tags
1
Category
2m
Read Time
1
Next Step
How to install WordPress on Ubuntu
How to install WordPress on Ubuntu article image
How to install WordPress on Ubuntu - preserved image from the migrated article.

Overview

To install WordPress on Ubuntu, follow these steps:

  • Update your Ubuntu system: Run the following commands in your terminal:
sudo apt-get update
sudo apt-get upgrade
  • Install Apache, MySQL, and PHP: Install the required packages by running:
sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php
  • Create a MySQL database and user for WordPress: Log in to MySQL:
mysql -u root -p

Enter your root password, then run the following commands:

Free Consultation

Need help with Linux?

Get a free strategy session with our experts — no commitment required.

Contact Us
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;

Replace password with a strong password of your choice.

  • Download and extract WordPress: Run:
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo mv wordpress/* .
sudo rmdir wordpress

Key steps and notes

  • Set file permissions: Run:
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
  • Create an Apache virtual host configuration:
sudo nano /etc/apache2/sites-available/wordpress.conf

Add the following configuration:

 ServerAdmin admin@example.com DocumentRoot /var/www/html/ ServerName example.com ServerAlias www.example.com  AllowOverride All  ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined

Replace example.com with your domain name or server IP address.

  • Enable the virtual host and rewrite module:
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
  • Restart Apache:
sudo service apache2 restart

Final notes

  • Complete the installation: Open your website in a browser and follow the WordPress setup instructions.

That’s it! You have successfully installed WordPress on Ubuntu.

Launch readiness

Let's turn your website into a working growth system.

Bring the goal. We'll help shape the offer, interface, lead flow, launch plan, and next actions so your website feels ready for real buyers.

Start Your Project

Project readiness panel

Online

Scope clarity

Discovery ready

Performance plan

Speed-first build

Launch path

Secure deploy

Lead flow

CRM-ready handoff

Free

Consultation

<24h

Response

Clear

Plan

Next action

Share your current website, project goal, and deadline. We'll return with a practical improvement path and first-step estimate.