How to Install WordPress in Ubuntu

How to install WordPress site in Ubuntu

This article will show you how to install your WordPress site in Ubuntu. It is very easy to install WordPress as described below.

Go to wordpress.org and download the latest WordPress.

The first step is to create a folder for our new WordPress site in the WWW folder. We will do all this as root hence type

sudo su

Enter your password. Hit enter key after that. Now you will be working as the root user. We will now go to the WWW folder so that we can create our WordPress folder. Type the following to go to that particular folder.

cd /var/www

You can type ls to list the files that are currently there.

cd ls

Now we will make our site folder by typing the following:

mkdir wordpress1.com

Our folder will be called wordpress1.com and you will access it by typing wordpress1.com in your local browser. We will now create a public_html folder where all our files will be located. We will create that folder inside our main wordpress1.com folder. To do that type the following:

cd wordpress1.com

Now that we are in that folder, we will create our public_html folder here.

mkdir public_html

We will copy the folder we downloaded to this particular folder by typing the following

cp /home/user/Downloads/wordpress-4.9.7.zip /var/www/wordpress1.com/public_html/

The cp is the copy command while the second part is for the location of our WordPress zip file we downloaded while the last bit is our destination.

We will unzip our files now by typing:

unzip wordpress-4.9.7.zip

Ensure your files are in the public_html folder and not in a WordPress folder once you extract. You can copy your extracted file in the public_html.

Now we will create our database where we will use it to connect to WordPress.

Type the following:

mysql -u root -p

Enter the password and hit enter. We will now create our database.

create database wordpress;

You can now exit MySQL by typing the following.

exit

We will add our URL address in the hosts’ file. We will add using vim (You can also use the default nano which is also easy to use).

vim etc/hosts

add the following:

hosts file

We need to make our site available. Go to the following folder

cd /etc/apache2/site-available

copy the default folder 000.default.conf like this

cp 000-default.conf wordpress1.com.conf

edit your file to be like this

Conf File

We will now enable our site by typing the following:

a2ensite wordpress1.com.conf

After enabling our site, we need to reload apache by typing the following

service apache2 reload

Now go to your browser and type wordpress1.com

The WordPress setup page will be displayed. Click let us go button

WordPress Setup

Enter your database name (the one we created, in this case, WordPress), the username which is root,

your password, database host will be localhost and table prefix as guided.

If you find “Sorry, but I can’t write the file.wp-config.php

You can create the wp-config.php file manually and paste the following text into it.”

Create the wp-config.php manually and paste the code displayed. After that click run the installation.

You will now be required to enter your site name, username, and password and other settings.

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »