Install WordPress Quickly Using SSH

| |

Installing WordPress via FTP can take up quite a long time, as you´ll have to upload hundreds of files to the server. Installing via the console is much faster, but you really need to know what you´re doing.

Personally I´m using a hybrid install process, using the control panel and command prompt. I found this to be the easiest way to get up and running quickly.

Below are the steps I take when I need to do a complete WordPress install from scratch. I´m using a Debian Squeeze based VPS with the DirectAdmin control panel. FTP is completely disabled on this machine.

Create a database

I start with creating the database and user in my DirectAdmin control panel. Other control panels like Cpanel or phpMyAdmin can also do this job.

Download WordPress

Using the shell to download and install WordPress is a real timesaver. As I´m on a Windows machine I use Putty to login to my server over SSH.

Browse to the directory where you want to install WordPress and execute the following commands:

  1. Download and unpack the latest WordPress package:
    wget && tar xfz latest.tar.gz
  2. Move the contents of the WordPress folder one level up:
    mv wordpress/* ./
  3. Delete the empty WordPress directory and the compressed package:
    rmdir ./wordpress/ && rm -f latest.tar.gz

Edit wp-config.php

You could do this using a console editor like Nano or Vi but as it involves quite a few steps I prefer to do it on the desktop. Download wp-config-sample.php from the server, rename it to wp-config.php and open it in your favorite text editor and:

  1. Add your database name, user and password
  2. Add the authentication keys and salts
  3. Change the WordPress database table prefix (optional)

I also disable WordPress post revisions and set the autosave interval to a really high number by adding these two constants just above the line /* That’s all, stop editing! Happy blogging. */:

  1. define('AUTOSAVE_INTERVAL', 35000);
  2. define( 'WP_POST_REVISIONS', false );

When done, upload the wp-config.php file to the server. WordPress allows you to save the file one level above your WordPress install. This is usually one level above the public_html directory (unless you´re installing WordPress in a subdirectory of your site).

Change the owner/group

One of the major drawbacks of installing WordPress via SSH is that all files are now owned by the user who uploaded the files. This means you won´t be able to use WordPress auto update features.

To get auto update to work we need to change the owner or group to the user Apache runs under. How to do this depends on your OS and server configuration. I use the below command as root:

chgrp -R apache public_html

but Apache might use a different name on your server (www-data or nobody are common names).

Run the install script

Install WordPress by running the script at

Enable WordPress SSH updates

To allow WordPress auto updates over SSH/SFTP I need to install one additional plugin: the brilliant SSH SFTP Updater Support

Using the same shell commands as above, this will only take a minute. Browse to the plugins folder and execute the following commands (update the plugin version number if a newer versions is available):

  1. wget
  2. unzip
  3. rm -f
  4. chgrp -R apache plugins (note: execute this command as the root user!)

Also note that the unzip command requieres the package with the same name in Debian Squeeze.

That´s all!


Create Unique Domain Names Using Virtual Hosts

Install WP MultiSite with Top Level Domains