Install WordPress over SSH

Last modified: June 17, 2020
You are here:
Estimated reading time: 2 min

Though WordPress installation is possible through web hosting control panel like cPanel or Plesk, this documentation is about WordPress installation on VPS, Quick server or Dedicated servers with no control panel installed in it.

 

Step 1:

Connect to server over SSH.

Then go the location where WordPress needs to be installed. In my case, I want to install WordPress in the home directory of the user “test”. Also it is the document root of my domain “mydomain.com”.

root@WordPress:~# su – test

test@WordPress:~$ pwd

/home/test

 

Step 2:

Download the latest WordPress installation package from WordPress official website. We can use “wget” command to download package.

test@WordPress:~$ wget http://wordpress.org/latest.tar.gz
–2015-11-23 02:03:47– http://wordpress.org/latest.tar.gz
Resolving wordpress.org (wordpress.org)… 66.155.40.249, 66.155.40.250
Connecting to wordpress.org (wordpress.org)|66.155.40.249|:80… connected.
HTTP request sent, awaiting response… 301 Moved Permanently
Location: https://wordpress.org/latest.tar.gz [following] –2015-11-23 02:03:47– https://wordpress.org/latest.tar.gz
Connecting to wordpress.org (wordpress.org)|66.155.40.249|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 6526208 (6.2M) [application/octet-stream] Saving to: ‘latest.tar.gz’

100%[==========================>] 6,526,208 10.42MB/s in 1.1s

2015-11-23 02:03:54 (1.16 MB/s) – ‘latest.tar.gz’ saved [6526208/6526208]

 

Step 3:

Extract the package using “tar”

test@WordPress:~$ tar xfz latest.tar.gz

test@WordPress:~$

Now WordPress installation package extracted inside “WordPress”.

 

Step 4:

Now we need to create database and database user for WordPress.

mysql> create database db_wordpress;

Query OK, 1 row affected (0.00 sec)

mysql> create user ‘user_wordpress’@’localhost’ identified by ‘test123’;

Query OK, 1 row affected (0.00 sec)

Here “user_wordpress” is the MySQL user name and “test123” is the password for the database “db_wordpress” .

 

Now we have to grant privileges for the user to access the database. You can use the following commands for this.

mysql> grant all on db_wordpress.* to user_wordpress@localhost identified by ‘test123’;

Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on db_wordpress.* to user_wordpress@localhost identified by ‘test123’;

Query OK, 1 row affected (0.00 sec)

 

Step 5:

Now go the directory where we downloaded and extracted installation package and rename the file wp­-config-sample.php file to wp-­config.php.

test@WordPress:~$ pwd

/home/test

test@WordPress:~$ cd wordpress

test@WordPress:~/wordpress$ ls
index.php wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php
license.txt wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php
readme.html wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php

mv wp-config-sample.php wp-config-.php

 

Then open the file wp­-config.php using any text editor like vim, nano and add the database name and it’s credentials we created.

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘db_wordpress’);

/** MySQL database username */
define(‘DB_USER’, ‘user_wordpress’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘test123’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

 

Step 6:

Finally, run the install script via web browser. As I mentioned earlier “test” is the document root of the domain “mydomain.com” and that is where we downloaded and extracted the WordPress installation package. By default it is extracted to sub directory named “wordpress” and if you want to use “mydomain.com” to access WordPress website instead of “mydomain.com/wordpress” we should move the extracted files from WordPress directory to parent directory “test”. Once moved run the installation script using the following URL

http://mydomain.com/wp­admin/install.php

 

If you don’t want to move files from the directory WordPress we should run the script as follows.

http://mydomain.com/wordpress/wp­admin/install.php

 

And you will get the installation page as shown below.

10000000000001D200000207AA4BEEF7

 

Just fill the details and proceed. That will install WordPress under your domain. Check your domain and make sure it is working properly.

If having any issues or if you want us to install WordPress for you, please send us a mail to [email protected]. Out support is available 24×7 and we will install it free or charges.

 

Was this article helpful?
Dislike 0
Views: 32