Download WordPress and Get it Ready for Installation

Download WordPress and Get it Ready for Installation

WordPress and WooCommerce are so easy to install and manage. They are commonly used to run blogs or eCommerce stores. We will download WordPress on Ubuntu server and manage the permissions and credentials to get it ready for installation.


Before you download WordPress on Ubuntu, you need to follow all the steps in the Install WordPress on Ubuntu section.

Download WordPress

1. We need to download the latest version of WordPress on Ubuntu from the mother website. Enter the directory: /var/www/html by running the command on PuTTY SSH client or any Linux terminal:

root@mail:~# cd /var/www/html
Enter Var WWW HTML Directory to Download WordPress

Then, run the following command:

root@mail:/var/www/html# wget -c http://wordpress.org/latest.zip
Download the Latest Version of WordPress

2. After that, unzip the latest.zip folder by running the command:

root@mail:/var/www/html# unzip latest.zip

In case the unzip utility is not installed, the unzip will not work as you see below:

Unzip is Not Found on Ubuntu

So, you need to install the unzip utility by running the command:

root@mail:/var/www/html# apt install unzip

And here’s it when the installation is complete:

Install Unzip on Ubuntu to Download and Unzip WordPress

Now, run the unzip again after installing it if it wasn’t there:

root@mail:/var/www/html# unzip latest.zip

And once the unzip is done, you will see something like this:

Unzip the WordPress File Latest Zip

Note that the unzip process will create a new folder has the name: wordpress as you see below in blue:

After Unzip Process - Download WordPress

3. Change the name of the folder: wordpress to the desired folder name. We will name it: sitebase, to use it to copy many websites quickly in the future. For this purpose, run the below command:

root@mail:/var/www/html# mv wordpress sitebase
Change WordPress Folder Name to Sitebase

As you see, the name has changed to sitebase instead of wordpress.

4. Remove the latest.zip file by running the command:

root@mail:/var/www/html# rm latest.zip

Manage Permissions

5. Change the ownership of sitebase folder to www-data by running the below command. If you don’t apply the below step, you won’t be able to upload images to your website.

root@mail:/var/www/html# chown -R www-data:www-data /var/www/html/sitebase
Change the Ownership of Sitebase Folder

6. We need to change the mod of folders and files.

First: change the mod of folders to avoid FTP popups when updating WordPress plugins. Set the permission for the files inside the website directory to 755 by running command below: 

root@mail:/var/www/html# chmod -R 755 /var/www/html/sitebase
Change Sitebase Folder Mode to 755

Second: Your website files mod must be (664). Otherwise, you will never be able to edit the files on WinSCP tool. You can refer to the article we posted previously on how to access/sync your server via WinSCP: Sync via WinSCP Tool. So, set the permission for the files inside the website directory to 664 by running command: 

root@mail:~# find /var/www/html/sitebase -type f -exec chmod 664 {} \;
Change Sitebase Files Mode to 664

Manage Credentials

7. Enter sitebase directory, by running the command:

root@mail:/var/www/html# cd sitebase
Enter Sitebase Folder Directory

We will list what’s inside the sitebase directory by running the command:

root@mail:/var/www/html/sitebase# ls

As you see, after running the command above, here’s the content of the sitebase directory:

Sitebase Directory Content

8. Now, change the name of the PHP file wp-config-sample.php to wp-config.php by running the below command:

root@mail:/var/www/html/sitebase# mv wp-config-sample.php wp-config.php
Change WordPress PHP File Name wp-config-sample to wp-config

9. Open the file wp-config.php by running the command:

root@mail:/var/www/html/sitebase# nano wp-config.php
Set wp-config File Variables

Then, change the below variables in bold font:


define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
define( 'DB_PASSWORD', 'password_here' );

To your own values that you set when you created the database in the previous tutorial here: Create New MySQL Database. Note that parameters we set before are shown below, you should recover your own parameters.

define( 'DB_NAME', 'sitebase_db' );
define( 'DB_USER', 'sitebase_user' );
define( 'DB_PASSWORD', '12345678' );

The password should be very strong, the password we use here is just an example.

Our next step is to configure Nginx virtual hosts where we will point out the domain (from DNS settings) to our server IP address first then will point out the traffic from the domain to the website folder in the server.