AWStats

From QNAPedia
Jump to: navigation, search

Below's the installation guide for AWStats on QNAP NAS.

Please note the installation assumes minimum Linux shell skills via SSH/Telnet session.

Source(s): AWStats solutions

Download and install Perl (CLI)

Please follow the guide to have Perl installed on your NAS first.

Source(s): AWStats solutions

Download and install AWStats


Download the latest AWStats installation file to /share/Public. The most current stable version up to date is v 6.7 ( zip / tar.gz )

Source(s): AWStats solutions

Untar the archive and create the neccessary symbolic links


Connect to the NAS box with putty.exe to execute the commands directly in the box.

Use the admin username and password.


NOTE: On this howto, the package is placed under the Public share, if you need it placed elsewhere, just change all the /share/Public references to your own liking.

It was in the former edition placed under HDA_ROOT, but after some time, you can experience disk full problems on the HDA_ROOT partition.


Untar the file archive to /mnt/HDA_ROOT.

Source(s): AWStats solutions 

# cd /share/Public
# tar -zxvf /share/Public/awstats-6.7.tar.gz


Rename the awstats directory:

# mv awstats-6.7 awstats


Create a symbolic link under /usr/local to point to the actual location /mnt/HDA_ROOT/awstats:

# ln -s /share/Public/awstats /usr/local


Create a folder 'db' under default awstats directory and for storing the database files then create a symbolic link 'awstats' under /var/lib to point to it:

# mkdir -p /usr/local/awstats/db 
# ln -s /share/Public/awstats/db /var/lib/awstats


Create a folder 'awstats' under /etc/config for storing the config files then create a symbolic link 'awstats' under /etc to point to it for ease of access:

# mkdir -p /etc/config/awstats
# ln -s /etc/config/awstats /etc


Now we need to make all these link to survive upon reboot

Refer to the guide on editing the Autorun.sh file which will preserve your changes made above. Add the following symbolics we created at Step 3 to the bottom of autorun.sh file:


## Awstats symbolic links
ln -sf /share/Public/awstats/db /var/lib/awstats 
ln -sf /etc/config/awstats /etc 
ln -sf /share/Public/awstats /usr/local

Configuring AWStats step by step guide



Go to the 'tools' folder under the default awstats folder /usr/local/awstats 

# cd /usr/local/awstats/tools


and run:

# perl awstats_configure.pl 


it should output on the console as below:

----- AWStats awstats_configure 1.0 (build 1.7) (c) Laurent Destailleur ----- 
This tool will help you to configure AWStats to analyze statistics for 
one web server. You can try to use it to let it do all that is possible 
in AWStats setup, however following the step by step manual setup 
documentation (docs/index.html) is often a better idea. Above all if: 
- You are not an administrator user, 
- You want to analyze downloaded log files without web server, 
- You want to analyze mail or ftp log files instead of web log files, 
- You need to analyze load balanced servers log files, 
- You want to 'understand' all possible ways to use AWStats... 
Read the AWStats documentation (docs/index.html).


then you will be prompted:

-----> Running OS detected: Linux, BSD or Unix 
Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'. 
If you want to use standard directory, you should first move all content 
of AWStats distribution from current directory: 
/mnt/HDA_ROOT/awstats 
to standard directory: 
/usr/local/awstats 
And then, run configure.pl from this location. 
Do you want to continue setup from this NON standard directory [yN] ?


type in 'y' to accept the current directory.

next you will be prompted:

-----> Check for web server install Enter full config file path of your Web server. 
Example: /etc/httpd/httpd.conf 
Example: /usr/local/apache2/conf/httpd.conf 
Example: c:\Program files\apache group\apache\conf\httpd.conf 
Config file path ('none' to skip web server setup):


type in: '/usr/local/apache/conf/apache.conf'

next you will be prompted:

-----> Need to create a new config file ? 
Do you want me to build a new AWStats config/profile 
file (required if first install) [y/N] ?


type in 'y' to build a new AWStats config/profile file.

next you will be prompted:

-----> Define config file name to create 
What is the name of your web site or profile analysis ? 
Example: www.mysite.com 
Example: demo 
Your web site, virtual server or profile name:


type in a name, I use 'demo' in this how to (your web site, virtual server or profile name as it suggests)

next you will be prompted:

-----> Define config file path 
In which directory do you plan to store your config file(s) ? 
Default: /etc/awstats 
Directory path to store config file(s) (Enter for default):


Just press 'ENTER' to accept the defaults (eg, /etc/awstats)

next you will be give a line of code for updating the records in a regular basis, choose the one suits you.

-----> Add update process inside a scheduler 
Sorry, configure.pl does not support automatic add to cron yet. 
You can do it manually by adding the following command to your cron: 
'''/mnt/HDA_ROOT/awstats/wwwroot/cgi-bin/awstats.pl -update -config=demo''' 
Or if you have several config files and prefer having only one command: 
'''/mnt/HDA_ROOT/awstats/tools/awstats_updateall.pl now''' 
Press ENTER to continue...


and finally:

A SIMPLE config file has been created: /etc/awstats/awstats.demo.conf 
You should have a look inside to check and change manually main parameters. 
You can then manually update your statistics for 'demo' with command: '''
> perl awstats.pl -update -config=demo''' 
You can also read your statistics for 'ts409@home' with URL: 
'''> http://localhost/awstats/awstats.pl?config=demo''' Press ENTER to finish...


Don't forget to add the following line to your crontab under /etc/config for automatic site stats updates

0 2 * * * /mnt/ext/usr/local/awstats/tools/awstats_updateall.pl now

 

Source(s): AWStats solutions 

Verify the installation


Open up your internet browser and point it to the URL as below:

Source(s): AWStats solutions

http://your-nas-ip/awstats/awstats.pl?config=demo