+91 88 00 563434 [email protected] Blog open-book Knowledge Base

Find Solutions in Our Knowledge Base

Install WordPress over SSH

You are here:
Sharing is Caring

Even though WordPress installation can be done through website hosting control panel like cPanel or Plesk, this guide focuses on installing WordPress on VPS, High-speed server, or Dedicated servers without any control panel installed.

Step 1:

Connect to the server via SSH.

Then navigate to the location where WordPress should be installed. In my case, I want to install WordPress in the home directory of the user “test”. It is also 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 the “wget” command to download the 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
Size: 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 the WordPress installation package is extracted inside “WordPress”.

Step 4:

Now we need to create a 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 username 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 [email protected] identified by ‘test123’;

Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on db_wordpress.* to [email protected] identified by ‘test123’;

Query OK, 1 row affected (0.00 sec)

Step 5:

Now go to the directory where we downloaded and extracted the 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 its 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 installation script through a web browser. As I mentioned earlier, “test” is the document root of the domain “mydomain.com” and that’s where we downloaded and extracted the WordPress installation package. By default, it’s extracted to a subdirectory named “wordpress”. If you want to use “mydomain.com” to access the WordPress site instead of “mydomain.com/wordpress”, we should move the extracted files from the WordPress directory to the 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 WordPress directory, 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.

Install WordPress over SSH

Simply fill in the details and continue. That will install WordPress under your domain. Check your domain and make sure it’s working correctly.

If you encounter any issues or if you want us to install WordPress for you, please send us an email to [email protected]. Our support is available 24×7 and we will install it free of charge or with fees.


Sharing is Caring

Leave a Comment

Table of Contents