Here are the step by step instructions to install
AWSTATS 6.5
Locally under mac osX Panther/Tiger.
And on OS X SERVER 10.4

Many thanks to Gene Hobbs for the MacOSX Server part.


***Items with "**" besides them have particular setup for Mac OS X Server***


To do before installing.:

  1. How was your system Installed?
  2. Install Xcode Tools
  3. Enable root user via Netinfo Manager
  4. **Disable personal web sharing

Awstats Basic Instalation:

  1. Get the Awstats distribution and place it in your webserver documents.
  2. Running the awstats_configure.pl script.
  3. Edit the awstats.yoursite.conf file
  4. **Change the logfile name in HTTPD.conf.(apache configuration file).
  5. **restarting personal web sharing.
  6. Creating the first hits and running update for the first time


TODO before Installing.

How was your system Installed?
If you installed panther from updating a previous version of mac OS X(10.1 or 10.2)
you might end up having problems running complex perl applications later on,

I strongly suggest you reinstall Panther(10.3) from the cd,
selecting "Archive and Install" in the custom installation settings.
This will keep you current user settings
Be aware that this will disable some 3rd party applications or drivers,and that you will have to
reconfigure printers. simply reinstalling those drivers will work afterward.


Install Xcode tools.

Use your MAc OS install CD to install Xcode Tools, since some features/scripts needs it for install and runtime of awstats


Enabling root User using Netinfo manager.

Since we need to edit files that belong to the system, we must enable the SuperUser of the computer.

  1. Go in Applications/Utilities and open NetInfo Manager
  2. In the security menu select Authenticate


    You will then be prompted for the Admin password(same password as when you install an application).

  3. Go back in security menu, and choose "Enable Root User"


    If it's the first time you enable it, you will be prompted to enter a Root password, and to
    confirm it.
    Remember this password!!

  4. Quit NetInfo manager.

Root user is now enabled.!

top


Disable personal web sharing

Go in System preferences, under the sharing pane, and disable Personal Web Sharing
by unchecking it



Then you can close the system Preferences.

**Mac OS X Server: Simply turn off WEB SERVICES in the Server admin tool

top


Awstats Basic Instalation:

  1. Get the awstats distribution from sourceforge, in zip format.

  2. Decompress it and place it into :
    /Macintosh HD/Library/WebServer/Documents/
    Be careful, not in /User/library/.

  3. Rename the folder
    awstats-6.4
    you just moved to
    awstats
    It should look something like this:


    top

Running the awstats_configure.pl script.

Now for the fun Part!
here are a bunch of commands to be executed in Terminal,
when you seee <enter>, don't type it.. just hit the enter key :)

  1. Launch terminal and at the prompt type:
    su<enter>
    you will then be prompted for the Root password you entered in NetInfo manager earlier
  2. Now the prompt should be displaying:
    HDname:/Users/yourUsername root# (just the root# is important!)
  3. Now type:(you can copy-paste)
    cd /library/webserver/documents/awstats/tools/
    then hit <enter>
  4. Type : ls<enter>, you should see this:

    (Replace DomBook, by your Hard disk name)

  5. Now time to launch that script:
    Type the following:
    perl awstats_configure.pl <enter>

    top

SCRIPT EXECUTION:

The script will introduce himself, then detect the OS type, dont worry if it displays:
-----> Running OS detected: Linux, BSD or Unix
We are in fact runninx a Linux port
then the script will tell you a warning about directory structure..like this:


To this question Answer YES (y).

Then it will check for the webserver config file(httpd.conf) and ask you if you want to setup Apache to write 'combined' log files [y/N] ?
ANSWER YES

Then it will add directives to the config files.

You will then be prompted to build a New aswtats config/profile
again answer yes
then enter the name of your site/profilename
it can be anything but no spaces are allowed
for example: www.domain.com or localhost or blahblah

then it will ask where you want the config file saved
keep the default settings(/etc/awstats/)

then it will try to restart apache and tell that there is no such service httpd, no worries
then tell you how to update, press enter twice to end the config script

CONFIG PART IS DONE(almost)!!!


Before we can succesfully update awstats, we must make the folder where Awstats will save the processed files writable.:
In terminal,type:
cd /library/webserver/documents/awstats/wwwroot/cgi-bin<enter>

then type
chmod 777 .
(don't forget the dot at the end)

top

Edit the awstats.yoursite.conf file

Now we need to adapt the newly created awstats.yourprofile.conf file a bit.

  1. On finder, select GO menu, then Go to folder

  2. When the dialog box opens, enter "/etc/awstats/", no quotes, with slashes.

  3. copy the file awstats.configname.conf on the desktop
  4. Open the copied awstats.configname.conf with TextEdit
    (control click on file and choose open with, then select TextEdit.)

    DON'T TRY TO EDIT THE FILE STRAIGHT FROM THE /ETC/AWSTATS FOLDER, IT IS READONLY...

  5. Find the line that says
    LogFile="/var/log/httpd/mylog.log"
    and change it to
    LogFile="/var/log/httpd/web_log"
    We will make the webserver use this file in a few steps...

  6. Now find the line with
    DirData="/var/lib/awstats"
    change it to
    DirData="."
    So that the processed files be created in the same directory as awstats.pl
    (/library/webserver/documents/awstats/wwwroot/cgi-bin/)
  7. if you want to be able to update stats from web browser,
    find the line that says
    AllowToUpdateStatsFromBrowser=0
    and change it to
    AllowToUpdateStatsFromBrowser=1
  8. SAVE THE FILE AND CLOSE IT
  9. Place the modified file back into the /etc/awstats folder
    you will be prompted to authenticate, then choose replace

Done editing the config file...
top



Change the logfile name in HTTPD.conf.(apache configuration file).

This is a little tricky part if you never did it.

Mac OS X have some hidden maintenance scripts that run by night that will flush the web acces log
from time to time, to prevent this we must tell Apache to write a different logfile,
so that the Hidden script don't erase any of our hits.

Here's how:

  1. On finder, select GO menu, then Go to folder

  2. when the dialog box opens, enter "/etc/httpd/", no quotes, with slashes.

  3. Locate the file named "httpd.conf" and copy it on the desktop
  4. Open it the copied file(the one on the desktop with Textedit.
    DON'T TRY TO EDIT THE FILE STRAIGHT FROM THE /ETC/HTTPD FOLDER, IT IS READONLY...
  5. Find the line that says
    CustomLog "/private/var/log/httpd/access_log" combined


    **Mac OS X Server: This line needs to be changed into the virtual Host config file located in the virtual host folder
    filename will be "0000_any_80_yourdomain.conf"
    CustomLog "/var/log/httpd/yourdomain_log" Combined

  6. Change the access_log to web_log so the line looks like:
    CustomLog "/private/var/log/httpd/web_log" combined
    So that the webservers writes the log file we placed in the Awstats config file

    **Mac OS X Server: In httpd.conf, change the lines :
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    To read
    LogFormat " %{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat " %{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b" common

  7. SAVE THE FILE AND CLOSE IT
    Place the modified file back into the /etc/httpd folder
    you will be prompted to authenticate, then choose replace

top


Restarting personal web sharing.

Go back in System preferences, under the sharing pane, and enable Personal Web Sharing
by checking it or pressing the start button



Then you can close the system Preferences.

**Mac OS X Server: Turn WEB SERVICES back on in the Server admin tool

top


Creating the first hits and running update for the first time

Since we just created a new log file within apache, we must create a hit for the log file to be created,
so simply click here
This will open your Browser and hit your local web page( the main apache page)
if you prefer to see the user area, add ~username/ in the adress bar.

Now updating for the first time..
Open terminal, if you closed it earlier, and type:
cd /library/webserver/documents/awstats/wwwroot/cgi-bin<enter>
then type :
perl awstats.pl -update -config=theconfigname

Where Theconfigname is the name you have entered in the awstats configure script.

When the update is done, point your web Browser to:
http://localhost/awstats/awstats.pl?config=Theconfigname

You can now exit terminal, and you have awstats working locally.

Isn't that cool?

Hope this helps,


top