Setting up AWStats on Gentoo

In: Web development

28 Aug 2004

Some notes to myself on setting up AWStats on a Gentoo box.

  1. First, emerge the awstats package. I added the “vhosts” USE flag because it’s listed as a USE flag that awstats reads, and I need support for virtual hosts (although I don’t know for sure what it does – I reckon it has something to do with the webapps-config package that’s a dependency).

    emerge -pv awstats
    USE=”vhosts” emerge awstats
  2. Don’t use the webapp-config program that the emerge process tells you to use at the end unless you know what you are doing. There have been reports that it isn’t exactly ideal in the Gentoo forums.

  3. Make a symbolic link to the Apache configuration directives we need to add to Apache in a convenient location. You may also want to make the file owner-writable (chmod u+w) since it’s read-only.

    ln -s /usr/share/webapps/awstats/6.1/postinst-en.txt /etc/apache2/conf/awstats.conf
  4. I had to add this bit to /etc/apache2/conf/awstats.conf prevent a 403 error when accessing the ScriptAliased /awstats directory.

    <directory “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/”>
    Options +ExecCGI +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all</directory>
  5. Include the AWStats-required configuration directives in the main Apache config file (mine’s /etc/apache2/conf/apache2.conf).

    Include conf/awstats.conf
  6. I’m using name-based virtual hosts, with logs for each of them (they are in the included vhosts/vhosts.conf file). AWStats by default parses the Combined log format and this is what I specify for my access logs as well. An example VirtualHost directive:

    <VirtualHost *:80>
    ServerName blog.codefront.net
    DocumentRoot /www/codefront.net/htdocs/blog
    ServerPath /blog
    CustomLog /var/log/apache2/blog.codefront.net/access_log combined
    ErrorLog /var/log/apache2/blog.codefront.net/error_log
    </VirtualHost>
  7. Now, create an AWStats configuration file for each virtual-host.

    cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.blog.codefront.net.conf

    Notice that the configuration file name is of the format “awstats.domain.tld.conf”.

  8. Edit the configuration file (/etc/awstats/awstats.blog.codefront.net.conf). The important things to change are:

    • LogFile (point this to your access log)
    • SiteDomain (your site’s domain name)
    • HostAliases (any aliases your site may have)
    • DirData (AWStats database where your results will be stored. This has to be writable by the Apache user if the AllowToUpdateStatsFromBrowser option is turned on.)
    • DirCgi (AWStats CGI directory)
    • DirIcons (AWStats icons directory)
  9. Restart Apache.

    /etc/init.d/apache2 restart
  10. You can access AWStats from www.example.com/awstats/awstats.pl?config=www.example.com.

  11. Set password-protection for the AWStats directory.

  12. Run AWStats from the command line to update it. You’d likely want to set up a cron job for this.

    /usr/bin/awstats_updateall.pl now -awstatsprog=/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/awstats.pl -configdir=/etc/awstats/

Useful links:

10 Responses to Setting up AWStats on Gentoo

Avatar

Jens Wedin

October 18th, 2004 at 4am

Hi there, just what I was looking for :D Thanks alot, I just went from webalizer to awstats. Many times I think the post installation procedure gets lost when installing stuff with portage, especially when they write wrong this in the installer. Well, I went thrue your howto and worked quite well. I did have some 403 problems which might could update your article with. Also have you posted this over at the Gentoo forum? That might be a good idea, I did look over there for a few days ago and could find anything, it might be the first place to look for when having problem with Gentoo.
Also an example of your conf files might good, so people have a good look. Another thing that I noted when copying and pasting some character changed for examlple ” turned into . Hmm strange. Well , thanks again for a great howto.

Avatar

kren

December 22nd, 2004 at 1am

i get strange error, althouht i gave read+write permissions the folders listed bellow:

Warning: Can’t find language files for “en”. English will be used.
Warning: Can’t read file “status_http.pm” (status http detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.
Warning: Can’t read file “search_engines.pm” (search engines detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.
Warning: Can’t read file “domains.pm” (domains detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.
Warning: Can’t read file “operating_systems.pm” (operating systems detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.
Warning: Can’t read file “robots.pm” (robots detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.
Warning: Can’t read file “browsers.pm” (browsers detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.
Warning: Can’t read file “mime.pm” (mime detection will not work correctly).
Check if file is in “/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/lib” directory and is readable.

Avatar

eric

December 29th, 2004 at 2am

kren you need to give the “lib” and “lang” directories +x access, in the following manner:

cd /usr/share/webapps/awstats/6.1/hostroot/cgi-bin
chmod o+x lib lang

Chu Yeow, thanks for posting your stuff on here.

Avatar

Paul Hepworth

August 20th, 2005 at 4pm

Short and to the point–I like it!

Thanks for the quick tutorial the only thing I had to change in your steps was the awstats version number.

In case someone is interested, I set this awstats up to work on linux with copied IIS 6.x logs and needed to use the following LogFormat to get things to play nice.

LogFormat=”%time2 %cluster %virtualname %virtualname %method %url %query %other %logname %host %other %ua %other %referer %other
%code %other %other %bytesd %other”

Thanks again!

Avatar

Snitt

August 21st, 2005 at 5pm

Thanks, you helped me to get out of 403 error :)

Avatar

endre

February 5th, 2006 at 9am

omg!

Snitt: no way, you don’t know awstats yet!
This is the first time I set up awstats, it can’t be that i had 403 or other errors with it at august, 2005.

(endre is formerly known as Snitt)

Avatar

TORRIE

November 29th, 2006 at 10pm

Nice work, your blog is excellent. I was searching the internet for some info and I somehow ended up on your blog. Although your site is not exactly related to my search, I am certainly glad I stopped by. Oh well, back to surfing and I am sure I will find what I am looking for. Thanks for the interesting post.

Avatar

???????? 6???

August 18th, 2014 at 3pm

???????? 6???

Let me receive pick the kindle buy amazon version associated with Vector’ although exactly how would likely I then have the DVD MOVIE? will it be online?

Avatar

gamma blue 11s for sale

August 18th, 2014 at 4pm

gamma blue 11s for sale

At present TELLER MACHINES skimming it’s serious problem, Many thanks for sharing that article. This is a beneficial and educational for everybody.

Avatar

chaussure louboutin pas cher

August 20th, 2014 at 7am

chaussure louboutin pas cher

Furthermore, in relation to performing offline bac ups, its absolutely a good suggestion. But that wont aid Pad Honan in the event the choice and also scarier predicament happenned: The fact that often the cyber criminals murdered the equipment is simp…