How to Install and set up WordPress on Ubuntu

Today I will show you how to install WordPress on the latest version of Ubuntu (Linux distro).

First of all, what is WordPress? 

WordPress is a content management system (CMS) that allows users to build and manage websites

To set up WordPress on Ubuntu I’m going to use the LAMP stack, short for Linux, Apache, MariaDB, and PHP.

Let’s Get Started.

Type the following commands:

> sudo apt update -y

– This command is meant to update packages versions from the internet to the latest ones.

 






> sudo apt install apache2 -y

– This command will install the latest version of apache which is used to set up a web server on Linux.

> sudo apt install mariadb-server mariadb-client

– Mariadb-server packages are used to set up the database server whereas mariadb-client packages are used to connect to the database server.

Once installed type the following command to start mariadb:

> sudo systemctl start mariadb
 
To check if mariadb is running correctly type:
> sudo systemctl status mariadb
 
Your terminal should display this information. (q – to quit)

 
– At this point, we are going to configure our database.
 
> sudo mysql_secure installation
 
Afterwards, set the root password as desired, and to all the prompt messages like “[Y/n]” you need to type Y. 
 
– Now PHP installation is required.
 
> sudo apt install php -y
 
WordPress installation
 
 wget https://wordpress.org/latest.zip
 
– By typing ls you should be able to see the zipped file of WordPress
 

 

 
Unzipping:
> unzip latest.zip
 
As you can see, a “wordpress” directory has been created.
 
Transfer all the files inside the wordpress directory to this path /var/www/html
 
 
 



To integrate PHP with the database we will need to install some essential packages.

Be aware to be inside this path: /var/www/html, otherwise these packages will be installed somewhere else and the integration will not occur.

> sudo apt install php-mysql php-cgi php-cli php-gd -y

> sudo systemctl restart apache2

Permissions are required in the file.

> sudo chown -r www-data:www-data /var/www

Get your IP address by typing (ip a), copy it, and paste it to the URL bar on your google browser.

After loading you should see this screen, this means that the process you have followed so far worked perfectly.

Go back to your terminal to create a database

> sudo mysql -u root -p

A prompt message “enter password” will pop up, just type the root password you specified before.

Afterwards, follow the commands on this picture below according to your own information










Return to this screen and provide all the information you just input to create the database.

Click submit button and if the information entered is correct you will see this screen.





Click the button and enter basic information about the web page settings, then log in.





WordPress has been successfully installed.