You can Watch all our Tutorials and Training Videos on our YouTube Channel for Free! Subscribe Now! & Free Web Tools available on

How to Install Wordpress on Ubuntu 20.04 for Free

install wordpress, install wordpress on ubuntu, how to install wordpress on ubuntu, wordpress installation on ubuntu, wordpress install ubuntu
How to Install Wordpress on Ubuntu 20.04 for Free

This post will help you to Setup and Install Wordpress on Ubuntu 20.04 for Free.

How to Install Wordpress on Ubuntu 20.04

WordPress is one of the very popular and demanding content management system (CMS) over the internet world. It helps us to create a Beautiful, Flexible, SEO friendly, Responsive, Customizable blogs or websites with the support of MySQL at the backend and PHP. user can easily manage and administrate everything related to the websites through browser that is available as a web frontend.

In order to have the complete wordpress installation, we would need to install Apache, MySQL, Php, Wordpress on Ubuntu 20.04 Linux Servers. We call this in short as LAMP Stack.

Install required dependencies

use apt-get command to update and install the required dependency packages.

selva@wordpress-hosting:~$ sudo apt-get update
selva@wordpress-hosting:~$ sudo apt-get -y install apache2 ghostscript libapache2-mod-php mysql-server php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip

Install Wordpress on Ubuntu

Get latest wordpress package directly from the official site as below rather than installing the wordpress available in apt package repository.

selva@wordpress-hosting:~$ sudo mkdir -p /var/www
selva@wordpress-hosting:~$ sudo chown www-data: /var/www
selva@wordpress-hosting:~$ curl | sudo -u www-data tar zx -C /var/www

Configure Apache for Wordpress

Let's create a apache configuration file for our wordpress site with below contents.

selva@wordpress-hosting:~$ cat /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
<Directory /var/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted

Enable the site using the command a2ensite.

selva@wordpress-hosting:~$ sudo a2ensite wordpress
Enabling site wordpress.
To activate the new configuration, you need to run:
systemctl reload apache2

Also enable URL rewriting using the command a2enmod.

selva@wordpress-hosting:~$ sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2

We dont need the default site anymore, hence disable it.

selva@wordpress-hosting:~$ sudo a2dissite 000-default
Site 000-default disabled.
To activate the new configuration, you need to run:
systemctl reload apache2

Restart Apache service for the changes to take effect.

selva@wordpress-hosting:~$ sudo service apache2 reload

Configure MySQL Database for Wordpress

Lets's create and configure MySQL database for Wordpress.

selva@wordpress-hosting:~$ sudo mysql -u root
mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.01 sec)
mysql> CREATE USER wordpress@localhost IDENTIFIED BY 'adminpass';
Query OK, 1 rows affected (0.01 sec)
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;
Query OK, 1 rows affected (0.02 sec)
Query OK, 1 row affected (0,00 sec)
mysql> quit

Once database is created, start the mysql service.

selva@wordpress-hosting:~$ sudo service mysql start

Integrate MySQL Database with Wordpress

In order to integrate and connect wordpress to MySql database, we need to create a configuration file. But we have sample files available already, we can just copy and make the necessary changes as per our request.

selva@wordpress-hosting:~$ sudo -u www-data cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Lets add our database and user details in the configuration file. Here just replace the highlighted word as per your details.

selva@wordpress-hosting:~$ sudo -u www-data sed -i 's/database_name_here/wordpress/' /var/www/wordpress/wp-config.php
selva@wordpress-hosting:~$ sudo -u www-data sed -i 's/username_here/wordpress/' /var/www/wordpress/wp-config.php
selva@wordpress-hosting:~$ sudo -u www-data sed -i 's/password_here/adminpass/' /var/www/wordpress/wp-config.php

Now be careful with the below steps as this is very important to make sure our site is not vulnerable from any attacks.

We need to get authentication tokens, secrets and values from the link given below and that has to be replaced properly.

selva@wordpress-hosting:~$ curl -s
define('AUTH_KEY', 'v;,s)d)ha@Jo!88!n~F/p(5`:f[yn1!5;*LytDfpmP]H!p&OUo[w`Fc/U{iIzu^r');
define('SECURE_AUTH_KEY', 'ejrWb!-|44Tku}p5Twpm{++F/yLbC(mUxTJF@oeRD,{#p9~u[LlH,rtG>sm4ytrF');
define('LOGGED_IN_KEY', 'RAd=H6G& ?[_4ovX5`Hv:r?8r-G]=?MPXgKhEC<0h2Nky51=8Ii_+?1iRHK_IH E');
define('NONCE_KEY', 'ss#A|3~Ozs14yMWFp5K^z)+ %_RA!8Lfwzkp!qK]gFfqev*|Py//{3f:R{t`EyP*');
define('AUTH_SALT', 'xB ,+05Ar@A]!=>cy(=E3|R3Jy.fP9_PK(vEyNPd}RWcs5:c`K.)(uNf/Wj,Myw|');
define('SECURE_AUTH_SALT', 'OeR6G~?/^r! _S2}y2oo4y>?xw4K~*0{x{Auz)>gsku&{(;T#Temi*fIDB%^e$<{');
define('LOGGED_IN_SALT', 'G{5%YgSaTr6~g/^+Ll:oA{3M#1j&WZIA5f$$xX<>NjP+s:Q8`*2Vl,ME wzvINfK');
define('NONCE_SALT', '}A8Ucv*b)5i|9*y;3nYSKJCaH[CL 8)^I=4P3u?H:_+Pl2kehq{>Wq.q0?kipzJT');

Above command gives you all the values required for the configurations.

Lets open the configuration file wp-config.php.

Find each values and replace the values with the above output.

selva@wordpress-hosting:~$ sudo -u www-data vim /var/www/wordpress/wp-config.php

Once the values are replaced, save and exit from the configuration file.

Configure Wordpress

Thats it, we are done with wordpress installation on Ubuntu.

Open the browser and enter http://localhost or to access our wordpress site.

You will be welcomed with Wordpress dashboard where you just follow the instructions to setup your login details to access your Wordpress Dashboard.

Hope this post helped you to Install Wordpress on Ubuntu 20.04.

If you are interested in learning, Request you to go through the below recommended tutorial.

DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

YouTube | Facebook | Twitter | Pinterest | Telegram

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.