When a plumber visits your house, they often bring with them a part canvas, part leather bag that weighs in and about 50lbs. I know this because my brother is a plumber, and I’ve had ample opportunity to look inside at all the unusual looking tools he carries with him. I also noticed recently that he’s somewhat particular in how he puts the tools back in … not one can neatly align them in such a bag, but he has three or four well-worn tools he puts in last. This is because these are often the tools he uses first.
Now I believe I’ve discussed each of these tools (as you can see from the above hyperlinks!-), but don’t think I’ve really ever put it all together to show you what I do to install an application directly onto my web server. Nor do I think I’ve completely explained why I prefer the direct approach.
On the latter, nothing is more frustrating than downloading a file locally, expanding/uncompressing it, editing various files, FTPing it to your web host, only to find that it doesn’t work due to a file or directory that was either uploaded binary when it should have been uploaded ASCII … or requires an additional step of changing the errant item’s file permissions.
Instead, I avoid this hassle by using putty to login to my web server, and from the shell, execute some variant of the following commands
tar -zxvf $HOME/foo.tar.gz
mv $HOME/tmp/foo-version2.0.1 foo
mysql -uUSERNAME -pPASSWORD mydbNAME < foo.sql
Now of course, each installation is going to be a little different, for example, you can see that I throw mkdir and chmod into the mix in a past article I wrote entitled “Moving MovableType.”
That said (and finally to the ‘former’) the above boilerplate also provides some other unseen advantages. First, you don’t have to have to download the file locally. This is good because it also means you don’t kill bandwidth FTPing each file. This is good because you don’t have to worry about uploading the file in the wrong mode … and you install the files using the permissions defined by the developer.
As always, your mileage may vary … especially in those one or two cases where the individual making the .tar.gz file doesn’t put stuff into it’s own directory … which explains why I put everything in $HOME/tmp first …