Configuring Networking On A Raspberry Pi With a Edimax EW-7811Un

There are a bunch of guides around but this worked for me. The first thing I did was to plug it in and to make sure it was recognized by lsusb. It was:

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB

Then I modifed /etc/network/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

# The WIFI network interface
auto wlan0
iface wlan0 inet static
wpa-ssid <your ssid> 
wpa-psk <your key> 
wpa-key_mgmt WPA-PSK
address 192.168.1.99
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

After a reboot, it was up.