+6 votes
in Tutorials and Guides by (1.5m points)

How to install WordPress from the SSH console

1 Answer

+7 votes
by (725k points)
 
Best answer

There are many tutorials in the network of how to install WordPress step by step , but they are all installations from cPanel or installation guides through incomplete SSH that do not tell us how to create the database and associate it with a user with console commands. To solve all of the above, I have created this complete guide on how to install WordPress from the SSH console easily and easily.

image

Installing WordPress through the SSH shell is a simple task, but it requires knowing some basic commands which I will try to explain briefly as we need them and I assume that we will use PuTTY and that you have the necessary knowledge to open an SSH session on your VPS server .

How to install WordPress from the SSH console

Before starting, I assume that our server has Apache, MySQL and PHP installed. We must also bear in mind that we will install our WordPress in the directory /usr/home/TechnoWikis/public_html/ so our commands and examples this will be the reference directory.

Before starting we will need the following information:

  • Username and root password (or another user with sufficient permissions) to log in to the remote server through PuTTY.
  • MySQL root user and password.

1) Download the latest version of WordPress.

First of all we will use the cd command (it allows you to change the folder or directory) to place us in our installation folder: cd /usr/home/TechnoWikis/public_html/

In this step we will use the wget command to download the latest version of WordPress with SSH.

To download the latest version of WordPress in Spanish we go to: http://es.wordpress.org/releases/

Once inside the previous page we copy the link of the file with extension .tar.gz , today the link corresponds to the WordPress version 3.8.1 and is http://es.wordpress.org/wordpress-3.8.1-es_ES.tar.gz , which we use in the following command:
wget http://es.wordpress.org/wordpress-3.8.1-es_ES.tar.gz

When downloading the latest version of WordPress in English it is easier, because the file name is always the same (latest.tar.gz) , so the download URL never varies. With the following command we download the latest version of WordPress in English:
wget http://wordpress.org/latest.tar.gz

With this we already have the latest version of WordPress on our downloaded server and depending on whether we want it in English or Spanish we will use one or another download link. In this guide I will install the Spanish version, so the file name downloaded and that I will use in the following steps will be wordpress-3.8.1-es_ES.tar.gz .

2) Unzip the WordPress files.

We already have the WordPress compressed package on the server but we need to unzip it. As we have downloaded the file with extension .tar.gz we will use the following command to decompress:
tar -xzvf wordpress-3.8.1-es_ES.tar.gz

After executing this command, a wordpress folder containing all the necessary files will be created, but we do not want to install WordPress inside that folder, so we have to move all the files from /usr/home/TechnoWikis/public_html/wordpress/ to /usr/home/TechnoWikis/public_html/ . We achieve this by executing the following command:
mv ./wordpress/* ./

This command moves all the files inside the wordpress folder in the current folder.

Now we can delete the wordpress folder since it is empty and is useless, for this we execute the command:
rm -rf ./wordpress

With this we already have the web installation accessible through the corresponding URL, in our case it would be:
https://www.vozidea.com/

But before proceeding with the installation we will see how to create a database and assign a user, all this through SSH with different commands .

3) Create MySQL user and database to install WordPress.

What we are going to do in this step is to create a user, who we will call him TechnoWikis and then we will create a database named TechnoWikis_blog . Then we will assign to this database the TechnoWikis user giving him the necessary permissions. We will do this with SSH using the following commands:

  • We access MySQL as root:
    mysql -u root -p
    It will ask us to enter the MySQL password.
  • We create the MySQL username of TechnoWikis name and password pn3Fh6Td :
    CREATE USER 'TechnoWikis'@'localhost' IDENTIFIED BY 'pn3Fh6Td';
  • We create the database TechnoWikis_blog :
    CREATE DATABASE TechnoWikis_blog;
  • We assign permissions to the user TechnoWikis on the database TechnoWikis_blog :
    GRANT ALL PRIVILEGES ON TechnoWikis_blog.* TO 'TechnoWikis'@'localhost';
  • We recharge privileges:
    FLUSH PRIVILEGES;

Now when the time comes for WordPress installation we already have the necessary data:

  • Database name: TechnoWikis_blog
  • MySQL user: TechnoWikis
  • MySQL user password: pn3Fh6Td

I hope this guide on how to install WordPress from the SSH console has been helpful . Step number 3 where I create the user and MySQL database I prefer to create a user for the blog because I see it more orderly, but whatever it is never to use your MySQL root user directly in the installation of WordPress since it is a bad practice of security.


Most popular questions within the last 20 days

...