How to install WordPress on Ubuntu Web Server

How to install WordPress on Ubuntu Web Server

Home ยป Cookbook ยป How to install WordPress on Ubuntu Web Server
Installing WordPress on an Ubuntu web server might sound like rocket science, but it's not! Whether you're a tech guru, Jack of all IT Trades like me (LOL) or just a rookie trying to figure out how to make your website dreams come true, this article will show you just how easy it is to install WordPress on an Ubuntu web server. You'll be using NGiNX, PHP and MySQL for the installation. If you do not have the Web Hosting Server ready on your Ubuntu Server you can follow this article to prepare the Web Server.
Table of Contents

Here are the steps to install WordPress on Ubuntu Web Server

Create User and Database

First step is to create a new database for your WordPress website. First run MySQL as root.

sudo mysql -u root โ€“p 

You will be asked for the password. By default MySQL root user doesnโ€™t have any password. So, just press Enter. That will let you enter MySQL Server.

Enter MySQL Server with the Default user (i.e. root)

Create a new MySQL Database

Create a new MySQL database for the WordPress

CREATE DATABASE database_name; 
Create database for the WordPress

Create the User

Next thing we will do is create a user for the WordPress database and grant privileges for the user to use all tables of that database. 

CREATE USER 'username'@'%' IDENTIFIED BY 'PasswordForUser'; 
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'%';
Create user for the WordPress database and grant privileges

Save All the Changes

Save all the changes by Flashing user privileges by following command. 

FLUSH PRIVILEGES; 
Save all the changes by Flashing user privileges

Exit MySQL Database

Exit from MySQL Database by the following command and press Enter.

exit
Exit from MySQL Database

Download WordPress

Download the latest version of WordPress and extract it to the /var/www/html directory.

cd /tmp 
curl -O https://wordpress.org/latest.tar.gz 
tar xzvf latest.tar.gz 
sudo mv wordpress/* /var/www/html/ 
Download the Latest Version of Wordpress and Extract It to the /var/www/html Directory
Download the latest version of WordPress and extract it

In my case I want to install multiple WordPress on the same server, each WordPress on each directory. At this moment I’m going to install my site on the directory named roosho. So, I created a directory named roosho by following command.

mkdir /var/www/html/roosho
Make directory and move all WordPress files to that directory

Set Proper Permissions

Set the correct permissions on the WordPress files

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

Again in my case, as I created the directory roosho. I’ve to change the permissions for the directory roosho.

sudo chown -R www-data:www-data /var/www/html/roosho 
sudo chmod -R 755 /var/www/html/roosho
Set the Correct Permissions on the Wordpress Files Sudo Chown -r Www-data:www-data /var/www/html Sudo Chmod -r 755 /var/www/html
changing the directory permission

Begin WordPress Installation

Open a web browser and navigate to https://ip-address-of-ubuntu-web-server/ to begin the WordPress installation. In my case it is https://ip-address-of-ubuntu-web-server/roosho.

Begin Wordpress Installation Open a Web Browser and Navigate to Https://ip-address-of-ubuntu-web-server/ to Begin the Wordpress Installation. in My Case It is Https://ip-address-of-ubuntu-web-server/roosho.
Begin the WordPress installation

Complete the WordPress Installation

Rest are just typical. Follow the on-screen instructions to complete the installation and set up your WordPress website. When asked for the database use the username, database name and password that were used in the first step.

Rest Are Just Typical. Follow the On-screen Instructions to Complete the Installation and Set Up Your Wordpress Website. when Asked for the Database Use the Username, Database Name and Password That Were Used in the First Step.
Database credentials created earlier at the first step.

That’s it! Your WordPress website should now be up and running on the Nginx web server with PHP and MySQL. 

In conclusion, setting up WordPress on Ubuntu Web Server is an exciting yet straightforward process if you follow the steps carefully. You are now ready to start building your website or blog in a development environment! With a few simple clicks and commands, you can have a powerful WordPress site running in no time. So, don’t let technical jargon scare you away from creating something great – start setting up WordPress on Ubuntu Web Server today and show off your creative ideas!

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog.ย 
share this article.

ADVERTISEMENT

ADVERTISEMENT

Enjoying my articles?

Sign up to get new content delivered straight to your inbox.

Please enable JavaScript in your browser to complete this form.
Name