31.1 C
Senior Writer and partner

How to install WordPress on Ubuntu 20.04?

In today’s world, everything is Internet and information sites. There is too much variety in them. But we also find a lot of variety of applications that allow us to make websites. In this way, we find a nice CMS competition. That is to say, web applications that allow creating a blog without much effort. Of all these, WordPress is the most popular and solvent of all. That’s why, in this post, you will learn how to install WordPress on Ubuntu 20.04.

What is WordPress?

There are many blogs and information sites on the Internet. And many times we think “wow, that’s nice, how did they do that?” and immediately we think of the many skills you need to have to do something like that. This is partly true because there was a developer who created the theme you see, but it is also true that the creation of the site is probably done with a CMS. Within these CMS WordPress stands out as one of the best and most complete.

WordPress is a CMS (content manager system) that is to say it is an application that allows you to create a blog of information. However, over time has evolved and not only provides services to create blogs but corporate websites or what you can imagine.

Thanks to WordPress and CMS, publish news and entries, do not require knowledge of HTML or PHP, but everything is visual.

- Advertisement -

So, if you want to have a personal blog or for educational purposes, WordPress is a pretty good solution.

Install WordPress on Ubuntu 20.04

Install LAMP stack on Ubuntu 20.04

Since it is created with PHP, WordPress requires a web server that can interpret it as well as a relational database manager like MariaDB. So, we are talking about a LAMP stack.

How to install LAMP on Ubuntu 20.04?

It is also important to say that, WordPress also works with other web servers like Nginx or Lighttpd.

It also requires certain PHP modules like these:

Once you have completed this first part of the tutorial, you can continue.

libapache2-mod-php7.4 php7.4-common php7.4-mbstring php7.4-xmlrpc php7.4-soap php7.4-gd php7.4-xml php7.4-intl php7.4-mysql php7.4-cli php7.4-ldap php7.4-zip php7.4-curl

Install MariaDB on Ubuntu 20.04

Once MariaDB is successfully installed, a new database must be created for WordPress.

It is also important to create a new user who has permissions on that database. In this way, we will avoid working and using the root user. This would be an important security breach.

So, open the MariaDB console:

:~$ sudo mysql -u root -p

And it creates the new database and the user along with their permissions:

> CREATE DATABASE wordpress;
> GRANT ALL PRIVILEGES on wordpress.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'wordpress_pss123';

1.- Creating the database for wordpress
1.- Creating the database for wordpress

Now MariaDB is ready for wordpress.

Download and install WordPress on Ubuntu 20.04

Now it is time to download WordPress. To do this, I recommend you do it from the tmp folder.

:~$ cd /tmp/

And using wget it performs the download:

:~$ wget -c https://wordpress.org/latest.tar.gz

2.- Download WordPress on Ubuntu 20.04
2.- Download WordPress on Ubuntu 20.04

Then, decompress the generated file and move it to the Apache root folder on Ubuntu 20.04.

:~$ tar -xvzf latest.tar.gz
:~$ sudo mv wordpress/ /var/www/html/

Then, assign the corresponding permissions as well as change the owner of the folder to www-data

:~$ sudo chown -R www-data:www-data /var/www/html/wordpress/
:~$ sudo chmod 755 -R /var/www/html/wordpress/

Now we have to make a new Virtualhost for WordPress.

:~$ sudo nano /etc/apache2/sites-available/wordpress.conf

And add the following content to set the rules that Apache will use with WordPress.

<VirtualHost *:80>
    ServerAdmin admin@your_domain.com
    DocumentRoot /var/www/html/wordpress
    ServerName blog.osradar.test

    <Directory /var/www/html/wordpress>
         Options FollowSymlinks
         AllowOverride All
         Require all granted

ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

3.- Virtuahost for WordPress
3.- Virtuahost for WordPress

Of course, change blog.osradar.test and your-domain for yours. It’s just an example. Then, save the changes and close the file.

To enable the new Virtualhost, run the following command:

:~$ sudo ln -s /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf

Then, enable Apache’s rewrite module.

:~$ sudo a2enmod rewrite

And to implement all these changes, all you have to do is restart Apache.

:~$ sudo systemctl restart apache2

Now, we have to complete the installation.

Install WordPress on Ubuntu 20.04

Then open your web browser and go to http://your-domain and you will see the following screen:

4.- WordPress initial screen
4.- WordPress initial screen

In it, you have to choose the installation language. WordPress supports many, so you should have no problem finding yours.

Then, configure the parameters of the database we have created.

5.- Database credentials to install WordPress on Ubuntu 20.04
5.- Database credentials to install WordPress on Ubuntu 20.04

If the installer manages to connect to the database, you will be informed that you are ready to start the installation.

6.- WordPress ready to be installed
6.- WordPress ready to be installed

Then, add information about your new site. As well as create the new WordPress Admin account.

7.- Creating the new WordPress site
7.- Creating the new WordPress site

In the end, if everything has gone well, you will be informed and then you can log in with your credentials.

8.- WordPress log in screen
8.- WordPress log in screen

Finally, you will see the WordPress dashboard and you can start the customization of your website.

9.- WordPress dashboard on Ubuntu 20.04
9.- WordPress dashboard on Ubuntu 20.04


WordPress is a fairly popular CMS. Thanks to this application, you can create your website in a short time and without great knowledge of HTML. Also, in this post, you have seen that installing it is not too complicated for the great advantages it provides.

Please share this post with your friends and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"



Please enter your comment!
Please enter your name here

Latest article