How To Install WordPress 5.5 On Ubuntu 20.04 Server

We can install and configure the WordPress on ubuntu server 20.04. We’ve installed the WordPress 5.5 on EC2 instance ubuntu 20.04. Let’s see, how to install WordPress on ubuntu.

How To Install WordPress 5.5 On Ubuntu 20.04 Server 

1. We need the LAMP setup to install WordPress on ubuntu 20.04. you have to install the git to download the WordPress from GitHub or you can manually download the package. 

root@curiousviral:~# apt update -y
root@curiousviral:~# apt upgrade -y
root@curiousviral:~# apt install git -y
root@curiousviral:~# git clone https://github.com/WordPress/WordPress.git
Cloning into 'WordPress'...
remote: Enumerating objects: 98, done.
remote: Counting objects: 100% (98/98), done.
remote: Compressing objects: 100% (73/73), done.
remote: Total 329288 (delta 73), reused 41 (delta 25), pack-reused 329190
Receiving objects: 100% (329288/329288), 226.89 MiB | 29.36 MiB/s, done.
Resolving deltas: 100% (265895/265895), done.

Check Out: How To Install Openfire XMPP Server On CentOS 8 / 7

2. Install the required packages of PHP on Ubuntu using the below command. 

apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php php-common php-mysql php-mcrypt

Check the PHP version. 

root@curiousviral:~# php -v
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

3. Install Apache2 and Mysql 5.7 server on ubuntu 20.04. 

apt install mysql-server mysql-client
apt install apache2

We need to enable and start the Apache and MySQL service. 

root@curiousviral:~# systemctl start apache2 && systemctl enable apache2
root@curiousviral:~# systemctl start mysql && systemctl enable mysql
root@curiousviral:~# systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-08-17 13:28:19 UTC; 2min 29s ago
Main PID: 33778 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 1164)
Memory: 323.1M
CGroup: /system.slice/mysql.service
└─33778 /usr/sbin/mysqld

Configure MySQL Database:

You can find the Apache file location at /etc/apache2 and Mysql at /etc/mysql

Check Out: How To Install WordPress 4.9.x On Redhat/CentOS 7

We need to secure the MySQL server and check the version using the below command. 

root@curiousviral:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.21-0ubuntu0.20.04.4 (Ubuntu)

Create a user, database, and assign full permission to the user. Login to the MySQL server. We’ve successfully created the database and assign the permission. 

mysql> create database abc;
Query OK, 1 row affected (0.02 sec)

mysql> create user 'Web'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON CV.* TO 'Web'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Configure WordPress 5.5 :

4. Move WordPress to the directory /var/www/html and also create a virtual host. 

mv WordPress /var/www/html/

We need to change the owner and permission on the WordPress folder using the following commands. 

chown -R www-data:www-data /var/www/html/WordPress/
chmod -R 755 /var/www/html/WordPress/

Create an upload directory inside /var/www/html/WordPress/wp-content

mkdir -p /var/www/html/WordPress/wp-content/uploads

Check Out: How To Configure Free SSL Certificate Using Certbot On Ubuntu

5. Allow port 80 and 443 in the firewall rules. 

root@curiousviral:~# ufw allow 80
root@curiousviral:~# ufw allow 443
root@curiousviral:~# ufw enable
root@curiousviral:~# ufw status
Status: active

To         Action           From
-- ------ ----
80         ALLOW            Anywhere 
443        ALLOW            Anywhere 
80 (v6)    ALLOW            Anywhere (v6) 
443 (v6)   ALLOW            Anywhere (v6)

6. If you’ve launched the server on AWS, we need to open the port 80 and 443 from the security group.

wordpress on ubuntu

7. We also need to define the DB details in the wp-config.php file. Take a backup of the original file.

mv wp-config-sample.php wp-config-sample.php-back
cp wp-config-sample.php-back wp-config.php
vim wp-config.php

Change your database settings here and save the file.

/** The name of the database for WordPress */
define( 'DB_NAME', 'abc' );

/** MySQL database username */
define( 'DB_USER', 'Web' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

8. Now you can access the WordPress using http://publicip/WordPress then Create a WordPress user and click on Install WordPress.

wordpress on ubuntu server 20.04

Check Out: How To Fix the Upload Max File Size Issue In PHP On WordPress

8. Once you have completed the above step, you need to click on “log in“.

ubuntu install wordpress

9. you can see WordPress has been installed and now you can start working on it.

That’s it.

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment