Install WordPress on a user account as root

You don’t have Softaculous on your server and a user asks you to install WordPress for him.
You can download the WordPress zip, unzip the archive, upload the files via FTP to the user account. You will also need to log in to cPanel and create the database and username.

We will show you an alternative way to install WordPress. We will install WordPress for user “plothost”.

1. Login as root via SSH on your web hosting server.

2. Change location to where you want to install WordPress

root@web [~]# cd /home/plothost/public_html/
root@web [/home/plothost/public_html]# 

3. Download the latest WordPress version. The permanent link is https://wordpress.org/latest.zip

root@web [/home/plothost/public_html]# wget https://wordpress.org/latest.zip --2017-05-01 08:14:59--  https://wordpress.org/latest.zip Resolving wordpress.org (wordpress.org)... 66.155.40.249, 66.155.40.250 Connecting to wordpress.org (wordpress.org)|66.155.40.249|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 8756989 (8.4M) [application/zip] Saving to: 'latest.zip' 100%[==============================================================================================================================>] 8,756,989   7.07MB/s   in 1.2s 2017-05-01 08:15:01 (7.07 MB/s) - 'latest.zip' saved [8756989/8756989] 
root@web [/home/plothost/public_html]# 

 4. Extract the archive-zip file in the current directory.

root@web [/home/plothost/public_html]# unzip latest.zip -d . 

The zip archive will be extracted to public_html/plothost/wordpress/

5. We want to install WordPress in public_html/ folder. So let’s move the files.

root@web [/home/plothost/public_html]# mv ./wordpress/* . 

6. We now have all the WordPress files in /plothost/public_html/ . We should create the database and assign the username

root@web [/home/plothost/public_html]# mysql 
Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MariaDB connection id is 384766 Server version: 10.1.22-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE wpbase; 
Query OK, 1 row affected (0.00 sec) 
MariaDB [(none)]> CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'pass123456';
Query OK, 0 rows affected (0.19 sec) 
MariaDB [(none)]> GRANT ALL ON wpbase.* TO 'wpuser'@'localhost'; 
Query OK, 0 rows affected (0.02 sec) 
MariaDB [(none)]> 

7. We rename the configuration file wp-config-sample.php to wp-config.php

root@web [/home/plothost/public_html]# mv wp-config-sample.php wp-config.php
root@web [/home/plothost/public_html]# 

8. Edit the file wp-config.php in your preferred editor (like vi). Modify the lines with the WordPress details you’ve used earlier:

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘database_name_here’);/** MySQL database username */
define(‘DB_USER’, ‘username_here’);/** MySQL database password */
define(‘DB_PASSWORD’, ‘password_here’);

becomes

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wpbase’);/** MySQL database username */
define(‘DB_USER’, ‘wpuser’);/** MySQL database password */
define(‘DB_PASSWORD’, ‘pass123456’);

9. We are almost finished. Let’s change the files’ user/group, so the user can modify the files.

root@web [/home/plothost/public_html]# chown -R plothost:plothost . 

10. You can now give the installation URL to the user, and he/she will finish the installation by entering Site Title, Admin Username and Password, Email. (as in the image below)

wordpress root
WordPress Installation

On our web hosting plans, you can install WordPress easily via Softaculous. Check out the WordPress Hosting page.

Leave a Reply