Pengen Punya WebSite instan kualitas intan ?

Monday, July 12, 2010

Install AWStats pada OpenSUSE 11.1

Sebelum install awstats, pastikan web server anda up

download dan install awstats
wget http://prdownloads.sourceforge.net/awstats/awstats-6.95.tar.gz
tar -zxvf awstats-6.95.tar.gz
mv awstats-6.95 awstats
mv awstats /home/prayoga/commands.org.uk/htdocs/
cd /home/prayoga/commands.org.uk/htdocs/
mkdir awstats/data
cd awstats/tools/
./awstats_configure.pl

----- AWStats awstats_configure 1.0 (build 1.8) (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).

-----> 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:
/home/prayoga/www/commands.org.uk/htdocs/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] ? y

-----> Check for web server install
Found Web server Apache config file '/usr/local/apache2/conf/httpd.conf'

-----> Check and complete web server config file '/usr/local/apache2/conf/httpd.conf'
Warning: You Apache config file contains directives to write 'common' log files
This means that some features can't work (os, browsers and keywords detection).
Do you want me to setup Apache to write 'combined' log files [y/N] ? y

-----> 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] ? y

-----> 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:
> www.commands.org.uk

-----> 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):
>

-----> 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:
/home/prayoga/www/commands.org.uk/htdocs/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.commands.org.uk
Or if you have several config files and prefer having only one command:
/home/prayoga/www/commands.org.uk/htdocs/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...

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

Press ENTER to finish...

edit config file
vi /etc/awstats/awstats.www.commands.org.uk.conf

## Ubah value baris seperti berikut ##
LogFile="/var/log/apache2/mylog.log"    #(merujuk pada customlog yg ada pada httpd.conf)
DirData="/home/prayoga/commands.org.uk/htdocs/awstats/data"

update manual
/home/prayoga/commands.org.uk/htdocs/awstats/wwwroot/cgi-bin/awstats.pl -update  -config=www.commands.org.uk

Create/Update database for config "/etc/awstats/awstats.www.commands.org.uk.conf" by AWStats version 6.95 (build 1.943)
From data in log file "/var/log/apache2/mylog.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Jumped lines in file: 0
Parsed lines in file: 0
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.

buat crontab
crontab -e

## tambahkan baris berikut ##
*/30 * * * * /home/prayoga/commands.org.uk/htdocs/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.commands.org.uk

buat htpasswd
vi /home/prayoga/commands.org.uk/htdocs/awstats/wwwroot/cgi-bin/.htaccess

## isi dengan baris berikut ##
<FilesMatch "awstats.pl">
AuthName "Login Required"
AuthType Basic
AuthUserFile /home/prayoga/commands.org.uk/htdocs/awstats/wwwroot/.ok_user
require valid-user
</FilesMatch>

/usr/local/apache2/bin/htpasswd -c /home/prayoga/commands.org.uk/htdocs/awstats/wwwroot/.ok_user admin

New password:[masukkan password yang diinginkan]
Re-type new password:[ulangi password]
Adding password for user admin

konfigurasi httpd.conf
vi /usr/local/apache2/conf/httpd.conf

<Directory  "/home/prayoga/www/commands.org.uk/htdocs/awstats/wwwroot">
Options Indexes Multiviews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>

restart webserver

akses http://commands.org.uk/awstats/awstats.pl?config=www.commands.org.uk

masukkan user : admin dan password yang telah dibuat