ผลต่างระหว่างรุ่นของ "ติดตั้ง awstats บน ubuntu"
จาก Wiki Opensource
แถว 8: | แถว 8: | ||
<br/> | <br/> | ||
#ติดตั้งด้วยคำสั่ง sudo apt-get install awstats<br/><br/> | #ติดตั้งด้วยคำสั่ง sudo apt-get install awstats<br/><br/> | ||
− | #ตัวอย่างสร้างแสดงผลของ web server ดังนี้<br/>sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.mydomain.conf<br/>แก้ไข/ปรับปรุงแฟ้ม /etc/awstats/awstats.mydomain.conf ให้มีค่าตัวแปรประมาณว่า<br/>LogFile="/var/log/apache2/access.log"<br/>LogFormat=4<br/>SiteDomain="your.domain"<br/>HostAliases="localhost 127.0.0.1"<br/><br/>สร้างแฟ้ม /etc/apache2/conf.d/awstats ให้มีข้อมูลว่า<br/>Alias /awstatsclasses "/usr/share/awstats/lib/"<br/>Alias /awstats-icon/ "/usr/share/awstats/icon/"<br/>Alias /awstatscss "/usr/share/doc/awstats/examples/css"<br/>ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/<br/>ScriptAlias /awstats/ /usr/lib/cgi-bin/<br/>Options ExecCGI -MultiViews +SymLinksIfOwnerMatch<br/><br/>สั่งให้เริ่มประมวลผลสถิติข้อมูลด้วยคำสั่ง sudo /usr/lib/cgi-bin/awstats.pl -config=mydomain -update<br/>จะได้ข้อความแสดงผลประมาณว่า<br/>Create/Update database for config "/etc/awstats/awstats.mydomain.conf" by AWStats version 6.7 (build 1.892)<br/>From data in log file "/var/log/apache2/access.log"...<br/>Phase 1 : First bypass old records, searching new record...<br/>Searching new records from beginning of log file...<br/>Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...<br/>Jumped lines in file: 0<br/>Parsed lines in file: 1223<br/>Found 0 dropped records,<br/>Found 0 corrupted records,<br/>Found 0 old records,<br/>Found 1223 new qualified records.<br/>แสดงว่า awstats ทำงานได้แล้ว<br/>ดูผลงานบนเวบได้ที่ <nowiki>http://your.domain/awstats/awstats.pl?config=mydomain</nowiki><br/><br/>ต่อไปสั่งให้ระบบประมวลผลสถิติอัตโนมัติ<br/>แก้ไขแฟ้ม /etc/cron.d/awstats ให้เป็นประมาณว่า<br/>*/10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=mydomain -update > /dev/null<br/>แล้วสังให้ cron ทำงานใหม่ด้วยคำสั่ง sudo /etc/init.d/cron reload<br/><br/>------------------------------------------------------------------------------------------------------------------<br/><br/>เพิ่มเติม by wisit 4-11-57<br/>สำหรับ ubuntu 12.04 , 14.04 ติดตั้งตามนี้ [https://help.ubuntu.com/community/AWStats https://help.ubuntu.com/community/AWStats]<br/>ต้องการติดตั้งแบบรวดเร็ว script สำหรับ install awstats download scripts ได้ที่ [ftp://ftp.psu.ac.th/pub/psu12-sritrang/download/scripts-pom/installawstats.sh ftp://ftp.psu.ac.th/pub/psu12-sritrang/download/scripts-pom/installawstats.sh]<br/>วิธีการใช้งาน<br/>เปลี่ยนสิทธิ์เป็น root<br/><span style="color:#0000ff;">sudo su - </span><br/>download script<br/>แล้ว run script<br/><span style="color:#0000ff;">bash installawstats.sh</span><br/>รอจนเสร็จ<br/>ดูผลงานได้ที่ <span style="color:#0000ff;">[http://xx.xx.xx.xx/awstats/awstats.pl http://xx.xx.xx.xx/awstats/awstats.pl]</span> (xx.xx.xx.xx = ip server ที่ติดตั้ง awstats)<br/>เพิ่มข้อความใน crontab -e ดังนี้< | + | #ตัวอย่างสร้างแสดงผลของ web server ดังนี้<br/>sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.mydomain.conf<br/>แก้ไข/ปรับปรุงแฟ้ม /etc/awstats/awstats.mydomain.conf ให้มีค่าตัวแปรประมาณว่า<br/>LogFile="/var/log/apache2/access.log"<br/>LogFormat=4<br/>SiteDomain="your.domain"<br/>HostAliases="localhost 127.0.0.1"<br/><br/>สร้างแฟ้ม /etc/apache2/conf.d/awstats ให้มีข้อมูลว่า<br/>Alias /awstatsclasses "/usr/share/awstats/lib/"<br/>Alias /awstats-icon/ "/usr/share/awstats/icon/"<br/>Alias /awstatscss "/usr/share/doc/awstats/examples/css"<br/>ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/<br/>ScriptAlias /awstats/ /usr/lib/cgi-bin/<br/>Options ExecCGI -MultiViews +SymLinksIfOwnerMatch<br/><br/>สั่งให้เริ่มประมวลผลสถิติข้อมูลด้วยคำสั่ง sudo /usr/lib/cgi-bin/awstats.pl -config=mydomain -update<br/>จะได้ข้อความแสดงผลประมาณว่า<br/>Create/Update database for config "/etc/awstats/awstats.mydomain.conf" by AWStats version 6.7 (build 1.892)<br/>From data in log file "/var/log/apache2/access.log"...<br/>Phase 1 : First bypass old records, searching new record...<br/>Searching new records from beginning of log file...<br/>Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...<br/>Jumped lines in file: 0<br/>Parsed lines in file: 1223<br/>Found 0 dropped records,<br/>Found 0 corrupted records,<br/>Found 0 old records,<br/>Found 1223 new qualified records.<br/>แสดงว่า awstats ทำงานได้แล้ว<br/>ดูผลงานบนเวบได้ที่ <nowiki>http://your.domain/awstats/awstats.pl?config=mydomain</nowiki><br/><br/>ต่อไปสั่งให้ระบบประมวลผลสถิติอัตโนมัติ<br/>แก้ไขแฟ้ม /etc/cron.d/awstats ให้เป็นประมาณว่า<br/>*/10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=mydomain -update > /dev/null<br/>แล้วสังให้ cron ทำงานใหม่ด้วยคำสั่ง sudo /etc/init.d/cron reload<br/><br/>------------------------------------------------------------------------------------------------------------------<br/><br/>เพิ่มเติม by wisit 4-11-57<br/>สำหรับ ubuntu 12.04 , 14.04 ติดตั้งตามนี้ [https://help.ubuntu.com/community/AWStats https://help.ubuntu.com/community/AWStats]<br/>ต้องการติดตั้งแบบรวดเร็ว script สำหรับ install awstats download scripts ได้ที่ [ftp://ftp.psu.ac.th/pub/psu12-sritrang/download/scripts-pom/installawstats.sh ftp://ftp.psu.ac.th/pub/psu12-sritrang/download/scripts-pom/installawstats.sh]<br/>วิธีการใช้งาน<br/>เปลี่ยนสิทธิ์เป็น root<br/><span style="color:#0000ff;">sudo su - </span><br/>download script<br/>แล้ว run script<br/><span style="color:#0000ff;">bash installawstats.sh</span><br/>รอจนเสร็จ<br/>ดูผลงานได้ที่ <span style="color:#0000ff;">[http://xx.xx.xx.xx/awstats/awstats.pl http://xx.xx.xx.xx/awstats/awstats.pl]</span> (xx.xx.xx.xx = ip server ที่ติดตั้ง awstats)<br/>เพิ่มข้อความใน crontab -e ดังนี้ <span style="color:#0000ff;"><span style="font-size: 12.222222328186px; white-space: pre-wrap;">0 * * * * /usr/lib/cgi-bin/awstats.pl -config=xx.xx.xx.xx -update > /dev/null</span></span><pre style="word-wrap: break-word; white-space: pre-wrap;"><span style="font-family: Arial, Verdana, sans-serif; font-size: 12px;">จบแล้วครับ</span></pre>ขอบคุณครับ<br/><br/>รายละเอียด script<br/><div>#pom 4-11-57</div><div>#[https://help.ubuntu.com/community/AWStats https://help.ubuntu.com/community/AWStats]</div><div>sudo apt-get install awstats -y</div><div>MYIP=$(ifconfig eth0|grep -w "inet"|awk '{print $2}'|cut -d':' -f 2)</div><div>FILE1=/etc/awstats/awstats.${MYIP}.conf</div><div>sudo cp /etc/awstats/awstats.conf $FILE1</div><div>sudo sed -i '/SiteDomain=/ c SiteDomain="'${MYIP}'"' $FILE1</div><div>sudo sed -i '/HostAliases=/ c HostAliases="localhost 127.0.0.1 '${MYIP}'"'</div><div>sudo /usr/lib/cgi-bin/awstats.pl -config=${MYIP} -update</div><div>sudo a2enmod cgi</div><div><br/></div><div>FILE2=/etc/apache2/sites-available/000-default.conf #14.04</div><div>FILE3=/etc/apache2/sites-available/default #12.04</div><div>sudo cp ${FILE2} ${HOME}</div><div>sudo cp ${FILE3} ${HOME}</div><div>FILE4=myfile.txt</div><div>sudo cat > ${FILE4} <<EOF</div><div>Alias /awstatsclasses "/usr/share/awstats/lib/"</div><div>Alias /awstats-icon "/usr/share/awstats/icon/"</div><div>Alias /awstatscss "/usr/share/doc/awstats/examples/css"</div><div>ScriptAlias /awstats/ /usr/lib/cgi-bin/</div><div>Options ExecCGI -MultiViews +SymLinksIfOwnerMatch</div><div>EOF</div><div>for i in ${FILE2} ${FILE3}</div><div>do</div><div>line1=$(grep -n '/VirtualHost' $i | cut -d\: -f1)</div><div>line2=$(expr $line1 - 1)</div><div>sed -i ''$line2' r '${FILE4}'' $i</div><div>done</div><div>sudo service apache2 restart</div><div>echo "----------------------------"</div><div>echo "check url [http://${MYIP}/awstats/awstats.pl http://${MYIP}/awstats/awstats.pl]"</div><div>echo "add to crontab => 0 * * * * /usr/lib/cgi-bin/awstats.pl -config=${MYIP} -update > /dev/null"</div><div>echo "----------------------------"</div><div><br/></div>------------------------------------------------------------------------------------------------------------------------------- |
รุ่นปรับปรุงเมื่อ 15:13, 4 พฤศจิกายน 2557
บันทึกนี้ปรับปรุงล่าสุดเมื่อวันที่ 29-09-2551
ดูแลโดย WIPAT
- ทดสอบกับ ubuntu 8.04
- ติดตั้งด้วยคำสั่ง sudo apt-get install awstats
- ตัวอย่างสร้างแสดงผลของ web server ดังนี้
sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.mydomain.conf
แก้ไข/ปรับปรุงแฟ้ม /etc/awstats/awstats.mydomain.conf ให้มีค่าตัวแปรประมาณว่า
LogFile="/var/log/apache2/access.log"
LogFormat=4
SiteDomain="your.domain"
HostAliases="localhost 127.0.0.1"
สร้างแฟ้ม /etc/apache2/conf.d/awstats ให้มีข้อมูลว่า
Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /awstats/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
สั่งให้เริ่มประมวลผลสถิติข้อมูลด้วยคำสั่ง sudo /usr/lib/cgi-bin/awstats.pl -config=mydomain -update
จะได้ข้อความแสดงผลประมาณว่า
Create/Update database for config "/etc/awstats/awstats.mydomain.conf" by AWStats version 6.7 (build 1.892)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 1223
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 1223 new qualified records.
แสดงว่า awstats ทำงานได้แล้ว
ดูผลงานบนเวบได้ที่ http://your.domain/awstats/awstats.pl?config=mydomain
ต่อไปสั่งให้ระบบประมวลผลสถิติอัตโนมัติ
แก้ไขแฟ้ม /etc/cron.d/awstats ให้เป็นประมาณว่า
*/10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=mydomain -update > /dev/null
แล้วสังให้ cron ทำงานใหม่ด้วยคำสั่ง sudo /etc/init.d/cron reload
------------------------------------------------------------------------------------------------------------------
เพิ่มเติม by wisit 4-11-57
สำหรับ ubuntu 12.04 , 14.04 ติดตั้งตามนี้ https://help.ubuntu.com/community/AWStats
ต้องการติดตั้งแบบรวดเร็ว script สำหรับ install awstats download scripts ได้ที่ ftp://ftp.psu.ac.th/pub/psu12-sritrang/download/scripts-pom/installawstats.sh
วิธีการใช้งาน
เปลี่ยนสิทธิ์เป็น root
sudo su -
download script
แล้ว run script
bash installawstats.sh
รอจนเสร็จ
ดูผลงานได้ที่ http://xx.xx.xx.xx/awstats/awstats.pl (xx.xx.xx.xx = ip server ที่ติดตั้ง awstats)
เพิ่มข้อความใน crontab -e ดังนี้ 0 * * * * /usr/lib/cgi-bin/awstats.pl -config=xx.xx.xx.xx -update > /dev/null<span style="font-family: Arial, Verdana, sans-serif; font-size: 12px;">จบแล้วครับ</span>
ขอบคุณครับ
รายละเอียด script#pom 4-11-57sudo apt-get install awstats -yMYIP=$(ifconfig eth0|grep -w "inet"|awk '{print $2}'|cut -d':' -f 2)FILE1=/etc/awstats/awstats.${MYIP}.confsudo cp /etc/awstats/awstats.conf $FILE1sudo sed -i '/SiteDomain=/ c SiteDomain="'${MYIP}'"' $FILE1sudo sed -i '/HostAliases=/ c HostAliases="localhost 127.0.0.1 '${MYIP}'"'sudo /usr/lib/cgi-bin/awstats.pl -config=${MYIP} -updatesudo a2enmod cgiFILE2=/etc/apache2/sites-available/000-default.conf #14.04FILE3=/etc/apache2/sites-available/default #12.04sudo cp ${FILE2} ${HOME}sudo cp ${FILE3} ${HOME}FILE4=myfile.txtsudo cat > ${FILE4} <<EOFAlias /awstatsclasses "/usr/share/awstats/lib/"Alias /awstats-icon "/usr/share/awstats/icon/"Alias /awstatscss "/usr/share/doc/awstats/examples/css"ScriptAlias /awstats/ /usr/lib/cgi-bin/Options ExecCGI -MultiViews +SymLinksIfOwnerMatchEOFfor i in ${FILE2} ${FILE3}doline1=$(grep -n '/VirtualHost' $i | cut -d\: -f1)line2=$(expr $line1 - 1)sed -i $line2' r '${FILE4} $idonesudo service apache2 restartecho "----------------------------"echo "check url http://${MYIP}/awstats/awstats.pl"echo "add to crontab => 0 * * * * /usr/lib/cgi-bin/awstats.pl -config=${MYIP} -update > /dev/null"echo "----------------------------"-------------------------------------------------------------------------------------------------------------------------------