Webalizer + GeoIP library (aka "Geolizer") ========================================== * patch to original Webalizer code by Stanislaw Pusep (stas@sysd.org) * human readable sizes patch by Timo A. Hummel (http://www.timohummel.com/) Version this patch applies: 2.01-10 References: ----------- This project: http://sysd.org/stas/node/10 Webalizer home: http://www.mrunix.net/webalizer/ GeoIP home: http://www.maxmind.com/app/ip-location Installation (Source): ---------------------- (Note: if compiling on Win32 under MinGW/MSYS, go until step 5 and check out last section of this file) Step-by-step: 1) Download and install GeoIP library. See URL on top of this page. Read GeoIP docs too. !!! WARNING !!! "Here's a little trap that sometimes catches everyone": make sure that programs have access to libGeoIP.so.1 file if you're compiling dynamic version! They're two cases; when you install libGeoIP as superuser and when you install it somewhere at your $HOME. In both cases the symptom message is: "webalizer: error while loading shared libraries: libGeoIP.so.1: cannot open shared object file: No such file or directory" Here's solution: I) Superuser may install libGeoIP into /usr/local/lib. Make sure that this path is cached by 'ld.so'. Check for presence of this path in /etc/ld.so.conf; if it's not there add such a line. Then run "ldconfig -v". This would take some time and you may see libGeoIP.so.1 file somewhere in verbose output. II) If you install libGeoIP at your $HOME I guess you have no superuser access, huh? So you may be unable to run 'ldconfig'. No problem! If you installed libGeoIP at "$HOME/lib" you should put following line in your initialization scripts: * For bash: export LD_LIBRARY_PATH=$HOME/lib * For csh: setenv LD_LIBRARY_PATH $HOME/lib Or you may want to create 'webalizer.sh': -- cut here -- #!/bin/bash export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH exec $HOME/bin/webalizer $* -- cut here -- 2) Download Webalizer v2.01-10 source. Extract it in some cool place like /usr/src (so you have /usr/src/webalizer-2.01-10/) 3) Download and install all Webalizer dependencies. Read Webalizer docs, damn! 4) Apply patch: cd /usr/src patch -p0 < /home/my_user/geolizer_2.01-10-patch/geolizer.patch No errors may occour here. If some file has been rejected, you've probably got different version of Webalizer! I repeat: 2.01-10 5) Configure: cd /usr/src/webalizer-2.01-10/ ./configure If you get error here, check where the hell you installed dependencies. If your Webalizer compiled before, play around with --with-geoip-inc= and --with-geoip-lib= options. 6) Compile/install it! make make install (as root!) 7) Setup Webalizer: take a look to last lines of 'sample.conf' & 'webalizer -h' output. Check out for some tips at the end of next section! Installation (Binary): ---------------------- OK, you have here a static binary for Linux (and now Win32 too ;). It needs no libraries to run, just GeoIP.dat file. So, if you have r00t powers you can create directory "/usr/local/share/GeoIP/" and put GeoIP.dat file there. Don't mess with permissions, so (obviously, as root): # mkdir -p /usr/local/share/GeoIP/ # cp GeoIP.dat /usr/local/share/GeoIP/ # cd /usr/local/share/GeoIP/ # chown 0:0 GeoIP.dat # chmod 0644 GeoIP.dat And what if you have no superuser access? Just specify *FULL* database path for Webalizer (no, it won't seek for database in current or executable's directory, sorry!): $ ./webalizer -W /home/my_user/GeoIP.dat /var/log/apache/access_log If you have personalized 'webalizer.conf' file, try out: $ ./webalizer -c my.conf -W /home/my_user/GeoIP.dat -C 300 /var/log/apache/access_log "-C 300" makes Webalizer to print stats for ALL countries, not just Top 30 ones. You can also edit your configuration file, setting following values: TopCountries 300 GeoIP yes GeoIPDatabase /home/my_user/GeoIP.dat Pay special attention to your 'webalizer.conf' location. Static binary will first check for it in current directory and then in /etc. '-c' option will load specified config *OVER* default one. Win32 version only checks for default 'webalizer.conf' in current directory. Installation Notes for Win32: ----------------------------- By default, Win32 version seeks for "webalizer.conf" file in the "webalizer.exe" executable's directory first and then in the current directory. You may also want to specify it manually, with '-c' option. "GeoIP.dat" file is always looked in the same directory as "webalizer.exe" is located (*NOT* the current one!!!). Use '-W' command line parameter or 'GeoIPDatabase' config directive to override database file location. Compilation Notes for Win32: ---------------------------- Currently Geolizer-enabled webalizer only compiles on MinGW/MSYS environment (http://www.mingw.org/msys.shtml). They's ABSOLUTELY NO PLANS to port it to Microsoft Visual C nor CYGWIN. MinGW creates compact native executables and it's able to compile all required dependencies with minimal efforts. Take a look at Makefile.MinGW file ("./configure" way works but it's a pain in ass, I prefer handwritten Makefile ;), fix dependency lib pathes and don't forget to uncomment GeoIP enabler lines! If you need more detailed steps then open README.Win32 that is created in webalizer source directory after applying geolizer.patch. Have fun!!!