How to Install WordPress on Ubuntu 22.04

This article explains how to install WordPress on Ubuntu 22.04. First, install the required PHP extensions and restart PHP-FPM. Next, configure Nginx for WordPress by updating the server block with the appropriate rules, then check the syntax and reload Nginx. Download the latest WordPress package, copy the files to the web root, and set the correct ownership. Then create the WordPress configuration file and update it with your database details, generate secure keys, and add the direct filesystem method line. Finally, complete the setup in a browser by selecting your language, entering the site and admin details, and logging in to reach the WordPress dashboard.

Prerequisites

Before starting, make sure you have:

Once you have finished the setup, log in to your server as the sudo user to proceed.

How to Install WordPress on Ubuntu 22.04?

Step 1: Install Required PHP Extensions

  1. WordPress needs certain PHP extensions to work properly. Run the following command:
sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip
  1. Restart PHP-FPM so the changes take effect:
sudo systemctl restart php8.0-fpm

Now your server is ready to support WordPress installation on Linux.

Step 2: Configure Nginx for WordPress

  1. Open your WordPress Nginx config file:
sudo nano /etc/nginx/sites-available/wordpress
  1. Update your server block with these rules:
server {
    ...
    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;
    }
    location / {
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php$is_args$args;
    }
    ...
}
  1. Check syntax and reload Nginx:
sudo nginx -t
sudo systemctl reload nginx

Step 3: Download WordPress

  1. Get the latest WordPress download package from the official site:
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
  1. Copy files to your web root:
sudo cp -a /tmp/wordpress/. /var/www/wordpress
sudo chown -R www-data:www-data /var/www/wordpress

Now WordPress files are ready in your server’s document root.

Step 4: Configure WordPress Settings

  1. Copy the sample config file:
cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
  1. Edit the configuration:
sudo nano /var/www/wordpress/wp-config.php
  1. Update with your database name, username, and password:
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'password' );
  1. Generate secure keys:
curl -s https://api.wordpress.org/secret-key/1.1/salt/

Replace the dummy values in your wp-config.php file.

  1. Add this line so WordPress can update without FTP:
define( 'FS_METHOD', 'direct' );

Save and exit.

Step 5: Complete WordPress Setup in Browser

Now, go to your domain or server IP in a browser:

http://yourdomain.com/wordpress
  1. Select your language.
    wordpress setup
  2. Enter site title, username, password, and email.
    wordpress setup
  3. (Optional) Disable search engine indexing if it’s a test site.
  4. Log in with your admin credentials.
    wordpress setup
    You’ll land on the WordPress dashboard, where you can manage your site.
    wordpress setup
  5. Right-click on Visit Site, and select Open in new tab. Your site will open in a new tab.
    wordpress setup
  6. The default home page of the latest version 5.9.3 of WordPress looks like the following.
    wordpress setup

Conclusion

Congratulations! You’ve completed the WordPress install on Ubuntu 22.04.
Now that WordPress is installed, you can:

  • Choose a theme
  • Install essential plugins
  • Add content
  • Customize your site

This WordPress installation guide helps you set up your website quickly, whether it’s for a blog, business, or e-commerce.

Keywords:

wordpress download, install wordpress, install wordpress on ubuntu, ubuntu wordpress, wordpress in ubuntu, wordpress setup, install wordpress linux, wordpress install on linux, wordpress setup guide, install wordpress ubuntu 22.04, install wordpress step by step, wordpress installation steps, download wordpress for linux, download wordpress for ubuntu, download wordpress on ubuntu, install wordpress on ubuntu 22.04, wordpress installation guide

Last Updated:   11/13/2026
Outline