Easy WordPress Client Management via Command Line

I’ve had a WiredTree VPS for about 3 months now. In addition to hosting about 5 of my personal sites on it, I also host a few family members blogs and some pro-bono stuff I’ve done for past clients.

Anytime I get ready to create a new account on the VPS (which, in turn, creates its own cPanel account just as if one had purchased a shared hosting account) I always dread the next step of downloading the latest version of WordPress, grabbing the latest copies of what I consider ‘base-install plugins’ (that is, plugins that I always include in a WordPress installation. These include Absolute Privacy, Google Analyticator, All-in-One SEO Pack, Next-Gen Photo Gallery, WP-Optimize, WP Super Cache, Google XML Sitemap Generator, Contact Form 7, and Akismet.) [Note: I don’t always activate all of these in each build, but I do like to have them handy if I need them. In today’s ‘Unlimited Storage Space’ environment, these small plugins don’t get in the way.]

After going through this download, unzip, upload, and activate process about a hundred times, I figured there had to be an easier way. Yes, I know you can auto-install plugins (and even WordPress, via Fantastico or Softaculous) but I don’t pay for either of those two auto-installers on my VPS because, well, I don’t need them. Plus, I run my PHP as DSO on my VPS rather than suPHP, so there can easily be permissions issues since I run all processes as the ‘nobody’ user.

So, I began thinking…couldn’t I download the latest WordPress build, download the lastest plugin versions I want, put the plugins, extracted, in the wp-content/plugins folder and even toss in a few ‘Coming Soon’ or ‘Maintenance Mode’ themes in the wp-content/themes/ folder. Then, when I create a new account, I could just explode the zip file into the newly created public_html directory and the only manual process I would have to go through would be setting up the MySQL database and editing the wp-config. file–a process which I can now due in under 5min.

Well, that’s exactly what I did. I created the folder I wanted and zipped it up. Then I dropped it on my VPS in a high level folder and tried exploding it into a directory. What I noticed was that, since I had zipped things on my Mac and then uploaded to a Linux box, I had the nasty _MACOSX folders in each directory…making the zip file larger than it needed to be AND making things convoluted.

I did a bit of Google research and found that I just needed an archive utility that would zip ‘Windows Friendly’ files which simply excludes those Mac folders. There were several programs out there, but I settled on one called YemuZip for it’s simplicity and cost (free!). It has a simple drag-and-drop interface that worked perfectly.

I deleted the ugly directory I created the first time using the fantastic “$ rm -rf /ugly-directory” command, uploaded the newest zip and exploded it. This time, it worked like a charm. I quickly tied it to a database I had standing by and was able to log in, with themes & plugins intact, in a matter of seconds.

This process certainly beats the heck out of downloading WordPress each time and and then subsequently downloading plugins. Below, I’ll share the Linux commands for accomplishing this.

How to do it

Once you’ve created your zip (using a program like YemuZip if you’re on a Mac!), upload your wordpress.zip file to a neutral folder on your server. (By neutral, I simply mean a higher level folder that isn’t likely to be deleted…something like /home/.)

Then, you’ll want to ‘explode’ (uncompress) the zip file to a directory on your server.

You’ll need to have navigated to the directory where your recently uploaded wordpress.zip lives.For me, that means logging into my VPS via Terminal (SSH) and the using the bash command:

cd /home/

…which simply tells the server to ‘change directory’ (cd) to the /home/ folder. Then, you have two options for inflating: (1) you can pre-create the destination folder or (2) you can tell the command line to create it for you. I typically follow the latter, so my code looks like this:

unzip wordpress.zip -d /home/USER/public_html/destination

That “-d” tells Linux to create the referenced directory, “destination”, even though it doesn’t exist. If you’re inflating to a folder that already exists, you’ll simple leave off the -d.

The server-side explode takes about 2 seconds and then everything is ready for you to start configuring. In my opinion, this is the fastest way of quickly installing WordPress, fully configured, on a new server. (There are also config files you can include in your install to further personalize things, but I avoid those in most cases unless I’m setting up 5+ sites for the same client. You can Google that topic for more info.)

If you’re interested, I’ve included my latest ‘wordpress.zip’ here for you to download. All the plugins & core files are up-to-date as of the date of this post and it includes WP v. 3.0. I hope you find it useful. FYI: The unzipped folder is 18.6 MB. The zipped file is 6.0MB…another pro of uploading the zip to the server and inflating it there rather than the other way around.

Download pre-built WordPress.zip.

Do you have any tips or tricks for making things easier that I haven’t thought of? Please share you tips with us! Oh, and for what it’s worth, I also delete the “Hello Dolly” plugin…you would think Matt and the team would have gotten rid of this by now…

2 Comments

  1. Ian, thanks for this tip! I’ve been told by other developers that I should learn and go with Drupal precisely because you can get a site with all your desired plug-ins and personal favorite customizations and the bundle that and deploy it easier multiple times. You’re showing me that the same thing can be done in WordPress, and I really appreciate that!

    BTW, I am trying to help a client who runs a non-profit and needs some client management features (saw person x at hospital y on date z and provided service w) that could possibly be gathered on an iphone or handheld device in the hospital. She would really like to have a picture be a part of the same data record. Do you have any suggestions of an existing plug-in, or how to build such a thing? I would so appreciate your help! All the best! Jerry

    Reply

  2. Hey Jerry; glad the post was able to point you in the right direction. I was amazed last night when I was able to download a shell application on my new Android phone and manipulate my VPS from it…pretty wild!

    In regard to your question about your client and her non-profit: Check out Yammer when you get a moment. It’s basically like a private twitter setup for organizations that allows you to tag notes, upload files & photos, and comment on posts. I’ve looked at integrating it for some of my clients in the past but haven’t found the best way to use it yet. Alternately, you could always commission a custom-built plugin or look into the ‘post by email’ feature built in to the WordPress core. (Also, Tumblr may be a viable option depending on the level of sophistication needed.) Let me know what you decide!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *