Follow these steps to install, configure, and run awstats on a server
- install the rpm with rpm -Uvh /root/rpms/awstats-3.2-1.noarch.rpm
- move README.TXT to the system documentation directory and remove unneeded
man directory that remains:
mv /opt/awstats/man/README.TXT /usr/share/doc/README.awstats.txt
rmdir /opt/awstats/man
- edit www doc's to remove missing .js references:
cd /var/www/ssl/wb/awstats ; vi '+/\.js' `grep -l '\.js' *`
- verify that the apache log is configured for combined format:
egrep '^[^#].*CustomLog' /etc/httpd/conf/httpd.conf \
/etc/httpd/conf/include/*.conf
- consolidate the awstats template dir:
mv /opt/awstats/lang/ /opt/awstats/wwwroot/cgi-bin/
mv /opt/awstats/wwwroot/ /opt
rmdir /opt/awstats/
mv /opt/wwwroot/ /opt/awstats
- on redhat, disable the default apache log rotation:
cp /etc/logrotate.d/apache /etc/logrotate.d/apache.old
echo "%s/^/#/
wq
" | ed /etc/logrotate.d/apache
cat !$
Note: The process has been automated. This document
is obsolete.
Please see this document
for information on the new automated installation tool.
|
The following steps must be performed for each virtual host
- install the template dir (copy) to someplace accessible by apache:
cp -a /opt/awstats/cgi-bin /var/www/cgi-bin/awstats
mkdir /var/www/awstats
cp -a /opt/awstats/icon /var/www/awstats
- copy the config template into /etc/awstats as
/etc/awstats/awstats.conf or, for virtual hosts:
/etc/awstats/awstats.virtualhostname.conf:
mv /etc/opt/awstats/ /etc
rmdir /etc/opt
cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.some-domain.com.conf
- combine, if needed, any previously split apache log files in
/var/log/httpd:
service httpd stop
cd /var/log/httpd
cat access_log.4 access_log.3 access_log.2 access_log.1 access_log > access_log.new
[ -d attic ] || mkdir attic
for f in access_log.4 access_log.3 access_log.2 access_log.1 access_log ; do
mv $f attic
done
mv access_log.new access_log
service httpd start
- copy the site logo image file into the icon/other directory:
cp /var/www/html/img/logo.jpg /var/www/awstats/icon/other
- edit the config file created above:
vi /etc/awstats/awstats.some-domain.com.conf
- create the data directory in /var/cache/awstats:
mkdir /var/cache/awstats
- run awstats to initialize the data. will probably take a while. the
following command line will capture the output and time the run:
time /var/www/cgi-bin/awstats/awstats.pl -config=some-domain.com \
-update 2>&1 | tee /root/awstats.out
- configure the httpd.conf file for the site to create aliases for awstats
and restart the server:
Alias /awstats /var/www/awstats
service httpd restart
- create a link on the website to point to the output in
http://virtual.host.name/awstats/
- add a cron job for root to update the index the site hourly.
additional hosts may simply add a line to the file:
touch /etc/cron.hourly/awstats && chmod 754 /etc/cron.hourly/awstats
cat < /etc/cron.hourly/awstats
#!/bin/bash
# update access statistics for the web site
/var/www/cgi-bin/awstats/awstats.pl -config=some-domain.com -update
exit 0
EOM
- point your browser to the link,
http://some-domain.com/cgi-bin/awstats.pl, and enjoy!
|