WordPress post name permalinks via apache2 mod_rewrite

I got a 404 after changing my permalinks to use post names, and realized I forgot to enable mod_rewrite. Here’s how I fixed it (requires root access):

Enable the mod_rewrite module (assuming it exists – you may need to download a package):
# a2enmod rewrite
Reference: man a2enmod

Edit /etc/apache2/sites-available/sitename and replace
AllowOverride None
to
AllowOverride All
Reference: Apache Docs

Restart apache:
# apache2ctl restart
Reference: man apache2ctl