I found less detailed guide on rootzwiki created by birdman, but i decided to repost it here in more detail.
* Disclaimer: I do not take any responsibility for anything you do to your phone, whether be brick, break, or somehow mess it up.
1. You must have the sdk installed and you are able to access, and use adb and fastboot.
2. You must have debugging enabled on your Nexus 7.
3. Download Su here
4. Download CWM here
To make this easier, you should put the su zip on the sdcard for later.
1. In terminal, cd to the directory you have your sdk in. Then cd into platform-tools.
2. Type adb push path-to-zip/JB-SuperSU.zip /sdcard
Unlocking Your Nexus 7
To unlock your device
1. cd to platform-tools
2. Reboot to the bootloader - adb reboot bootloader
3. Unlock your device* -
fastboot oem unlock*You will have to accept and erase all the user data on the tablet.
*You must run this as sudo in Linux
Flash Clockwork Mod Recovery
(You're still inside the bootloader)
4. Flash CWM -
fastboot flash recovery path-to-img/CWM-grouper-recovery.img
5. Make CWM Permanent -
1. Boot into recovery
2. Go to Mounts and Storage
3. Mount /System
4. Type in Terminal
If your having trouble gaining shell, try "adb kill-server" then "abd start-server". Couple of my friends had this problem, and this should hopefully fix it.adb shell
mv recovery-from-boot.p recovery-from-boot.bak
1. Go back by pressing power button
2. Install the zip in the sdcardReboot and your device is now rooted!!