สำหรับ Debian, UbuntuCode
# apt-get install apache2 libgd-gd2-perl
# wget http://sourceforge.net/projects/lightsquid/files/lightsquid/1.8/lightsquid-1.8.tgz
# tar -zxvf lightsquid-1.8.tgz
# mv lightsquid-1.8 /var/www/lightsquid
# cd /var/www/
# chown -R www-data:www-data lightsquid
# cd /var/www/lightsquid
- ตั้งค่าให้ ทำงานได้
# chmod +x *.cgi
# chmod +x *.pl
- ไปแก้ไขไฟล์ lightsquid.cfg ตั้งค่า Global variables ต่างๆ ให้ตรงตามเครื่อง server เช่น
$cfgpath ="/www/lightsquid";
$tplpath ="/www/lightsquid/tpl";
$langpath ="/www/lightsquid/lang";
$reportpath ="/www/lightsquid/report";
$logpath ="/var/lib/squid/logs"; <------- ดูให้ตรงกับในเครื่อง server
$ip2namepath ="/www/lightsquid/ip2name";
$lockpath =$reportpath;
$maxlocktime = 30*60;
$debug = 0;
$debug2 = 0;
$graphreport = 0; <------- กรณีไม่ได้ติดตั้ง module libgd, GD.PM
ส่วนอื่นๆ ตั้งตามที่ติดมากับโปรแกรม
แก้ไข /etc/apache2/httpd.conf
Alias /report /var/www/lightsquid
<Directory "/var/www/lightsquid">
AddHandler cgi-script .cgi
AllowOverride All
</Directory>
- restart apache2
# /etc/init.d/apache2 restart
# /var/www/lightsquid/lightparser.pl
- เมื่อเสร็จแล้ว ให้ตรวจสอบการติดตั้งโดยเรียกสคริปต์ ./check-setup.pl ถ้าทุกอย่างถูกต้องให้นำเข้าข้อมูลเก่าได้เลย โดยสั่ง
# ./lightparser.pl access.log.0.{gz|bz2}
# ./lightparser.pl access.log.1.{gz|bz2}
# ./lightparser.pl access.log.2.{gz|bz2}
ไปเรื่อยๆ
- ไปตั้งค่า crontab ให้ทำงานตามช่วงเวลา ตามที่เราต้องการ ในที่นี้ ผมให้ทำงานวันละครั้งตอน 4 นาฬิกา 5 นาทีหลังจากที่ squid ทำการ rotate log ไปเรียบร้อยแล้วตอนตี 4
# crontab -e
0 4 * * * /usr/sbin/squid -k rotate
5 4 * * * /var/www/lightsquid/lightparser.pl
- เรียกดูข้อมูลได้จากเว็บ http://ip_server/report
- เป็นอันเรียบร้อย ทีนี้ เราก็สามารถตรวจสอบได้แล้ว ว่าใครใช้เน็ต ไปไหนบ้าง ใช้ปริมาณ มากน้อยเท่าไหร่ ใช้เวลาไหน
วันเสาร์ที่ 22 ตุลาคม พ.ศ. 2554
วันเสาร์ที่ 18 ธันวาคม พ.ศ. 2553
Port-Forwarding With rinetd On Debian Etch
1 Preliminary Note
In this example I'm trying to redirect HTTP traffic (port 80) from the IP address 192.168.0.101 to the IP address 192.168.0.100.
Please note that rinetd is not able to redirect FTP because FTP requires more than one socket.
2 Installing And Configuring rinetd
To install rinetd, we simply run
apt-get install rinetd
rinetd's configuration file is /etc/rinetd.conf. To forward HTTP traffic from 192.168.0.101 to 192.168.0.100, we add the line 192.168.0.101 80 192.168.0.100 80:
vi /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
192.168.0.101 80 192.168.0.100 80
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
Then we restart rinetd:
/etc/init.d/rinetd restart
Now run
netstat -tap
and you should see that rinetd is listening on port 80 (www):
server2:~# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:sunrpc *:* LISTEN 1956/portmap
tcp 0 0 server2.example.com:www *:* LISTEN 2485/rinetd
tcp 0 0 *:3025 *:* LISTEN 2347/rpc.statd
tcp 0 0 *:auth *:* LISTEN 2306/inetd
tcp 0 0 localhost.localdom:smtp *:* LISTEN 2294/exim4
tcp6 0 0 *:ssh *:* LISTEN 2326/sshd
tcp6 0 0 server2.example.com:ssh ::ffff:192.168.0.3:4776 ESTABLISHED2409/0
server2:~#
Now when you direct your browser to a web page on the IP address 192.168.0.101, it should receive that page from the server with the IP address 192.168.0.100.
Instead of specifiying the port numbers in /etc/rinetd.conf, you can also use the service names. The service names are stored in /etc/services, so when you open that file, you will see that the service for port 80 is named www on Debian.
grep 80 /etc/services
server2:~# grep 80 /etc/services
www 80/tcp http # WorldWideWeb HTTP
www 80/udp # HyperText Transfer Protocol
socks 1080/tcp # socks proxy server
socks 1080/udp
amanda 10080/tcp # amanda backup services
amanda 10080/udp
omirr 808/tcp omirrd # online mirror
omirr 808/udp omirrd
canna 5680/tcp # cannaserver
zope-ftp 8021/tcp # zope management by ftp
webcache 8080/tcp # WWW caching service
tproxy 8081/tcp # Transparent Proxy
omniorb 8088/tcp # OmniORB
omniorb 8088/udp
server2:~#
So you could use the following configuration in /etc/rinetd.conf, it has the same effect as the first one:
vi /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
192.168.0.101 www 192.168.0.100 www
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
And to make rinetd listen on all IP addresses that are configured on the system where it is installed, we can use 0.0.0.0 as the bindaddress:
vi /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
0.0.0.0 80 192.168.0.100 80
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
After you've restarted rinetd...
/etc/init.d/rinetd restart
... rinetd should now listen on all interfaces (*:www):
netstat -tap
server2:~# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:sunrpc *:* LISTEN 1956/portmap
tcp 0 0 *:www *:* LISTEN 2503/rinetd
tcp 0 0 *:3025 *:* LISTEN 2347/rpc.statd
tcp 0 0 *:auth *:* LISTEN 2306/inetd
tcp 0 0 localhost.localdom:smtp *:* LISTEN 2294/exim4
tcp 0 0 server2.example.com:www 192.168.0.3:4798 TIME_WAIT -
tcp6 0 0 *:ssh *:* LISTEN 2326/sshd
tcp6 0 148 server2.example.com:ssh ::ffff:192.168.0.3:4776 ESTABLISHED2409/0
server2:~#
http://www.deimos.fr/blocnotesinfo/images/c/cb/Port-Forwarding_With_rinetd_On_Debian_Etch.pdf
In this example I'm trying to redirect HTTP traffic (port 80) from the IP address 192.168.0.101 to the IP address 192.168.0.100.
Please note that rinetd is not able to redirect FTP because FTP requires more than one socket.
2 Installing And Configuring rinetd
To install rinetd, we simply run
apt-get install rinetd
rinetd's configuration file is /etc/rinetd.conf. To forward HTTP traffic from 192.168.0.101 to 192.168.0.100, we add the line 192.168.0.101 80 192.168.0.100 80:
vi /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
192.168.0.101 80 192.168.0.100 80
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
Then we restart rinetd:
/etc/init.d/rinetd restart
Now run
netstat -tap
and you should see that rinetd is listening on port 80 (www):
server2:~# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:sunrpc *:* LISTEN 1956/portmap
tcp 0 0 server2.example.com:www *:* LISTEN 2485/rinetd
tcp 0 0 *:3025 *:* LISTEN 2347/rpc.statd
tcp 0 0 *:auth *:* LISTEN 2306/inetd
tcp 0 0 localhost.localdom:smtp *:* LISTEN 2294/exim4
tcp6 0 0 *:ssh *:* LISTEN 2326/sshd
tcp6 0 0 server2.example.com:ssh ::ffff:192.168.0.3:4776 ESTABLISHED2409/0
server2:~#
Now when you direct your browser to a web page on the IP address 192.168.0.101, it should receive that page from the server with the IP address 192.168.0.100.
Instead of specifiying the port numbers in /etc/rinetd.conf, you can also use the service names. The service names are stored in /etc/services, so when you open that file, you will see that the service for port 80 is named www on Debian.
grep 80 /etc/services
server2:~# grep 80 /etc/services
www 80/tcp http # WorldWideWeb HTTP
www 80/udp # HyperText Transfer Protocol
socks 1080/tcp # socks proxy server
socks 1080/udp
amanda 10080/tcp # amanda backup services
amanda 10080/udp
omirr 808/tcp omirrd # online mirror
omirr 808/udp omirrd
canna 5680/tcp # cannaserver
zope-ftp 8021/tcp # zope management by ftp
webcache 8080/tcp # WWW caching service
tproxy 8081/tcp # Transparent Proxy
omniorb 8088/tcp # OmniORB
omniorb 8088/udp
server2:~#
So you could use the following configuration in /etc/rinetd.conf, it has the same effect as the first one:
vi /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
192.168.0.101 www 192.168.0.100 www
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
And to make rinetd listen on all IP addresses that are configured on the system where it is installed, we can use 0.0.0.0 as the bindaddress:
vi /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
0.0.0.0 80 192.168.0.100 80
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
After you've restarted rinetd...
/etc/init.d/rinetd restart
... rinetd should now listen on all interfaces (*:www):
netstat -tap
server2:~# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:sunrpc *:* LISTEN 1956/portmap
tcp 0 0 *:www *:* LISTEN 2503/rinetd
tcp 0 0 *:3025 *:* LISTEN 2347/rpc.statd
tcp 0 0 *:auth *:* LISTEN 2306/inetd
tcp 0 0 localhost.localdom:smtp *:* LISTEN 2294/exim4
tcp 0 0 server2.example.com:www 192.168.0.3:4798 TIME_WAIT -
tcp6 0 0 *:ssh *:* LISTEN 2326/sshd
tcp6 0 148 server2.example.com:ssh ::ffff:192.168.0.3:4776 ESTABLISHED2409/0
server2:~#
http://www.deimos.fr/blocnotesinfo/images/c/cb/Port-Forwarding_With_rinetd_On_Debian_Etch.pdf
วันอังคารที่ 14 ธันวาคม พ.ศ. 2553
เก็บ Packet Install Ubuntu&Debian
sudo apt-get --print-uris --yes upgrade | grep ^\' | cut -d\' -f2 >mydownload.txt
wget --input-file mydownload.txt
wget --input-file mydownload.txt
วันพุธที่ 8 ธันวาคม พ.ศ. 2553
วันอังคารที่ 23 พฤศจิกายน พ.ศ. 2553
การสร้าง auto dj ใน shoutcast
การสร้าง auto dj ใน shoutcast
ไปเจอคำแนะนำใน thaihosttalk.com และค้นหาจาก google.com ได้รายละเอียดจากเว็บนี้ครับ http://www.packhuso.in.th/?p=73
จึง ลอก เนื้อหามาไว้ที่นี้ กัน ลืมครับ และเพื่อนๆ จะไ้ด้ใช้ประโยชน์ด้วย
*******************************
*********************************
ไปเจอคำแนะนำใน thaihosttalk.com และค้นหาจาก google.com ได้รายละเอียดจากเว็บนี้ครับ http://www.packhuso.in.th/?p=73
จึง ลอก เนื้อหามาไว้ที่นี้ กัน ลืมครับ และเพื่อนๆ จะไ้ด้ใช้ประโยชน์ด้วย
*******************************
*********************************
Download โปรแกรมสำหรับใช้งานได้ที่นี่
http://download.shoutcast.com/beta/sc_trans-Beta-Drop-5-2009_02_03.zip
หลังจาก Download เสร็จแล้วจะมีรายละเอียดการ Config โปรแกรม ดังนี้นคะรับ.
โฟลเดอร์ที่เก็บไฟล์ของผมนะครับ. (/streams/jvond_trans/)
music (โฟลเดอร์)
sc_trans (ไฟล์)
sc_trans.conf (ไฟล์)
trans.lst (ไฟล์)
______________________________
ลองดู Config ได้ตามด้านล่างนะครับ. (sc_trans.conf);
;; ENCODER OPTIONS
encoder=mp3
bitrate=96000
samplerate=44100
channels=2
;;; NETWORK OPTIONS
outprotocol=1
serverip=64.150.166.74
serverport=9000
password=XXXXXX
;;;; LOGGING OPTIONS:
;where does the log file go
logfile=/streams/jvond_trans/sc_trans.log
; 1 to do screen logging else 0
screenlog=1
;;;;;; METADATA CONTROL
; my stream name
streamtitle=JVonD Productions
; url related to my stream
streamurl=http://jvondproductions.com
; my genre
genre=trance
; other assorted stuff
;aim=myaimaddr
;irc=myirc
;icq=myicq
; register with yp
public=1
;;;; PLAYLIST CONTROL
; your playlist
playlistfile=/streams/jvond_trans/trans.lst
; by default we shuffle the playlist. Lets turn that off
shuffle = 0
; set our crossfade time to 2 seconds. zero means no xfade
xfade=2
; file must be at least 20 seconds or we don’t crossfade
xfadethreshold=20
; drop folder for priority playlists
playlists=/streams/jvond_trans/
; where finished priority playlists get copied
archive=/streams/jvond_trans/
;;; LIVE CAPTURE:
; don’t capture
capture=0
; set capture parameters
;capturedevice=Sound Blaster
;captureinput=Line-In
;capturesamplerate=44100
;capturechannels=2
;;;; DJ SUPPORT:
; dj listen port
djport=9016
; dj password
djpassword=XXXXXX
; idle time until auto-dump
autodumpsourcetime=30
; record dj broadcasts here
djbroadcasts=
;; REPLAY GAIN CONTROL:
applyreplaygain=0
calculatereplaygain=0
;;; OTHER:
adminport=5555
adminuser=admin
adminpassword=XXXXXX__________________________________
ข้อมูลในไฟล์ List นะครับ. (trans.lst);
/streams/jvond_trans/music/08_Measure.mp3
/streams/jvond_trans/music/09_DeEase.mp3
___________________________________
เสร็จแล้วสามารถสั่ง Run ได้ตามแบบด้านล่างเลยนะครับ.. (สำหรับ Linux ถ้าเป็น Windows ก็ ดับเบิ่ลคลิ๊กเอา)
[root@localhost jvond_trans]# ./sc_trans
หรือ
[root@localhost jvond_trans]#./sc_trans sc_config1.conf
สำหรับการโหลด Config ไฟล์อื่น
เพิ่มเติมครับ.
เมื่อสั่ง Run Auto DJ แล้ว Auto DJ จะทำงานเมื่อสถานะของ Server ไม่มีการเชื่อมต่อจาก DJ คนอื่นนะครับ. พูดง่ายๆ คือ ถ้าเราจัดรายการอยู่ Auto DJ จะไม่ทำงาน แต่พอเราออกปุ๊บมันจะทำงานเองเลย ครับ.
*********************************
*********************************
http://download.shoutcast.com/beta/sc_trans-Beta-Drop-5-2009_02_03.zip
หลังจาก Download เสร็จแล้วจะมีรายละเอียดการ Config โปรแกรม ดังนี้นคะรับ.
โฟลเดอร์ที่เก็บไฟล์ของผมนะครับ. (/streams/jvond_trans/)
music (โฟลเดอร์)
sc_trans (ไฟล์)
sc_trans.conf (ไฟล์)
trans.lst (ไฟล์)
______________________________
ลองดู Config ได้ตามด้านล่างนะครับ. (sc_trans.conf);
;; ENCODER OPTIONS
encoder=mp3
bitrate=96000
samplerate=44100
channels=2
;;; NETWORK OPTIONS
outprotocol=1
serverip=64.150.166.74
serverport=9000
password=XXXXXX
;;;; LOGGING OPTIONS:
;where does the log file go
logfile=/streams/jvond_trans/sc_trans.log
; 1 to do screen logging else 0
screenlog=1
;;;;;; METADATA CONTROL
; my stream name
streamtitle=JVonD Productions
; url related to my stream
streamurl=http://jvondproductions.com
; my genre
genre=trance
; other assorted stuff
;aim=myaimaddr
;irc=myirc
;icq=myicq
; register with yp
public=1
;;;; PLAYLIST CONTROL
; your playlist
playlistfile=/streams/jvond_trans/trans.lst
; by default we shuffle the playlist. Lets turn that off
shuffle = 0
; set our crossfade time to 2 seconds. zero means no xfade
xfade=2
; file must be at least 20 seconds or we don’t crossfade
xfadethreshold=20
; drop folder for priority playlists
playlists=/streams/jvond_trans/
; where finished priority playlists get copied
archive=/streams/jvond_trans/
;;; LIVE CAPTURE:
; don’t capture
capture=0
; set capture parameters
;capturedevice=Sound Blaster
;captureinput=Line-In
;capturesamplerate=44100
;capturechannels=2
;;;; DJ SUPPORT:
; dj listen port
djport=9016
; dj password
djpassword=XXXXXX
; idle time until auto-dump
autodumpsourcetime=30
; record dj broadcasts here
djbroadcasts=
;; REPLAY GAIN CONTROL:
applyreplaygain=0
calculatereplaygain=0
;;; OTHER:
adminport=5555
adminuser=admin
adminpassword=XXXXXX__________________________________
ข้อมูลในไฟล์ List นะครับ. (trans.lst);
/streams/jvond_trans/music/08_Measure.mp3
/streams/jvond_trans/music/09_DeEase.mp3
___________________________________
เสร็จแล้วสามารถสั่ง Run ได้ตามแบบด้านล่างเลยนะครับ.. (สำหรับ Linux ถ้าเป็น Windows ก็ ดับเบิ่ลคลิ๊กเอา)
[root@localhost jvond_trans]# ./sc_trans
หรือ
[root@localhost jvond_trans]#./sc_trans sc_config1.conf
สำหรับการโหลด Config ไฟล์อื่น
เพิ่มเติมครับ.
เมื่อสั่ง Run Auto DJ แล้ว Auto DJ จะทำงานเมื่อสถานะของ Server ไม่มีการเชื่อมต่อจาก DJ คนอื่นนะครับ. พูดง่ายๆ คือ ถ้าเราจัดรายการอยู่ Auto DJ จะไม่ทำงาน แต่พอเราออกปุ๊บมันจะทำงานเองเลย ครับ.
*********************************
*********************************
สมัครสมาชิก:
บทความ (Atom)