In this article, we will have explained the necessary steps to install and configure WordPress on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
WordPress is the world’s leading content management system. Used by tens of millions of web pages and internet creators alike, WordPress is the backbone of most blogs, business websites, e-commerce stores, and much more. Webpage performance with WordPress is also typically one of the fastest available.
Install WordPress with LAMP on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
Step 2. Install LAMP Stack.
WordPress is built with PHP. You can host it like you would any other web app is written in PHP. So, you’re going to need to set Ubuntu up as either a LAMP server. If you haven’t done so already, use our traditional LAMP guide to set up Ubuntu to serve PHP before you continue.
Step 3. Install WordPress on Ubuntu system.
After installing the LAMP (Apache, MariaDB, and PHP) stack begin to download the latest version of WordPress:
Then, extract the archived file:
Change the owner and set the correct permissions for these files, you need to run the following command:
Step 4. Create a Database for WordPress.
WordPress uses MariaDB database to store all its data like posts, pages, users, plugins and themes settings. Log in to your MariaDB server with the following command and enter your MariaDB root password:
Once you’re in the MariaDB console, create a new database:
Once the database is created, we will need to add this information to the WordPress configuration file:
Now open the
wp-config.php file with your favourite text editor, for example:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
/** Database Charset to use in creating database tables. */
/** The Database Collate type. Don't change this if in doubt. */
Step 5. Configuring Apache for WordPress.
We can now create our virtual host files. Run the following command to create the virtual host configuration file for your domain, your_domain.com:
And add the following content to the file:
To enable the virtual host we have just created, run the following command:
For the new configuration to take effect, restart the Apache service by typing:
Step 6. Completing the WordPress Installation.
In the last step of this guide, we need to access the WordPress Web Interface and finish the installation. To finish the installation, open your browser and navigate to:
Then click Continue and type site title, Username, Password and Your Email. Now click Install WordPress.
That’s all you need to do to install WordPress on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.