Install awstats on gentoo


Awstats is the best web log analyzer that I know of, at least for low traffic servers. I don’t have experience with in high traffic situations. I used to have awstats installed manually, but now gentoo has an ebuild for it. I tried
# emerge awstats
which is sufficient for most apps in gentoo, including webapps. Squirrelmail and gallery both installed fine this way. However, the awstats ebuild tells us that we have to use webapp-config to complete the install of awstats. They do not give a suggested command line. Long story short, this is how I managed to install awstats to my host (localhost in this case)

  1. # emerge awstats
  2. Create a directory called “awstats” in your root web directory.
  3. #webapp-config -I -h localhost -d /awstats/ awstats 6.3-r2 Change version number as necessary.
  4. Take the output of the above command and paste into the /etc/apache2/conf/commonapache2.conf file
  5. # /etc/init.d/apache2 restart
  6. # cd /etc/awstats/
  7. If there isn’t already a config file, copy awstats.model.conf to awstats.yourdomain.conf
  8. Edit awstats.yourdomain.conf. It is pretty easy just reading the comments.

OK it is installed. Now update the stats:
#/usr/share/webapps/awstats/6.3-r2/hostroot/cgi-bin/awstats.pl -config=yourdomain.com -update

I put this in my cronfile so that it updates every night:
30 02 * * * /usr/share/webapps/awstats/6.3-r2/hostroot/cgi-bin/awstats.pl -config=aliandcedar.com -update >> /var/log/awstats/awstats.log 2>&1
That worked for me.

17 Responses to “Install awstats on gentoo”

  1. Koen Says:

    Thx for the help, everything worked, but what now? Everything is installed but how do you run it? I have only folders in my /localhost/awstats folder, I don’t have an awstats.pl file…

    Greets

  2. cedar Says:

    If you have updated your stats with the command I gave, then simply point your browser to

    http://yourdomain/awstats/awstats.pl

    and you should see your stats. Don’t worry that you have a /localhost/awstats folder without the awstats.pl file in there. That is handled as an alias by that stuff you pasted into your apache config file.

    If things are not working, my first guess is that your apache config file is not set up correctly.

  3. Koen Says:

    Yes, I found I out already, now it works, I can see my stats, other people too, just one problem… It is al zero’s …. It doesn’t update, so I think something went wrong..

    PS: Is it normal that it names “awstats.localhost.localdomain.conf” ? Because only that way works, when I give my domain… He sais that he can’t find “awstats.localhost.localdomain.conf”.

  4. cedar Says:

    A few suggestions:
    1) make sure that your website domain matches the name of your config file. For instance my domain aliandcedar.com has a config file named “awstats.aliandcedar.com.conf”. Then point your browser to that same domain name. If I point to “localhost” rather than that domain it won’t work.

    2) carefully edit your config file. You might check over it again. Then re-run the update command #/usr/share/webapps/awstats/6.3-r2/hostroot/cgi-bin/awstats.pl -config=yourdomain.com -update Make sure you use the same domain name for this command too. Also pay attention to the console output as it updates, it might give you hints as to why it isn’t working.

    3) Finally, have you set your apache config file to use the “combined” log format?

    good luck,

    cedar

  5. flow Says:

    great tutorial. all worked fine.

  6. flow Says:

    a hint
    #webapp-config -I -h localhost -d /awstats/ awstats 6.3-r2 >> /etc/apache2/conf/commonapache2.conf
    no nasty copy and paste

  7. Koen Says:

    Thx Flow, will try that. The only problem is:

    There was a very big security bug in the 6.3 version, many people were hacked and got worms on there systems. But that security bug was fixed in the new 6.4 version, so I emerged the 6.4 version, but when I use webapp-config, he sais that I need to emerge awstats 6.4 first, but it is already emerged..

  8. Cedar Says:

    As far as I understand, the current stable version, 6.3-r2, is not vulerable. I refer you to bug 83657

    Do you own checking though.

  9. Koen Says:

    Hey,

    I emerged the new awstats 6.4 version and did this:

    #webapp-config -I -h localhost -d /awstats/ awstats 6.4

    Then I putted this:

    Options None
    AllowOverride None
    Order allow,deny
    Allow from all

    AuthType Basic
    AuthName “AWStats authenticated zone”
    AuthUserFile /etc/awstats/.htpasswd
    Require valid-user

    in the /etc/apache2/conf/commonapache2.conf file.

    Then I’ve did the rest of the manual, created 2 files in the awstats folder:

    awstats.gentoo.serveftp.org.conf
    awstats.localhost.localdomain.conf

    Now when I surf to http://192.168.1.4/cgi-bin/awstats.pl or on the server http://localhost/cgi-bin/awstats.pl I see that it works, but I have always 0 users…

    Greets

  10. cedar Says:

    Did you try:

    #/usr/share/webapps/awstats/6.4/hostroot/cgi-bin/awstats.pl -config=localhost.localdomain -update

    as root?

    Remember to change your version number and domain there.

    Then try a couple of things:

    1) instead of visiting http://localhost/cgi-bin/awstats.pl
    try
    http://localhost/cgi-bin/awstats.pl?config=localhost.localdomain
    and
    http://localhost/awstats/awstats.pl?config=localhost.localdomain

    good luck

  11. Koen Says:

    Hey,

    I did the update as root, but still it doesn’t work, also not with the ?config=localhost.localdomain after it.

    /awstats/awstats.pl doesn’t exists, only cgi-bin/awstats.pl

    I think I made some mistakes at the apache2.conf file and the other .conf file, but I don’t know what…

    Greets

  12. Mel Says:

    I’ve searched the web for simple instructions on how to install AWStats to my hosting account. This is the best I’ve found so far, but it’s still greek to me. I’m more of a visual learner. Could someone please make a video tutorial for technical dummies like me?

    I’d be willing to pay for some simple instructions.

  13. Cedar Says:

    These instructions are specific to a particular distribution of Linux, in this case Gentoo linux. These instructions will not work for you if you are trying to install to a non-gentoo system. Mel, I’m afraid I can’t make instructions to help you, particulary since the details of the system you are trying to install are unknown. My advice would be to find a local “geek” and hire him/her to help you directly.

  14. Mel Says:

    Well, what do you need to know in order to help me?

    Here’s a list of information about the hosting account I use.

    General server information:

    * Operating system - Linux

    * Kernel version - 2.4.22-1.2199.nptlsmp

    * Machine Type - i686

    * Apache version - 1.3.33 (Unix)

    * PERL version - 5.8.6

    * Path to PERL - /usr/bin/perl

    * Path to sendmail - /usr/sbin/sendmail

    * PHP version - 4.3.10

    * MySQL version - 4.0.22-standard

    * cPanel Build - 10.2.0-RELEASE 82

    * Theme - cPanel X v2.5.0

    I’m trying to install AWStats 6.4 to my server. I hope this helps clarify the details.

  15. cedar Says:

    Mel, I’m sorry if I gave the impression that I’m willing to work to resolve your issue. I was mostly trying to point out that my tutorial would not be useful for you unless you are trying to install awstats on gentoo linux. My advice would be to look at these:

    http://awstats.sourceforge.net/docs/index.html
    http://awstats.sourceforge.net/docs/awstats_faq.html
    http://sourceforge.net/forum/forum.php?forum_id=43428

    confirm with your isp that they allow perl, cgi and access to the web logs

    and finally, hire a local geek to help you directly if you still can’t get it to work.
    best of luck,
    Cedar

  16. sirbs Says:

    your how-to worked almost like a charm. Charmy enough that this was exactly what i needed to get 95% of the way to awstat workingness. I attribute to other 5% to subtle version differences and structuring etc. thanks ! :D

  17. Caleb Gray Says:

    The simplest way to determine errors when you’re faced with a bunch of zero’s in awstats.pl is to enable the “AllowToUpdateStatsFromBrowser” in your domain’s conf file. Then when you refresh the awstats page, a link “Update now” will apear. Click on the link and wait for it to tell you your problem.

    I hope this helps.
    - Caleb

Leave a Reply



Search WWW Search aliandcedar.com