Speed Up Web Installs with SSH
Posted: October 21st, 2008 | Author: Bryan | Filed under: Hosting | No Comments »A lot of people who are new to the whole web hosting scene figure out FTP pretty quickly because of it’s intuitive drag-and-drop interface. Often, this is the go-to technique for people installing WordPress, Joomla! or Drupal (among others). However, we can find a faster way to install WordPress, Joomla! and Drupal. We’ll use a combination of FTP and SSH to speed the process up.
The problem:
These software packages can take forever to upload! Not only are the files much larger because they are uncompressed, they are numerous, often hundreds if not thousands of separate files. The lag between initiating each transfer may be small but between hundreds of files…. you get the idea.
Let’s take a quick example with fresh Joomla! 1.5.7 install:
- Zipped: 1 file @ 5.75mb
- Unzipped: 3,914 files @ 12.6mb
Now imagine FTP‘ing these onto your server, which would be less hassle?
The idea:
Learn how to use SSH! SSH stands for Secure SHell and is used to get to a command line on a server. In FTP, you usually just have a view of files that you can drag and drop. FTP is wonderful for file transfers but it lacks those fancy commands that allow the flexibility SSH can provide.
In our example, we’d like to upload the zip via FTP to the correct folder, and use SSH to unzip the zip. This will save us a lot of time, how much you ask? Let’s compare:
- Zipped: upload time: 2 minutes 15 seconds, unzip time: 9 seconds
- Unzipped: upload time: 35 minutes 23 seconds
Convinced? Now go and download something like WinSCP that contains BOTH a FTP client (kind of) and an SSH client. Simply input the standard FTP info in to the SCP confid info like any other client and you should get to what looks like a standard FTP screen. You can either use WinSCP to upload the zip file yourself or use your original FTP client. You want to place the zip in the folder primed for install.
The solution:
Now for SSH! If you are using WinSCP, simply select the “Commands” menu and “Open in PuTTY“. This should pop up an old school DOS-like window prompting for a password. Oblige with your standard FTP or SSH password (usually the same).
Now, you should get the command line. This isĀ SSH and it is awaiting your commands. First, let’s first learn a couple vital commands:
- dir - this command lists all folder (but not always files) in the current directory
- cd foldername - this command will change the current directory to the named directory
- cd .. - this command will go up a directory, use it to go back
- ls - this command will list all folders and files in the current directory
- unzip filename.zip - if installed on the server, it will unzip the named file
Let’s give it a test spin, type “dir” without the quotes and hit return. You should now see a list of directories and yet another command prompt below that. Remember the structure of directories? If not, familiarize yourself with something more comfortable, like the graphical FTP client. Think about where that public html folder is…
Simply type “cd yourdirectory” and push return and you should now be in that folder. Rinse repeat with the “dir” command and “cd foldername” until you get to the folder containing your zip file. Now for the magic, enter “ls” to list the files, and please note the zip folder name. Now enter “unzip filename.zip” and watch the data fly by. In about 15 seconds, you’re done!
Once you get the hang of it, you’ll be saving all kinds of time!
The faster solution:
Since you are using the SCP (basically emulated FTP through SSH, very fancy) option in WinSCP, you can simply browse to the correct folder, right click the zip and choose “Custom Commands” and try entering the “unzip” command. This may be quite a bit easier, but sometimes you’ve got to walk before you can crawl.
Leave a Reply