Download and Install WordPress via the Shell Over SSH

Download and Install WordPress via the Shell Over SSH

Normally you install WordPress by downloading the ZIP file, uncompressing it on your PC, going into the wordpress subfolder, uploading and running the script and not to mention going to your host’s control panel to get the database setup and everything. Others do it by using Fantastico or SimpleInstall utilities available via their host’s control panel. There is nothing wrong with those methods except the first one takes quite some time and the second method is not foolproof to say the least.

Nowdays most hosting plans offer an SSH/command-line facility so you should definitely consider the SSH method to download and install WordPress on your server. The big advantage you get is that you don’t need to visit different sites, don’t need to do any download/upload or open any control panels. You do that all via a single command-line interface. For this you will need an SSH client. If you are running on Windows go for PuTTY and if you are on Mac you can use Mac’s built-in Terminal or iTerm 2. Before we move ahead please make sure your host offers bash shell because our commands are configured for that.

    1. Go to the correct directory where You want to setup the blog: cd public_html/blogdemo/
    2. Download WordPress using the ‘wget’ command: wget
    3. Extract the File using: tar xfz latest.tar.gz
    4. Shift the files back to where they should be using : mv wordpress/* ./
    5. Now you can Remove latest.tar.gz and WordPress using: rmdir ./wordpress/ AND rm -f latest.tar.gz
    1. Login to the MySQL command-line: mysql -u username -p
    2. Create a new user and set its password: create user ‘dbusername’@’localhost’ identified by ‘password’;
    3. Create a database and grant access to the user: create database dbname;
      grant usage on *.* to dbusername@localhost identified by ‘password’;
      grant all privileges on dbname.* to dbusername@localhost;
  1. Now fire up the blog in your browser and run the usual WordPress install