YOURLS: Your Own URL Shortener.

As Piwik is to Google Analytics, YOURLS is to Bitly.

I haven’t tried this out yet, but it seems nice from the screenshots.  Written in PHP.