A quick article about how I manage to set up a WordPress installation from scratch to have a clean and up to date working and testing environment.
I admit it, this is a catchy title and a lie. Actually it took me 27.889 seconds to do the following:
- create a new local database
- create a directory
- start download and unpacking of the most recent WordPress installation file
That’s still not bad I think and I do this often, which is why I have automated my process a little.
First off, I run MAMP, which is a nice tool to develop locally and I’ll continue to use it until I can ditch my Mac.
create a database for WordPress
I just head to http://localhost/phpMyAdmin, punch in the name and hit return, having the collation set to utf8_general_ci.
create a directory
A simple Terminal command, because I don’t have to wait for a file manager (Finder, I do hate you) to load:
cd public_html mkdir plugin_test
download and unpack WordPress
Being a fan of Terminals, I’ve put this into my .bash_profile/.bashrc file, which enables you to define sets of commands and execute them with a single word.
alias getwp="curl -O http://wordpress.org/latest.tar.gz && tar zxf latest.tar.gz && mv wordpress/* . && rm -rf wordpress"
So when I type getwp it downloads the latest release, unpacks it, puts it into the root of where I’ve changed to and removes the folder wordpress.
just an example
I love using the Terminal because of stuff like this and I’m not going to stop investigating possibilities to make my life better through code. It’s beautiful and really practical. If you’ve never opened the shell on your computer, may it be Mac, Linux or even Windows you’re missing out on a lot of great stuff. The Terminal I use on Mac OS is iTerm2 by the way. They have some really cool key binding and layout stuff going on. More examples can be found in my dotfiles repository on github.
How do you automate?
Do you automate some of your processes? May it be image manipulation, code, boiling your eggs through ssh or making coffee with a tweet?