This has been copied from http://area51archives.com/index.php?title=Using_ZNC_with_Tor&action=edit
The installation guide couldn't be simpler, but this is the quick walk through. Each version of Ubuntu has a different name. The version I am using at the time of this article is 12.04, Precise Penguin. The release name will always be the first name, in this case, precise. A list of names are provided here. You will need to know the name of your release for this next step. You need to edit the /etc/apt/sources.list file as root and add:
deb http://deb.torproject.org/torproject.org <RELEASE> main
Of course, you will need to replace <RELEASE> with the proper release name. Run this command to add the Tor Project's package keys to your system.
gpg --keyserver keys.gnupg.net --recv 886DDD89 gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
Now update your distribution lists:
Run this command to install the Tor Project's application that keeps the signing key up to date:
apt-get install deb.torproject.org-keyring
Finally, run this command to install Tor:
apt-get install tor
The installation page gives you an easy walkthrough on compiling and install ZNC for your distribution of choice. This page will have the most up to date version listed quicker than the PPA listed below. For novices, the PPA should serve to be easier to maintain, but comes with a potential lapse of updates. It's your choice.
For Ubuntu-based distros, you can add this unofficial PPA:
sudo add-apt-repository ppa:trekcaptainusa-tw/znc
Next step is to update your repository lists:
sudo apt-get update
And then install the packages:
sudo apt-get install znc znc-extras
After you have compiled and/or installed znc, you need to configure znc before continuing by running:
At the end of the makeconf screen when it asks if you would like to launch ZNC, select "no."
Tor ships with a SOCKS proxy which is used to tunnel traffic through the Tor network. ZNC doesn't have the option to use SOCKS proxies, that's where ProxyChains comes in. ProxyChains allows you to force an application to use a SOCKS proxy. Luckily, ProxyChains is configured to work with Tor out of the box! You may already have ProxyChains installed. If not, it's a simple run of this command to get it:
sudo apt-get install proxychains
If you are not able to get it via apt, or are not using Ubuntu, you can acquire the source from the ProxyChains website.
At this point, you can simply run proxychains znc from the command line and you are good to go with connecting to servers via Tor. However, it will not work if you attempt to connect to .onion addresses. What we will have to do instead, is map an IP address in the Tor configuration to resolve to the .onion address. This is annoying, but it's really your only shot of making this work. You will want to use an IP range that you will not use, and never plan on using. Let's say you want to connect to 2600net. The .onion address is awwqg2ishrohngue.onion. You would need to open the /etc/tor/torrc file and add at the end of the file:
mapaddress 10.99.99.90 awwqg2ishrohngue.onion
Save the file, and restart Tor using:
sudo /etc/init.d/tor restart
...and now you will be able to connect to that .onion address in ZNC by using the server address of 10.99.99.90. For each .onion address you would like to resolve, just add another mapaddress line.