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
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.
You can type ls to list the files that are currently there.
Now we will make our site folder by typing the following:
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:
Now that we are in that folder, we will create our public_html folder here.
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:
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.
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).
add the following:
We need to make our site available. Go to the following folder
copy the default folder 000.default.conf like this
cp 000-default.conf wordpress1.com.conf
edit your file to be like this
We will now enable our site by typing the following:
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
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.
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.