BLOG.REZARD.COM ≫ Linux Command TIP Project ≫ Interest

latin1 로 저장된 db 를 euckr 또는 utf8로 변환하는 방법

StudyRoom/Linux_Server

1. 백업하기
   mysqldump -u{username} -p{password} {dbname} --default-character-set latin1 > {dump}.sql
   여기서 제일 중요한 것이 --default-character-set latin1 입니다.
   이것이 없으면 온전하게 백업이 되지 않으니 여러가지로 어렵습니다.

2. 문자셋 변환하기
    (문제가 되는 것이 보통 이 과정에서 메모장이나 에딕터를 이용하게 되면 깨져서 복원을 할때 에러가 발생합니다.)   
    utf8로 변환 할때 
    iconv -c -f cp949 -t utf-8  원본파일명  > 변환될 파일명.sql
    euckr 이라면 변환 할때 
    iconv -c -f cp949 -t euckr 원본파일명  > 변환될 파일명.sql

3. 복원될 테이블 구조 변환하기
   (문자셋 변환이 정상적으로 되었으니 이제 에딕터나 메모장을 사용해도 됩니다.)
    NAMES latin1;  =>  SET NAMES utf8; 으로 변경합니다. 
    CHARSET=latin1;  => DEFAULT CHARSET=utf8; 으로 변경합니다. 
    귀찬으면 latin1 =>  utf8; 변경해도 됩니다.
    새이름으로 저장하시고,

5, 디비 생성 
    이때 utf8_general_ci 로 생성 합니다. 

6, mysql 을 다시 시작 합니다. 

7, 디비 복원 
mysql --default-character-set utf8 -u{username} -p{password} {utf8-dbname} < {dump}.sql



[]

DSS Darwin Streaming Server CentOS Installer

StudyRoom/Linux_Server

DSS Darwin Streaming Server CentOS Installer

외쿡 블로그에서 퍼왔음..

1) login as root

2) Make sure you are in /root you can do this with the ‘pwd’ command or ‘cd /root’

3) Get my script ‘wget http://inceptionhosting.com/dss.tar’ (Inception Hosting are a Quality EU hosting company)

4) Untar the file ‘tar xfv dss.tar’

5) Make the installer executable ‘chmod +x dss-installer.sh’

6) Run the script ‘./dss-installer.sh’


아쥬 간단함... 요기서 중요한 건... 6번을 진행하기전에 .. 

"Development Tools"을 OS세팅할때 선택했는지가 중요하다! 안했다면~! 

]# yum groupinstall ‘Development Tools’  ㄱㄱㄱㄱ


고로... 순서는...

]# su -

]# cd ~

]# wget http://inceptionhosting.com/dss.tar

]# tar xzfp dss.tar

]# chmod 755 dss-installer.sh

]# ./dss-installer.sh

끝... 근데.. apache를 미리 설치하는게 맘 편하다~ 설치 안되어 있어도 관리자 페이지는 접속된다.

테스트 파일이 들어 있으니 그것으로 테스트 해도 되지만 굳이~ 유투브에서 다운받은 MV로 보겠다~하면...

mp4box 를 까러서.. 

]# MP4Box -hint XXX.mp4  를 돌려준 다음.. 스트리밍하라~ 안 돌려주면 안드로이드에서 안나옵니다~


Could not chdir to home directory

StudyRoom/Linux_Server

 

after creating lxc container, I wasn’t able to connect to it as a simple user. Also couldn’t change to simple user using “su”.

All I got was an error:

Could not chdir to home directory /home/nsc: Permission denied
/bin/bash: Permission denied
Connection to 192.168.1.13 closed.

All permissions of home directory were correct, as to be 100% sure, deleted user and created again. Still the same problem.

The problem was / permissions.
It was 700, so simple user couldn’t change to any directory.

Small fix to make it working (with root user)

chmod 755 /

And that’s it, user is working!!!

 

아,,, 막내 탈출한 늠... 사고치는 바람에 힘들었다...

LINUX 32비트 64비트 확인 방법

StudyRoom/Linux_Server

1. 리눅스 32비트

 

# /usr/bin/getconf WORD_BIT
32
# getconf LONG_BIT
32

# uname -a
Linux iTSM1 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 athlon i386 GNU/Linux


2. 리눅스 64비트

 

[root@TSM1 ~]# getconf WORD_BIT
32
[root@TSM1 ~]# getconf LONG_BIT
64

# uname -a
Linux TSM1 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

Linux System Monitoring Tools Every SysAdmin Should Know

StudyRoom/Linux_Server

Linux System Monitoring Tools Every SysAdmin Should Know

Need to monitor Linux server performance? Try these built-in command and a few add-on tools. Most Linux distributions are equipped with tons of monitoring. These tools provide metrics which can be used to get information about system activities. You can use these tools to find the possible causes of a performance problem. The commands discussed below are some of the most basic commands when it comes to system analysis and debugging server issues such as:

1. Finding out bottlenecks.
2. Disk (storage) bottlenecks.
3. CPU and memory bottlenecks.
4. Network bottlenecks.


#1: top - Process Activity Command

The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.


Fig.01: Linux top command

Commonly Used Hot Keys

The top command provides several useful hot keys:

Hot Key Usage
t Displays summary information off and on.
m Displays memory information off and on.
A Sorts the display by top consumers of various system resources. Useful for quick         identification of performance-hungry tasks on a system.
f Enters an interactive configuration screen for top. Helpful for setting up top           for a specific task.
o Enables you to interactively select the ordering within top.
r Issues renice command.
k Issues kill command.
z Turn on or off color/mono



#2: vmstat - System Activity, Hardware and System Information

The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

# vmstat 3

Sample Outputs:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 2540988 522188 5130400    0    0     2    32    4    2  4  1 96  0  0
 1  0      0 2540988 522188 5130400    0    0     0   720 1199  665  1  0 99  0  0
 0  0      0 2540956 522188 5130400    0    0     0     0 1151 1569  4  1 95  0  0
 0  0      0 2540956 522188 5130500    0    0     0     6 1117  439  1  0 99  0  0
 0  0      0 2540940 522188 5130512    0    0     0   536 1189  932  1  0 98  0  0
 0  0      0 2538444 522188 5130588    0    0     0     0 1187 1417  4  1 96  0  0
 0  0      0 2490060 522188 5130640    0    0     0    18 1253 1123  5  1 94  0  0

Display Memory Utilization Slabinfo

# vmstat -m

Get Information About Active / Inactive Memory Pages

# vmstat -a



#3: w - Find Out Who Is Logged on And What They Are Doing

w command displays information about the users currently on the machine, and their processes.

# w username
# w vivek

Sample Outputs:

 
17:58:47 up 5 days, 20:28,  2 users,  load average: 0.36, 0.26, 0.24
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    10.1.3.145       14:55    5.00s  0.04s  0.02s vim /etc/resolv.conf
root     pts/1    10.1.3.145       17:43    0.00s  0.03s  0.00s w

#4: uptime - Tell How Long The System Has Been Running

The uptime command can be used to see how long the server has been running. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

# uptime

Output:

18:02:41 up 41 days, 23:42,  1 user,  load average: 0.00, 0.00, 0.00

1 can be considered as optimal load value. The load can change from system to system. For a single CPU system 1 - 3 and SMP systems 6-10 load value might be acceptable.

 
#5: ps - Displays The Processes

ps command will report a snapshot of the current processes. To select all processes use the -A or -e option:

# ps -A

Sample Outputs:

  PID TTY          TIME CMD
    1 ?        00:00:02 init
    2 ?        00:00:02 migration/0
    3 ?        00:00:01 ksoftirqd/0
    4 ?        00:00:00 watchdog/0
    5 ?        00:00:00 migration/1
    6 ?        00:00:15 ksoftirqd/1
....
.....
 4881 ?        00:53:28 java
 4885 tty1     00:00:00 mingetty
 4886 tty2     00:00:00 mingetty
 4887 tty3     00:00:00 mingetty
 4888 tty4     00:00:00 mingetty
 4891 tty5     00:00:00 mingetty
 4892 tty6     00:00:00 mingetty
 4893 ttyS1    00:00:00 agetty
12853 ?        00:00:00 cifsoplockd
12854 ?        00:00:00 cifsdnotifyd
14231 ?        00:10:34 lighttpd
14232 ?        00:00:00 php-cgi
54981 pts/0    00:00:00 vim
55465 ?        00:00:00 php-cgi
55546 ?        00:00:00 bind9-snmp-stat
55704 pts/1    00:00:00 ps

ps is just like top but provides more information.

Show Long Format Output

# ps -Al

To turn on extra full mode (it will show command line arguments passed to process):

# ps -AlF

To See Threads ( LWP and NLWP)

# ps -AlFH

To See Threads After Processes

# ps -AlLm

Print All Process On The Server

# ps ax
# ps axu

Print A Process Tree

# ps -ejH
# ps axjf
# pstree

Print Security Information

# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axZ
# ps -eM

See Every Process Running As User Vivek

# ps -U vivek -u vivek u

Set Output In a User-Defined Format

# ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
# ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
# ps -eopid,tt,user,fname,tmout,f,wchan

Display Only The Process IDs of Lighttpd

# ps -C lighttpd -o pid=

OR
# pgrep lighttpd

OR
# pgrep -u vivek php-cgi

Display The Name of PID 55977

# ps -p 55977 -o comm=

Find Out The Top 10 Memory Consuming Process

# ps -auxf | sort -nr -k 4 | head -10

Find Out top 10 CPU Consuming Process

# ps -auxf | sort -nr -k 3 | head -10


#6: free - Memory Usage

The command free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.

# free

Sample Output:

 
           total       used       free     shared    buffers     cached
Mem:      12302896    9739664    2563232          0     523124    5154740
-/+ buffers/cache:    4061800    8241096
Swap:      1052248          0    1052248

=> Related: :


#7: iostat - Average CPU Load, Disk Activity

The command iostat report Central Processing Unit (CPU) statistics and input/output statistics for devices, partitions and network filesystems (NFS).

# iostat

Sample Outputs:

Linux 2.6.18-128.1.14.el5 (www03.nixcraft.in) 06/26/2009

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.50    0.09    0.51    0.03    0.00   95.86

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              22.04        31.88       512.03   16193351  260102868
sda1              0.00         0.00         0.00       2166        180
sda2             22.04        31.87       512.03   16189010  260102688
sda3              0.00         0.00         0.00       1615          0



#8: sar - Collect and Report System Activity

The sar command is used to collect, report, and save system activity information. To see network counter, enter:

# sar -n DEV | more

To display the network counters from the 24th:

# sar -n DEV -f /var/log/sa/sa24 | more

You can also display real time usage using sar:

# sar 4 5

Sample Outputs:

Linux 2.6.18-128.1.14.el5 (www03.nixcraft.in) 06/26/2009

06:45:12 PM       CPU     %user     %nice   %system   %iowait    %steal     %idle
06:45:16 PM       all      2.00      0.00      0.22      0.00      0.00     97.78
06:45:20 PM       all      2.07      0.00      0.38      0.03      0.00     97.52
06:45:24 PM       all      0.94      0.00      0.28      0.00      0.00     98.78
06:45:28 PM       all      1.56      0.00      0.22      0.00      0.00     98.22
06:45:32 PM       all      3.53      0.00      0.25      0.03      0.00     96.19
Average:          all      2.02      0.00      0.27      0.01      0.00     97.70



#9: mpstat - Multiprocessor Usage

The mpstat command displays activities for each available processor, processor 0 being the first one. mpstat -P ALL to display average CPU utilization per processor:

# mpstat -P ALL

Sample Output:

Linux 2.6.18-128.1.14.el5 (www03.nixcraft.in) 06/26/2009

06:48:11 PM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
06:48:11 PM  all    3.50    0.09    0.34    0.03    0.01    0.17    0.00   95.86   1218.04
06:48:11 PM    0    3.44    0.08    0.31    0.02    0.00    0.12    0.00   96.04   1000.31
06:48:11 PM    1    3.10    0.08    0.32    0.09    0.02    0.11    0.00   96.28     34.93
06:48:11 PM    2    4.16    0.11    0.36    0.02    0.00    0.11    0.00   95.25      0.00
06:48:11 PM    3    3.77    0.11    0.38    0.03    0.01    0.24    0.00   95.46     44.80
06:48:11 PM    4    2.96    0.07    0.29    0.04    0.02    0.10    0.00   96.52     25.91
06:48:11 PM    5    3.26    0.08    0.28    0.03    0.01    0.10    0.00   96.23     14.98
06:48:11 PM    6    4.00    0.10    0.34    0.01    0.00    0.13    0.00   95.42      3.75
06:48:11 PM    7    3.30    0.11    0.39    0.03    0.01    0.46    0.00   95.69     76.89



#10: pmap - Process Memory Usage

The command pmap report memory map of a process. Use this command to find out causes of memory bottlenecks.

# pmap -d PID

To display process memory information for pid # 47394, enter:

# pmap -d 47394

Sample Outputs:

47394:   /usr/bin/php-cgi
Address           Kbytes Mode  Offset           Device    Mapping
0000000000400000    2584 r-x-- 0000000000000000 008:00002 php-cgi
0000000000886000     140 rw--- 0000000000286000 008:00002 php-cgi
00000000008a9000      52 rw--- 00000000008a9000 000:00000   [ anon ]
0000000000aa8000      76 rw--- 00000000002a8000 008:00002 php-cgi
000000000f678000    1980 rw--- 000000000f678000 000:00000   [ anon ]
000000314a600000     112 r-x-- 0000000000000000 008:00002 ld-2.5.so
000000314a81b000       4 r---- 000000000001b000 008:00002 ld-2.5.so
000000314a81c000       4 rw--- 000000000001c000 008:00002 ld-2.5.so
000000314aa00000    1328 r-x-- 0000000000000000 008:00002 libc-2.5.so
000000314ab4c000    2048 ----- 000000000014c000 008:00002 libc-2.5.so
.....
......
..
00002af8d48fd000       4 rw--- 0000000000006000 008:00002 xsl.so
00002af8d490c000      40 r-x-- 0000000000000000 008:00002 libnss_files-2.5.so
00002af8d4916000    2044 ----- 000000000000a000 008:00002 libnss_files-2.5.so
00002af8d4b15000       4 r---- 0000000000009000 008:00002 libnss_files-2.5.so
00002af8d4b16000       4 rw--- 000000000000a000 008:00002 libnss_files-2.5.so
00002af8d4b17000  768000 rw-s- 0000000000000000 000:00009 zero (deleted)
00007fffc95fe000      84 rw--- 00007ffffffea000 000:00000   [ stack ]
ffffffffff600000    8192 ----- 0000000000000000 000:00000   [ anon ]
mapped: 933712K    writeable/private: 4304K    shared: 768000K

The last line is very important:

mapped: 933712K total amount of memory mapped to files
writeable/private: 4304K the amount of private address space
shared: 768000K the amount of address space this process is sharing with others



#11 and #12: netstat and ss - Network Statistics

The command netstat displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. ss command is used to dump socket statistics. It allows showing information similar to netstat. See the following resources about ss and netstat commands:


#13: iptraf - Real-time Network Statistics

The iptraf command is interactive colorful IP LAN monitor. It is an ncurses-based IP LAN monitor that generates various network statistics including TCP info, UDP counts, ICMP and OSPF information, Ethernet load info, node stats, IP checksum errors, and others. It can provide the following info in easy to read format:

Network traffic statistics by TCP connection
IP traffic statistics by network interface
Network traffic statistics by protocol
Network traffic statistics by TCP/UDP port and by packet size
Network traffic statistics by Layer2 address



Fig.02: General interface statistics: IP traffic statistics by network interface


Fig.03 Network traffic statistics by TCP connection

#14: tcpdump - Detailed Network Traffic Analysis

The tcpdump is simple command that dump traffic on a network. However, you need good understanding of TCP/IP protocol to utilize this tool. For.e.g to display traffic info about DNS, enter:

# tcpdump -i eth1 'udp port 53'

To display all IPv4 HTTP packets to and from port 80, i.e. print only packets that contain data, not, for example, SYN and FIN packets and ACK-only packets, enter:

# tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

To display all FTP session to 202.54.1.5, enter:

# tcpdump -i eth1 'dst 202.54.1.5 and (port 21 or 20'

To display all HTTP session to 192.168.1.5:

# tcpdump -ni eth0 'dst 192.168.1.5 and tcp and port http'

Use wireshark to view detailed  information about files, enter:

# tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80


#15: strace - System Calls

Trace system calls and signals. This is useful for debugging webserver and other server problems. See how to use to trace the process  and see What it is doing.


#16: /Proc file system - Various Kernel Statistics

/proc file system provides detailed information about various hardware devices and other Linux kernel information. See Linux kernel /proc  documentations for further details. Common /proc examples:

# cat /proc/cpuinfo
# cat /proc/meminfo
# cat /proc/zoneinfo
# cat /proc/mounts


17#: Nagios - Server And Network Monitoring

Nagios is a popular open source computer system and network monitoring application software. You can easily monitor all your hosts, network equipment and services. It can send alert when things go wrong and again when they get better. FAN is  "Fully Automated Nagios". FAN goals are to provide a Nagios installation including most tools provided by the Nagios Community. FAN provides a CDRom image in the standard ISO format, making it easy to easilly install a Nagios server. Added to this, a wide bunch of tools are including to the distribution, in order to improve the user experience around Nagios.


18#: Cacti - Web-based Monitoring Tool

Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices. It can provide data about network, CPU, memory, logged in users, Apache, DNS servers and much more. See how to install and configure Cacti network graphing tool under CentOS / RHEL. 


#19: KDE System Guard - Real-time Systems Reporting and Graphing

KSysguard is a network enabled task and system monitor application for KDE desktop. This tool can be run over ssh session. It provides lots of features such as a client/server architecture that enables monitoring of local and remote hosts. The graphical front end uses so-called sensors to retrieve the information it displays. A sensor can return simple values or more complex information like tables. For each type of information, one or more displays are provided. Displays are organized in worksheets that can be saved and loaded independently from each other. So, KSysguard is not only a simple task manager but also a very powerful tool to control large server farms.



Fig.05 KDE System Guard {Image credit: Wikipedia}

See the KSysguard handbook for detailed usage.


#20: Gnome System Monitor - Real-time Systems Reporting and Graphing

The System Monitor application enables you to display basic system information and monitor system processes, usage of system resources, and file systems. You can also use System Monitor to modify the behavior of your system. Although not as powerful as the KDE System Guard, it provides the basic information which may be useful for new users:

Displays various basic information about the computer's hardware and software.
Linux Kernel version
GNOME version
Hardware
Installed memory
Processors and speeds
System Status
Currently available disk space
Processes
Memory and swap space
Network usage
File Systems
Lists all mounted filesystems along with basic information about each.



Fig.06 The Gnome System Monitor application

Bonus: Additional Tools

A few more tools:

nmap - scan your server for open ports.
lsof - list open files, network connections and much more.
ntop web based tool - ntop is the best tool to see network usage in a way similar to what top command does for processes i.e. it is network traffic monitoring software. You can see network status, protocol wise distribution of traffic for UDP, TCP, DNS, HTTP and other protocols.
Conky - Another good monitoring tool for the X Window System. It is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages, e-mail inboxes etc.
GKrellM - It can be used to monitor the status of CPUs, main memory, hard disks, network interfaces, local and remote mailboxes, and many other things.
vnstat - vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s).
htop - htop is an enhanced version of top, the interactive process viewer, which can display the list of processes in a tree form.
mtr - mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.
Did I miss something? Please add your favorite system motoring tool in the comments.

'StudyRoom > Linux_Server' 카테고리의 다른 글

Could not chdir to home directory  (0) 2012.03.27
LINUX 32비트 64비트 확인 방법  (0) 2011.09.06
VSFTP 설정  (0) 2011.09.06
RED5 + FFMPEG + FFserver 스트리밍 서버 구축하기  (0) 2011.09.06
Bridge Server Install  (0) 2011.09.06

VSFTP 설정

StudyRoom/Linux_Server

# anonymous 사용자의 접속 허용 여부, 즉 anonymous ftp (default = YES)
# 공개된 형태의 FTP 서버로 운영할 것이 아니라면 NO로 한다.
anonymous_enable=NO
# 로컬 계정 사용자의 접속 허용 여부 (default = NO)
local_enable=YES

# write 명령어 허용 여부 (defualt = NO)
write_enable=YES
# 로컬 계정 사용자용 umask (default = 077)
local_umask=022

# anonymous 사용자가 파일을 업로드 할 수 있는지 여부 (default = NO)
# anon_upload_enable=YES
# anonymous 사용자의 디렉토리 생성 허용 여부 (default = NO)
# anon_mkdir_write_enable=YES

# 파일 전송 로그를 남길 것인지 여부 (default = YES)
xferlog_enable=YES
# xferlog 표준 포맷으로 로그를 남길지 여부 (기본 설정파일은 YES)
# 아래에서 NO로 설정했을 때를 설명함
xferlog_std_format=YES
# 파일 전송 로그 파일명
xferlog_file=/var/log/vsftpd.log

# FTP 서버 접속할 때 로긴 메시지 (default = vsFTPd 버전번호)
# 한글 사용 가능
# ftpd_banner=Welcome to blah FTP service.

# 사용자의 홈디렉토리를 벗어나지 못하도록 제한하기 위한 설정 (default=NO)
# 제한이 필요할 경우 YES로 바꾼 후 제한할 사용자 ID를 chroot_list_file= 에 설정한 파일에
# 지정한다.
# chroot_local_user= 설정과 관련이 있으니 '3. 문제 해결'을 꼭 읽어보라.
#
# chroot_list_enable=YES
# chroot_list_file=/etc/vsftpd.chroot_list

# -------------------------------------------------------------------
# 기본 설정 파일에는 없는 설정값으로 필요한 설정만 추가한다.
# ※ 중요한 설정은 굵은 글씨로 표시
# -------------------------------------------------------------------

# PAM 파일명을 지정 (설치할 때 /etc/pam.d/vsftpd명으로 복사함)
pam_service_name=vsftpd

# wtmp에 로그 남기기 (YES로 해야만 last 명령어로 접속 여부 확인 가능)
session_support=YES

# 사용자가 자신의 home directory를 벗어나지 못하도록 설정
chroot_local_user=YES

# 새로운 디렉토리에 들어갔을 때 뿌려줄 환경 메시지를 저장한 파일명
# message_file=.message

# xferlog 형식으로 log를 남기려면 (위에서 이미 YES로 했음)
# xferlog_std_format=NO
#
#   - xferlog 표준 포맷은 로긴, 디렉토리 생성등의 로그를 남기지 않음
#     그러나 vsftpd 스타일 로그는 이를 포함한 보다 상세한 로그를 남김
#   - vsftpd 스타일 로그 예
#
#   Sun Jul 12 01:38:32 2003 [pid 31200] CONNECT: Client "127.0.0.1"
#   Sun Jul 12 01:38:34 2003 [pid 31199] [truefeel] FAIL LOGIN: Client "127.0.0.1"
#   Sun Jul 12 01:38:38 2003 [pid 31199] [truefeel] OK LOGIN: Client "127.0.0.1"
#   Sun Jul 12 01:38:41 2003 [pid 31201] [truefeel] OK MKDIR: Client "127.0.0.1", "/mp3"
#   Sun Jul 12 01:39:06 2003 [pid 31201] [truefeel] OK UPLOAD: Client "127.0.0.1", "/델리
#   스파이스 5집 - [04]키치죠지의 검은 고양이.mp3", 6855473 bytes, 3857.39Kbyte/sec

# 전송속도 제한 (0은 제한없음, 단위는 초당 bytes)
anon_max_rate=0
local_max_rate=0
trans_chunk_size=0

# 최대 접속 설정 (단 xinetd를 통하지 않고 standalone으로 동작할 때만 사용 가능)
# standalone을 위해서는 listen=YES 추가하고 별도로 vsftpd를 띄워야 함
#
# max_clients=최대 접속자 수, max_per_ip=IP당 접속 수
# max_clients=100
# max_per_ip=3

# Standalone 으로 운영할 때 listen=YES. 포트 변경을 원할 경우 listen_port 설정
# 디폴트 포트는 21번 포트이다.
# listen=YES
# listen_port=21
        


필요한 설정이 끝났으면 xinetd를 재실행한다. 

RED5 + FFMPEG + FFserver 스트리밍 서버 구축하기

StudyRoom/Linux_Server

4.1 FFMPEG로 인코딩 환경 구축하기 

- 기본 프로그램 설치

# yum install ruby
# yum install ncurses-devel*
# yum install lame
# yum install libogg
# yum install libvorbis
# yum install flvtool2
# yum install ffmpeg

- 코덱 설치

# wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
# bunzip2 essential-20061022.tar.bz2
# tar xvf essential-20061022.tar
# mkdir /usr/local/lib/codecs/
# mv essential-20061022/* /usr/local/lib/codecs/
# chmod -R 755 /usr/local/lib/codecs/

# vi /etc/ld.so.conf
# ldconfig

- ffmpeg 기본 사용법

AVI -> FLV

# ffmpeg -i onestar.avi -ar 22050 -ab 32 -f flv -s 640x480 onestar.flv | flvtool2 -U stdin onestar.flv

-i             : input file name
-ar          : audio sampling rate in HZ
-ab          : audio bit rate in kbit/s
-f             : output format
-s             : output dimension

FLV -> JPG

# ffmpeg -i test.flv -an -r 1 -y -s 640x480 test%d.jpg

-i             : input file name
-an         : disable audio
-r            : fps
-y           : overwrite file
-s            : output dimension

Particular frame to JPG

# ffmpeg -i test.flv -an -ss 00:00:10 -t 00:00:01 -r 1 -y -s 640x480 test%d.jpg

-ss          : recored start time
-t            : record end time last for

- ffmpeg 실무 사용법

ffmpeg를 이용하여 avi 파일을 flv로 변환 한다.

# ffmpeg -i onestar.avi -b 512k -ar 22050 -ab 128k -r 24 -s 400x300 onestar.flv
 
or

# ffmpeg -i "onestar.avi" -vcodec flv -f flv -r 29.97 -s 400x300 -aspect 4:3 -b 320k -g 160 -cmp 2 -subcmp 2 -mbd 2 -flags +aic+cbp+mv0+mv4+trell -ac 1 -ar 22050 -ab 128k "onestar.flv"

- FLV에 메타데이터 넣기 (스트리밍 보기-중간 구간 바로 보기)

# flvtool2 -U onstar.flv

- 동영상 썸네일 만들기

# ffmpeg -y -i onestar.avi -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 400x300 onestar.png

# ffmpeg  -itsoffset -4  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg

- 동영상에 자막 넣기

동영상을 flv 로 변환할때 자막을 같이 넣을 경우 기존의 ffmpeg로는 자막 포함 기능이
제공되지 않는다. 자막을 포함하여 인코딩을 할 수 있는 프로그램으로 mencoder이 있다.
설치는 yum으로 쉽게 가능하다.

# yum install mencoder

설치 후 자막의 언어 설정을 아래와 같이 한다.

$ vi ~/.mplayer/mencoder.conf
-------------------------------------------------------------------------
font="/usr/share/fonts/korean/TrueType/gulim.ttf"
subfont-text-scale=3
subcp=cp949
-------------------------------------------------------------------------

이제 mencoder로 자막을 포함해서 인코딩을 한다.

$ mencoder -noodml [avi파일]  -o [flv파일]  -sub $1.smi -of lavf -oac mp3lame -lameopts abr:br=128 -ovc lavc -lavcopts vcodec=flv:vbitrate=512:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 44100 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf-add scale=400:300


- 웹 FLV_Player 연동하기

웹에서 FLV 파일을 스트리밍으로 볼수 있는 Player는 여러가지가 있다.

* UCCUP에서 제공하는 Player - http://www.uccup.kr
* http://flowplayer.org/download.html
* GRZ_JWMediaPlayer

- UCCUP Player 연동하기

아래 구문중 flv 파일명과 png 파일명을 수정 후 HTML 문서에 붙여 넣는다.
flv,png 파일은 [UCCUP설치경로]/SERVICE 디렉토리 밑에 복사해 둔다.

<embed src=http://syszone.co.kr/uccup/UCCUp.swf?file=http://syszone.co.kr/uccup/file.php?f=onestar.flv&previewImage=http://syszone.co.kr/uccup/file.php?f=onestar.png&bufferTime=3&bgColor=-1"
width="400" height="300" scale="noscale" bgcolor="#ffffff" type="application/x-shockwave-flash" allowFullScreen="true"
allowScriptAccess="always" allowNetworking="all" pluginspage="
http://www.macromedia.com/go/getflashplayer">
</embed>

- GRZ_JWMediaPlayer 연동하기

아래는 textcube의 플러그인으로 연동된 GRZ_JWMediaPlayer를 이용하는 방법이다.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="425" height="340">
<param name="movie" value="/plugins/GRZ_JWMediaPlayer/mediaplayer.swf"/>
<param name="allowfullscreen" value="true"/>
<param name="wmode" value="transparent"/>
<param name="flashvars" value="width=425&height=340&thumbsinplaylist=true&displayheight=320&overstretch=true&logo=&searchbar=false&linkfromdisplay=true&linktarget=_blank&file=/plugins/GRZ_JWMediaPlayer/mkpl.php?list=1|%5bhttp%5dblog.syszone.co.kr%2fattach%2f1%2f1466599573.flv|alang.flv+%289.64+MB%29|||||%5bhttp%5dblog.syszone.co.kr|"/>
<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" transparent="yes" data="/plugins/GRZ_JWMediaPlayer/mediaplayer.swf" flashvars="thumbsinplaylist=true&displayheight=320&overstretch=true&logo=&searchbar=false&linkfromdisplay=true&linktarget=_blank&file=/plugins/GRZ_JWMediaPlayer/mkpl.php?list=1|%5bhttp%5dblog.syszone.co.kr%2fattach%2f1%2f1466599573.flv|alang.flv+%289.64+MB%29|||||%5bhttp%5dblog.syszone.co.kr|" width="425" height="340">
<p>
<a href="/plugins/GRZ_JWMediaPlayer/mediaplayer.swf">[Flash]</a></p>
</object>
<!--> <![endif]-->

</object>

- FlowPlayer 연동하기

기본 연동법
------------------------------------------------------------------------------------
<object type="application/x-shockwave-flash" data="[your site]/FlowPlayer.swf"
width="320" height="263" id="FlowPlayer">

  <param name="allowScriptAccess" value="sameDomain"/>
  <param name="movie" value="[your site]/FlowPlayer.swf"/>
  <param name="quality" value="high"/>
  <param name="scale" value="noScale"/>
  <param name="wmode" value="transparent"/>
  <param name="flashvars" value="baseURL=[base URL]&videoFile=movie.flv
  &autoPlay=false&loop=false&autoBuffering=false
  &splashImageFile=movie.png"/>
</object>
--------------------------------------------------------------------------------------
or
--------------------------------------------------------------------------------------
<script type="text/javascript" src=flowplayer-3.0.2.min.js></script>
<script>
flowplayer("player", "./flowplayer-3.0.2.swf");

</script>

<a href="http://syszone.co.kr/yaejin/data/11.flv" style="display:block;width:400px;height:300px" id="player">

</a>
--------------------------------------------------------------------------------------
or
--------------------------------------------------------------------------------------
<script type="text/javascript" src=flowplayer-3.0.2.min.js></script>
<script>
flowplayer("player", "./flowplayer-3.0.2.swf", {
    clip: {
        url: 'http://syszone.co.kr/yaejin/data/11.flv',
        autoPlay: false,


        onStart: function(clip) {
            pageTracker._trackPageview("configuration demo: " + clip.url);
        }
    }


});

</script>

<a href="http://syszone.co.kr/yaejin/data/11.flv" style="display:block;width:400px;height:300px" id="player">
<img src=
http://syszone.co.kr/yaejin/data/11.png" border=0 alt="Play this video" />
</a>
---------------------------------------------------------------------------------------
or (youtube 방식의 동영상 라이브러리 구현)
---------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<c:if test="true">
<!-- include desired tools -->
<script src=
http://syszone.co.kr/yaejin/jquery.min.js"></script>
<script src=
http://syszone.co.kr/yaejin/flowplayer-3.0.2.min.js"></script>
</c:if>
<script src=
http://syszone.co.kr/yaejin/flowplayer.playlist-3.0.1.min.js"></script>

<!-- player / playlist styling -->
<style>
/* player style */
/* container has a background image */
a.player {
        margin-top:40px;
        display:block;
        background:url(
http://syszone.co.kr/yaejin/img/splash.png) no-repeat;
        width:425px;
        height:298px;
        padding:0 126px 75px 127px;
        text-align:center;
        color:#fff;
        text-decoration:none;
        cursor:pointer;
}

/* splash image */
a.player img {
        margin-top:115px;
        border:0;
}


#player {
        float:left;
}

/* playlist style */
#playlist {
        width:300px;
        height:380px;
        overflow-y:auto;
        overflow-x:hidden;
        border:1px solid #ccc;
        padding:4px 10px 12px 10px;
        background-color:#efefef;
        margin-top:20px;
        float:left;
}

/* playlist entry */
#playlist a {
        display:block;
        width:260px;
        height:60px;
        padding:7px;
        background-color:#fff;
        border:1px solid #ccc;
        font:11px "bitstream vera sans", "lucida grande",verdana;
        text-decoration:none;
        margin-top:7px;
        color:#666;
}

/* different states of a playlist entry */
#playlist a:hover {
        background-color:#ffc;
}

#playlist a.progress {
        background-color:#efefef;
}

#playlist a.playing {
        border:1px solid #666;
        background-color:#ffc;
}

#playlist a.paused {
        border:1px solid #666;
        background-color:#ffc;
}

/* elements inside playlist entry */
#playlist a img {
        border:0;
        float:left;
        margin-right:10px;
}

#playlist a strong {
        color:blue;
        padding-bottom:5px;
}

#playlist a em {
        border:0;   
        float:left;
        margin-right:10px;
        background:url(
http://syszone.co.kr/yaejin/img/clock.gif) no-repeat 0 50%;
        padding-left:20px;
        color:#333;
        font-style:normal;
        margin-top:10px;
}

</style>


<!-- javascript setup. pretty simple stuff -->
<script>
$(function() {

        // setup player
        $f("player", "flowplayer-3.0.2.swf", {

                clip: {baseUrl: 'http://syszone.co.kr/yaejin/data'}

        // playlist plugin
        }).playlist("#playlist");

});
</script>


<!-- player container -->
<a id="player" class="player plain">
        <img src=
http://syszone.co.kr/yaejin/img/play.png" />
</a>

<!-- the playlist. simple HTML controlled with CSS -->

<div id="playlist">

<a href=071202-탄생1.flv>
<img src=http://syszone.co.kr/yaejin/data/071202-탄생1.png />
<strong>071202-탄생1</strong><br /><br>
</a>

<a href=071202-탄생2.flv>
<img src=http://syszone.co.kr/yaejin/data/071202-탄생2.png />
<strong>071202-탄생2</strong><br /><br>
</a>

.
.
</div>
<!-- let the rest of the page float normally -->
<br clear="all" />
------------------------------------------------------------------------------------


- Encoding 관련 스크립트 제작

ffmpeg를 이용하여 avi 파일을 flv로 변환하는 스크립트

# vi /usr/bin/ffmpeg_encoder.sh [filename] [geometry]
-----------------------------------------------------------------------------------
#!/bin/sh

if [ $# -lt 2 ]
then
echo -n "using : ffmpeg_encoder.sh <filename> <geometry> ( movie 400x300 )
";

exit;
fi

ffmpeg -i $1.avi -b 512k -ar 22050 -r 24 -ab 128k -s $2 $1.flv
ffmpeg -y -i $1.avi -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s $2 $1.png
flvtool2 -U $1.flv
echo -n "--------------------------------------------------------
$1.avi completed $1.flv to encoding..!!
--------------------------------------------------------
";

----------------------------------------------------------------------------------

mencoder를 이용하여 avi파일과 smi 자막파일을 flv 파일로 변환하는 스크립트

# vi /usr/bin/mencoder_encoder.sh
----------------------------------------------------------------------------------
#!/bin/sh
if [ $# -lt 3 ]
then
echo -n "using : mencoder_encoder.sh <filename> <x_geometry> <y_geometry> ( movie 400 300 )
";
exit;

fi

mencoder -noodml $1.avi -o $1.flv -sub $1.smi -of lavf -oac mp3lame -lameopts abr:br=128 -ovc lavc -lavcopts vcodec=flv:vbitrate=512:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 44100 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf-add scale=${2}:${3}
ffmpeg -y -i $1.avi -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s ${2}x${3} $1.png
flvtool2 -U $1.flv
echo -n "--------------------------------------------------------
$1.avi completed $1.flv to encoding..!!
--------------------------------------------------------
";
---------------------------------------------------------------------------------

디렉토리내 flv 파일을 UCCUP Player에서 인식할 수 있는 HTML 코드로 변환하는 스크립트

# vi /usr/bin/convert_flvhtml.sh
--------------------------------------------------------------------------------
#!/bin/sh

rm -f source.html
ls -1 *.flv | sed -e 's/\.flv//g' > filelist

A=`cat filelist`

for B in `echo $A`
do

echo -n "
<embed src=\"
http://syszone.co.kr/uccup/UCCUp.swf?file=http://syszone.co.kr/uccup/file.php?f=${B}.flv&previewImage=http://syszone.co.kr/uccup/file.php?f=${B}.png&bufferTime=3&bgColor=-1\"
width=400 height=300 scale=noscale bgcolor=#ffffff type=application/x-shockwave-flash allowFullScreen=true
allowScriptAccess=always allowNetworking=all pluginspage=http://www.macromedia.com/go/getflashplayer>
</embed>
<p>
" >> source.html

done
---------------------------------------------------------------------------------



4.2 RED5 를 이용한 스트리밍 서비스 환경 구축하기 

- Red5 설치하기

ant download :  http://ant.apache.org/bindownload.cgi
red5 download : http://osflash.org/red5
jdk download : http://java.sun.com

각 사이트에서 최신 패키지를 다운받는다.

apache-ant-1.7.1-bin.tar.gz
red5-0.7.0.tar.gz
jdk-6u11-linux-x64-rpm.bin

- JDK 설치하기

# chmod 755 jdk-6u11-linux-x64-rpm.bin
# ./jdk-6u11-linux-x64-rpm.bin
--------------------------------------------------------------------------------
.
.

Do you agree to the above license terms? [yes or no]
              yes
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (
Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u11-linux-amd64.rpm 
  inflating: sun-javadb-common-10.4.1-3.1.i386.rpm 
  inflating: sun-javadb-core-10.4.1-3.1.i386.rpm 
  inflating: sun-javadb-client-10.4.1-3.1.i386.rpm 
  inflating: sun-javadb-demo-10.4.1-3.1.i386.rpm 
  inflating: sun-javadb-docs-10.4.1-3.1.i386.rpm 
  inflating: sun-javadb-javadoc-10.4.1-3.1.i386.rpm 
준비 중...                  ########################################### [100%]

.
.
Press Enter to continue.....
Done.

/usr/java 디렉토리 밑에 설치 완료 .

- Ant 설치하기

# tar xzvf apache-ant-1.7.1-bin.tar.gz
# mv apache-ant-1.7.1 /usr/local/ant

- Red5 설치하기

# mkdir /usr/local/red5
# tar xzvf red5-0.7.0.tar.gz -C /usr/local/red5

- 환경설정하기

# vi /etc/profile.d/ant_java.sh
-----------------------------------------------------------------------------
#!/bin/sh

export JAVA_HOME=/usr/java/default
export JAVA_VERSION=1.6
export ANT_HOME=/usr/local/ant
export PATH=${ANT_HOME}/bin:${JAVA_HOME}/bin:$PATH

----------------------------------------------------------------------------

# source /etc/profile.d/ant_java.sh
# java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)

- RED5 컴파일 및 데몬 시작하기

http://osflash.org/red5 에서 final 바이너리 패키지를 받은 경우 별도의 컴파일
없이 바로 실행이 가능하다.

# cd /usr/local/red5
# sh red5.sh

svn를 통해 코드를 받은 경우 아래와 같이 컴파일을 해줘야 한다.

# cd /usr/local
# svn co
http://red5.googlecode.com/svn/java/server/trunk red5src
# cd red5

방법1 :

# cd /usr/local/red5src

# ant server &
# /usr/local/ant/bin/ant
# cp -a /usr/local/red5src/dist /usr/local/red5
# cd /usr/local/red5
# ./red5.sh &

방법2 :

# cd /usr/local/red5src
# make
# make install

# cd /usr/lib/red5
# ./red5.sh &

방법 3 :

# cd /usr/local/red5src
# ant prepare
# ant build

Target "build" does not exist in the project "RED5". 라는 에러가 발생했을 경우

# ant
or
# ant -f build.xml
# cp -a dist /usr/local/red5
# cd /usr/local/red5
# sh red5.sh &

;; 3번 권장함


최신버전으로 컴파일 시 간혹 아래와 같은 에러가 발생하는 경우가 있다.
------------------------------------------------------------------------
.
[ivy:resolve]           :: spring#spring-support;2.0.8: not found
[ivy:resolve]           :: javax#jsp-api;2.1: not found
[ivy:resolve]           :: red5#xercesImpl;2.9.0: not found
[ivy:resolve]           :: red5#groovy;1.0: not found
[ivy:resolve]           :: commons#commons-lang;2.3: not found
[ivy:resolve]           :: tomcat#jasper;6.0.14: not found
[ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED
/usr/local/red5-0.7.0/build.xml:205: The following error occurred while executing this line:
/usr/local/red5-0.7.0/build.xml:221: The following error occurred while executing this line:
/usr/local/red5-0.7.0/build.xml:165: impossible to resolve dependencies:
        resolve failed - see output for details
------------------------------------------------------------------------


위 문제는 ivy 라는 패키지 관리 도구에서 red5 컴파일 시 필요한 패키지를 사전에 정의된
패키지 저장소에서 자동으로 다운로드 받게 되는데, 필요한 패키지를 찾을 수 없을때 발생한다.
ivy.xml 와 ivysettings.xml 파일에 다운로드 경로 정보가 있는데, 이것이 변동된 경우 발생하니

ivysettings.xml 에서 http://red5.googlecode.com/svn/trunk/repository/ 부분을
http://red5.googlecode.com/svn/repository 로 수정하거나 최신 해당 파일을 다운로드 받으면
된다.


- Init script 만들기

# vi /etc/rc.d/init.d/red5
--------------------------------------------------------------------------
#!/bin/sh
#
# Startup script for Red5 flash streaming server
#
# chkconfig: 345 81 81
# description: RED5 by java
#
# processname: java (unfortunately)
# pidfile: /var/run/red5.pid
# config: /etc/red5.conf

# Source function library.

. /etc/rc.d/init.d/functions

PID_FILE=/var/run/red5.pid
PID=`ps ax |grep java|grep red5|awk '{print $1;}'`
RETVAL=0

start() {
echo -n $"Starting $DESCR: "
# daemon java $OPTIONS > /dev/null 2>&1 &

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/java/default
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

exec $JAVA_HOME/bin/java -Djava.security.manager -Djava.security.policy=/usr/local/red5/conf/red5.policy -cp /usr/local/red5/red5.jar:conf:/usr/local/red5/conf org.red5.server.Standalone > /dev/null 2>&1 & RETVAL=$?

[ $RETVAL = 0 ] && touch /var/lock/subsys/red5 && echo $!>$PID_FILE && echo_success
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $DESCR: "
#killproc $PID_FILE
[[ $PID != "" ]] && success && kill $PID || failure
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/red5 $PID_FILE
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $"Usage: $DESCR {start|stop|restart}"
exit 1
esac

exit $RETVAL
----------------------------------------------------------------------------

# chmod 755 /etc/rc.d/init.d/red5
# chkconfig --add /etc/rc.d/init.d/red5

# /etc/rc.d/init.d/red5 start


- red5 spec file
----------------------------------------------------------------------------
Summary: Red5 Server
Name: red5
Version: 0.7.0
Release: 1
Source0: %{name}-%{version}.tar.gz
License: LGPL
Group: Applications/Networking
BuildRoot: %{_builddir}/%{name}-root
%description
The Red5 open source Flash server allows you to record and stream video to the Flash Player.
%prep
%setup -q
%build
ant dist-installer
%install
cp dist $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/usr/local/bin/red5.init
%doc doc/changelog.txt
------------------------------------------------------------------------------

- Red5를 이용한 flv 동영상 스트리밍 Player 환경 구성하기

flash_media_player.zip 파일을 다운로드 받는다.
http://www.jeroenwijering.com/upload/flash_media_player.zip

# cp mediaplayer.html index.html

# vi index.html
------------------------------------------------------------------------------
<html>
<head>

<script type="text/javascript" src=swfobject.js></script>


</head>
<body>


<p id="player2"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</p>
<script type="text/javascript">
        var s2 = new SWFObject("mediaplayer.swf","playlist","640","640","9");
        s2.addParam("allowfullscreen","true");
        s2.addVariable("file","playlist.xml");
        s2.addVariable("displayheight","480");
        s2.addVariable("backcolor","0x000000");
        s2.addVariable("frontcolor","0xCCCCCC");
        s2.addVariable("lightcolor","0x996600");
        s2.write("player2");
</script>


</body>
</html>
----------------------------------------------------------------------------------

# vi playlist.xml
----------------------------------------------------------------------------------
<playlist version="1" xmlns="
http://xspf.org/ns/0/">
        <trackList>
        <track>
        <title>Resident.Evil.Degeneration.2008</title>
        <creator>alang</creator>
        <location>rtmp://syszone.co.kr/oflaDemo/</location>
        <identifier>residentevil.flv</identifier>
        <meta rel="type">rtmp</meta>
        </track>
        </trackList>

.
.

</playlist>
----------------------------------------------------------------------------------


위의 <location>rtmp://syszone.co.kr/oflaDemo/</location> 에 해당 red5 streams 디렉토리
경로를 지정한다.

기본 경로는 [RED5_PATH]/webapps/oflaDemo/streams 디렉토리 밑에 flv 파일을 넣어두면된다.

- RED5와 OpenLaszlo를 이용한 스트리밍 환경 구축하기

http://www.openlaszlo.org 에서 최신 패키지를 다운받는다.

최신 개발 패키지  : http://download.openlaszlo.org/nightly/trunk


# tar xzvf openlaszlo-4.2.0-unix.tar.gz
# mv lps-4.2.0 /usr/local/lps
# cd /usr/local/lps/Server/tomcat-5.0.24/bin
# ./startup.sh
----------------------------------------------------------------------------------
Using CATALINA_BASE:   /usr/local/lps/Server/tomcat-5.0.24
Using CATALINA_HOME:   /usr/local/lps/Server/tomcat-5.0.24
Using CATALINA_TMPDIR: /usr/local/lps/Server/tomcat-5.0.24/temp
Using JAVA_HOME:       /usr/java/default

----------------------------------------------------------------------------------

http://domain:8080/lps-4.2.0/demos/

# cd /usr/local/lps/Server/lps-4.2.0/demos/videolibrary
# vi videolibrary.lzx
----------------------------------------------------------------------------------
<include href="av/videoutils.lzx"/> -> 삭제

.
.
    <dataset name="ds_library"
        src=http:videolibrary.jsp?method=getLibrary
        request="true"
    />

이 부분을 ..

    <dataset name="ds_library"
        src=
http://192.168.123.2:8080/lps-4.2.0/demos/videolibrary/videolibrary.jsp?method=getLibrary"
        request="true"
    />

으로 ..


    <rtmpconnection id="rtc"
        autoconnect="true"
        debug="true"
        src=rtmp:localhost/test/instance1
    />
 
이 부분을 ..

    <rtmpconnection id="rtc"
        autoconnect="true"
        debug="true"
        src=rtmp://192.168.123.90/oflaDemo
    />

으로 변경
----------------------------------------------------------------------------------
# vi videolibrary.jsp
---------------------------------------------------------------------------------
    public String libraryDirectory =
        "/home/fms/applications/test/streams/instance1/"; --> 이부분을 ..
 "/usr/local/red5/webapps/oflaDemo/streams/" 으로 ..

    public String libraryUrl =
        "rtmp://localhost/test/instance1/"; --> 이부분을
 "rtmp://domain/oflaDemo/"; 으로 ..

---------------------------------------------------------------------------------

아래 주소로 접속하면 확인이 가능하다.

http://192.168.123.2:8080/lps-4.2.0/demos/videolibrary/videolibrary.lzx

;; flv 파일명이 한글이면 안된다.
;; flv 파일 리스트와 썸네일이 보이지 않는다.

- thumbnail 관련 임시 조치

# cd /usr/local/lps/Server/lps-4.2.x/demos/videolibrary
# vi videolibrarythumbnail.lzx
--------------------------------------------------------------------------------
.
        <videothumbnail name="vt"
.
thumbnailtime="${classroot.thumbnailtime}" resource="resources/thumbnail.jpg"
 />
--------------------------------------------------------------------------------

resources="원하는 thumbnail 파일 경로" 적어 준다.

....ㅠ.ㅠ

- lps URL 변경

# cd /usr/local/lps/Server/tomcat-5.0.24/conf/LPS/localhost
# vi lps.xml
--------------------------------------------------------------------------------
<Context docBase="../../lps-4.2.x" path="/lps-4.2.x">

위의 path="" 에 url에 표시될 alias명을 적는다.

http://domain:8080/<alias_name>

- SOLO 기능 이용하기

solo 는 laszlo에서 개발된 내용을 HTML과 swf 형태로 변경해 주는 관리 기능이다.
실제 laszlo로 미디어 관련 어플리케이션을 개발한 후 최종적으로는 solo를 이용하여
웹 컨텐츠 형태로 변형 시켜 사용한다.

solo 버턴을 클릭하면 해당 컨텐츠가 zip 파일로 압축된다.
압축 파일 위치는 /usr/local/lps/Server/lps-4.2.x/lps/admin 이다.

웹서버의 적당한 디렉토리 및에 해당 파일을 풀고 사용하면 된다.



4.3 WebCam 설치하기

- webcam driver 다운로드

$ wget http://mxhaard.free.fr/spca50x/Download/gspcav1-20071224.tar.gz
$ wget http://forums.quickcamteam.net/attachment.php?aid=86 -O patch.tar.gz

- driver 패치 및 설치

$ tar -xvf gspcav1-20071224.tar.gz
$ tar -xvf patch.tar.gz
$ cd gspcav1-20071224
$ patch -p1 < ../quickcamE2500.diff

$ ./gspca_build
>> gspca.ko파일이 생성된다.

$ lsmod | grep gspca            // videodev가 보일것이다.


$ rmmod gspca
$ modprobe -v gspca
>> insmod /lib/modules/2.6.18-92.el5/kernel/driver/usb/media/gspca.ko
대략 저러한것들이 보인다.
없을 경우..
 
$ rmmod gspca
$ mv gspca.ko /lib/modules/2.6.18-92.el5//kernel/driver/media/video/
$ modprobe gspca
위와 같이 해당위치에 파일을 옮겨주다.

# cd /lib/modules
# depmod -a 2.6.18-92.el5

# mknod /dev/video0 c 81 0
# ln -sf /dev/video0 /dev/video

- webcam viewer 설치 (xawtv)

# yum install xawtv

Bridge Server Install

StudyRoom/Linux_Server
### 클루닉스 Bridge Server Install #######################
#   제작일 : 2004.5.6  작성자 : 서진우 < alang@clunix.com>
#

1. Bridge 네트워크 구성

- 먼저 bridge 서버의 물리적 네트워크 구성은 다음과 같다.

라우터 ----- 브리지서버(eth0)|브리지서버(eth1) ---- 백본스위치 ----- 클라이언트

-------------------------------------------------------------------------------
라우터 -> 브리지서버(eth0) : cross cable
브리지서버(eth1) -> 백본스위치 : direct cable
-------------------------------------------------------------------------------

- 외부회선 ---- 브리지서버(eth0)|브리지서버(eth1) ---- 스위치 --- 클라이언트

-------------------------------------------------------------------------------
외부회선 -> 브리지서버(eth0) : direct cable
브리지서버(eth1) -> 스위치 : direct cable
-------------------------------------------------------------------------------

2. 구축 준비 패키지

H/W :

랜카드 2장 달린 시스템

S/W :

리눅스커널 : 2.4.26
브리지 커널 패치 : ebtables-brnf-5_vs_2.4.25.diff
브리지 유틸 : bridge-utils-0.9.6.tar.gz iptables
커널 패치 : patch-o-matic-20031219.tar.bz2 iptables
유틸 : iptables-1.2.9.tar.bz2

bridge 커널 패치 및 bridge utils
Linux ethernet bridging http://bridge.sourceforge.net

bridge-nf-0.0.7-against-2.4.19.diff

bridge-utils-0.9.6.tar.gz

iptables 커널 패치 및 iptables
netfilter/iptables http://www.netfilter.org

patch-o-matic-20030107.tar.bz2

iptables-1.2.8.tar.bz2

리눅스 커널 소스
The Linux Kernel Archives http://www.kernel.org

linux-2.4.19.tar.bz2





ftp://syszone.co.kr/pub/linux/kernel

3. 커널 패치

- kernel patch

# cd /usr/src
# tar jxvf linux-2.4.26.tar.bz2
# ln -sf linux-2.4.26 linux
# cd linux
# patch -p1 < ../ebtables-brnf-5_vs_2.4.25.diff

- iptables patch ( string )

# tar jxvf patch-o-matic-20031219.tar.bz2
# cd patch-o-matic
# ./runme extra

Hey! KERNEL_DIR is not set.
Where is your kernel? [/usr/src/linux]   ->  Y ( 링크 재대로 걸어야 함 )

그럼 아래와 같이..다음과 같은 패치 한다고 물어봄

.
.
   + New 'helper' match (Martin Josefsson, Harald Welte)
   submitted/ip6tables-exthdr-bug.patch.ipv6
   + Fix broken ipv6 extensionheader parser (Andras Kis-Szabo)
   submitted/ipv6-agr.patch.ipv6
   + New ip6tables 'eui64' match (Andras Kis-Szabo)
   submitted/length.patch.ipv6
   + New ip6tables 'length' match (Imran Patel, James Morris)
   submitted/log-tunnel-fix.patch.ipv6
   + Fix ip6tables 'LOG' target MAC address in case of tunnels
   (Peter Bieringer, Andras Kis-Szabo)
   submitted/nat-memoryleak-fix.patch
   + Fix memoryleak at iptable_nat unload time (zhongyu)
   submitted/ownercmd.patch
   + Extend 'owner' match to match cmdline (Marc Boucher)
   submitted/pkttype.patch
   + New 'pkttype' match (Michal Ludvig)
   submitted/ulog-nlgroup-shift-fix.patch
   + Fix error with shifting nlgroup in ULOG target (Harald Welte)
   submitted/ulog-sparc-bitops-fix.patch
   + Include linux/bitops.h instead of asm/bitops.h
   submitted/z-newnat16.patch
   + Redesign of conntrack and nat helper framework, for more info see
http://cvs.netfilter.org/cgi-bin/cvsweb/netfilter/documentation/newnat-summary.txt
   (Harald Welte, Jozsef Kadlecsik, and others)
   submitted/z-newnat_assertfix.patch
   + Fix erroneously printed ASSERT messages when debugging of newnat
   enabled (Martin Josefsson)
   submitted/z-newnat_changeexpect-lockfix.patch
   + Fix locking bug in ip_conntrack_change_expect() (Martin Josefsson)
   Further changes, not previuosly in patch-o-matic:
   + ip6tables usage counter fix (Harald Welte)
   + ip_queue cleanup (James Morris)
   + minor spelling fixes
   + __constant_htons() macro changes
   + ipt_unclean: srcport _can_ be zero
   + yet another ipchains GFP_ATOMIC fix
-----------------------------------------------------------------
Do you want to apply this patch [N/y/t/f/a/r/b/w/v/q/?]

그냥 엔터 ..

iptable패치에는 내용이 여러 가지가 존재한다. y를 누르면 패치가 된다.
그러나 전부 패치를 하면 안 된다. 나중에 커널을 컴파일 하면 에러가 나기
때문에 꼭 필요한 것만 y를 눌러 패치 한다. b를 누르면 뒤로 돌아갈 수 있다.

지금 패치 할 것은 패킷에서 String을 검색하여 패킷을 버리거나 거부 하는
String match support 이다. 이것을 이용하면 Nimda, CodeRed 등의 웜이나
바이러스의 패킷을 차단 할 수 있다.

그리고 메일의 string 을 검색하여 스팸 메일 차단에 이용할 것이다.


계속 엔터를 쳐서 가다 보면 아래와 같은 화면이 나올것 이다.
Welcome to Rusty's Patch-o-matic!

Each patch is a new feature: many have minimal impact, some do not.
Almost every one has bugs, so I don't recommend applying them all!
-------------------------------------------------------
Already applied: submitted/01_2.4.19

Testing... string.patch NOT APPLIED ( 2 missing files) The extra/string patch:
   Author: Emmanuel Roger <winfield@freegates.be>
   Status: Working, not with kernel 2.4.9
  
   This patch adds CONFIG_IP_NF_MATCH_STRING which allows you to
   match a string in a whole packet.
  
   THIS PATCH DOES NOT WORK WITH KERNEL 2.4.9 !!!
  
-----------------------------------------------------------------
Do you want to apply this patch [N/y/t/f/a/r/b/w/v/q/?]

여기서 y를 누르면 String match가 패치 된다.

계속 엔터를 치면 다른 패치들이 나온다. 필요한 것들이 있으면 패치한다.

- 커널 설정

# cd /usr/src/linux
# make menuconfig

network option 으로 가서 netfilter 관련 설정과 bridge 관련 설정을 한다.

Networking options

  x x      <*> Packet socket                                              x x  
  x x      [*]   Packet socket: mmapped IO                                x x  
  x x      < > Netlink device emulation                                   x x  
  x x      [*] Network packet filtering (replaces ipchains)               x x  
  x x      [ ]   Network packet filtering debugging                       x x  
  x x      [*] Socket Filtering                                           x x  
  x x      <*> Unix domain sockets                                        x x  
  x x      [*] TCP/IP networking                                          x x  
  x x      [*]   IP: multicasting                                         x x  
  x x      [ ]   IP: advanced router                                      x x  
  x x      [ ]   IP: kernel level autoconfiguration                       x x  
  x x      < >   IP: tunneling                                            x x  
  x x      < >   IP: GRE tunnels over IP                                  x x  
  x x      [*]   IP: multicast routing                                    x x  
  x x      [ ]     IP: PIM-SM version 1 support                           x x  
  x x      [ ]     IP: PIM-SM version 2 support                           x x  
  x x      [ ]   IP: ARP daemon support (EXPERIMENTAL)                    x x  
  x x      [ ]   IP: TCP Explicit Congestion Notification support         x x  
  x x      [*]   IP: TCP syncookie support (disabled per default)         x x  
  x x        IP: Netfilter Configuration  --->                            x x  
  x x        IP: Virtual Server Configuration  --->                       x x  
  x x      < >   The IPv6 protocol (EXPERIMENTAL)                         x x  
  x x      < >   Kernel httpd acceleration (EXPERIMENTAL)                 x x  
  x x         SCTP Configuration (EXPERIMENTAL)  --->                     x x  
  x x      < > Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)            x x  
  x x      < > 802.1Q VLAN Support                                        x x  
  x x      ---                                                            x x  
  x x      < > The IPX protocol                                           x x  
  x x      < > Appletalk protocol support                                 x x  
  x x      Appletalk devices  --->                                        x x  
  x x      < > DECnet Support                                             x x  
  x x      <*> 802.1d Ethernet Bridging                                   x x  
  x x      <M>   Bridge: ebtables                                         x x  
  x x      <M>     ebt: filter table support                              x x  
  x x      <M>     ebt: nat table support                                 x x  
  x x      <M>     ebt: broute table support                              x x  
  x x      <M>     ebt: log support                                       x x  
  x x      <M>     ebt: IP filter support                                 x x  
  x x      <M>     ebt: ARP filter support                                x x  
  x x      <M>     ebt: among filter support                              x x  
  x x      <M>     ebt: limit filter support                              x x  
  x x      <M>     ebt: 802.1Q VLAN filter support                        x x  
  x x      <M>     ebt: 802.3 filter support                              x x  
  x x      <M>     ebt: packet type filter support                        x x  
  x x      <M>     ebt: STP filter support                                x x  
  x x      <M>     ebt: mark filter support                               x x  
  x x      <M>     ebt: arp reply target support                          x x  
  x x      <M>     ebt: snat target support                               x x  
  x x      <M>     ebt: dnat target support                               x x  
  x x      <M>     ebt: redirect target support                           x x  
  x x      <M>     ebt: mark target support                               x x  
  x x      < > CCITT X.25 Packet Layer (EXPERIMENTAL)                     x x  
  x x      < > LAPB Data Link Driver (EXPERIMENTAL)                       x x  
  x x      [ ] 802.2 LLC (EXPERIMENTAL)                                   x x  
  x x      [ ] Frame Diverter (EXPERIMENTAL)                              x x  
  x x      < > Acorn Econet/AUN protocols (EXPERIMENTAL)                  x x  
  x x      < > WAN router                                                 x x  
  x x      [ ] Fast switching (read help!)                                x x  
  x x      [ ] Forwarding between high speed interfaces                   x x  
  x x      QoS and/or fair queueing  --->                                 x x  
  x x      Network testing  --->                                          x x  


IP: Netfilter Configuration

  x x      <*> Connection tracking (required for masq/NAT)                x x  
  x x      <M>   FTP protocol support                                     x x  
  x x      <M>   Amanda protocol support                                  x x  
  x x      <M>   TFTP protocol support                                    x x  
  x x      <M>   IRC protocol support                                     x x  
  x x      <M> Userspace queueing via NETLINK (EXPERIMENTAL)              x x  
  x x      <*> IP tables support (required for filtering/masq/NAT)        x x  
  x x      <M>   limit match support                                      x x  
  x x      <M>   MAC address match support                                x x  
  x x      <M>   Packet type match support                                x x  
  x x      <M>   netfilter MARK match support                             x x  
  x x      <M>   Multiple port match support                              x x  
  x x      <M>   TOS match support                                        x x  
  x x      <M>   recent match support                                     x x  
  x x      <M>   ECN match support                                        x x  
  x x      <M>   DSCP match support                                       x x  
  x x      <M>   AH/ESP match support                                     x x  
  x x      <M>   LENGTH match support                                     x x  
  x x      <M>   TTL match support                                        x x  
  x x      <M>   tcpmss match support                                     x x  
  x x      <M>   Helper match support                                     x x  
  x x      <M>   Connection state match support                           x x  
  x x      <M>   Connection tracking match support                        x x  
  x x      <M>   Unclean match support (EXPERIMENTAL)                     x x  
  x x      <M>   String match support (EXPERIMENTAL)                      x x  
  x x      <M>   Owner match support (EXPERIMENTAL)                       x x  
  x x      <M>   Physdev match support                                    x x  
  x x      <M>   Packet filtering                                         x x  
  x x      <M>     REJECT target support                                  x x  
  x x      <M>     MIRROR target support (EXPERIMENTAL)                   x x  
  x x      <M>   Full NAT                                                 x x  
  x x      <M>     MASQUERADE target support                              x x  
  x x      <M>     REDIRECT target support                                x x  
  x x      [*]     NAT of local connections (READ HELP)                   x x  
  x x      <M>     Basic SNMP-ALG support (EXPERIMENTAL)                  x x  
  x x      <M>   Packet mangling                                          x x  
  x x      <M>     TOS target support                                     x x  
  x x      <M>     ECN target support                                     x x  
  x x      <M>     DSCP target support                                    x x  
  x x      <M>     MARK target support                                    x x  
  x x      <M>   LOG target support                                       x x  
  x x      <M>   ULOG target support                                      x x  
  x x      <M>   TCPMSS target support                                    x x  
  x x      <M> ARP tables support                                         x x    
  x x      <M>   ARP packet filtering                                     x x  
  x x      <M>   ARP payload mangling                                     x x  


다른것은 커널 컴파일 문서를 참고하세요.

P-III / IDE HDD / intel, realtec ethernet Card 시스템의 커널 설정 파일을
다운 받아서 수정후 사용하셔도 됨.

# make dep && make clean
# make bzImage && make modules && make modules_install
# cp System.map /boot/System.map-2.4.26
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.26
# cd /boot
# ln -sf System.map-2.4.26 System.map
# ln -sf vmlinuz-2.4.26 vmlinuz

하신후 /etc/lilo.conf 수정하고 lilo 실행

# vi /etc/lilo.conf
----------------------------------------------------------------------------

prompt
timeout=50
default=bridge
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear

image=/boot/vmlinuz-2.4.20-8
        label=linux
        initrd=/boot/initrd-2.4.20-8.img
        read-only
        append="root=LABEL=/"

image=/boot/vmlinuz
        label=bridge
        read-only
        root=/dev/hda2

---------------------------------------------------------------------------

리부팅 하세요..

4. Bridge utiles, iptables 설치 하기

# tar xzvf bridge-utils-0.9.6.tar.gz
# cd bridge-utils
# ./configure
# make
# make install

# tar xjvf iptables-1.2.9.tar.bz2
# cd iptables-1.2.9
# make KERNEL_DIR=/usr/src/linux
# make install KERNEL_DIR=/usr/src/linux # make install-devel

iptables 설치 하고 난 후 rpm 으로 설치된 iptables 와 충돌이 안나게 기존 명령어 을 막아 놓으세요.

레드헷의 경우 /sbin/iptables 위치함. 적당한 다른 이름으로 변경해둠. 그런후 ..

# ln -sf /usr/local/sbin/iptables /sbin/iptables


5. Bridge 네트워크 설정하기

Bridge device 추가함

# /usr/local/sbin/brctl addbr clxbr0
# /usr/local/sbin/brctl addif clxbr0 eth0 # /usr/local/sbin/brctl addif clxbr0 eth1

# vi /etc/sysconfig/network-scripts/ifcfg-clxbr0
----------------------------------------------------------------------------
DEVICE=clxbr0
IPADDR=211.241.202.142
NETMASK=255.255.255.128
ONBOOT=yes
----------------------------------------------------------------------------

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
----------------------------------------------------------------------------
DEVICE=eth0
ONBOOT=no
----------------------------------------------------------------------------

# vi /etc/sysconfig/network-scripts/ifcfg-eth1
----------------------------------------------------------------------------
DEVICE=eth1
ONBOOT=no
----------------------------------------------------------------------------

# ifdown lo
# ifdown eth0
# ifdown eth1
# ifup lo
# ifconfig ifconfig
# ifconfig eth0 0.0.0.0
# ifconfig eth1 0.0.0.0
# ifup clxbr0

하면 Bridge Network 설정이 마무리 됨.
Bridge Server 외부와 내부로 ping 이 되는지 확인 함.

매번 리부팅 될때 마다 위와 같은 작업을 해야 하기 때문에 다음 init script을
이용 하여 부팅 시마다 자동으로 적용되도록 함.

# vi /etc/rc.d/init.d/bridge

---------------------------------------------------------------------------
#! /bin/sh
#
# bridge        Start/Stop Ethernet Bridge interface with 2 ethernet NIC
#
# description:  Ethernet Bridge for transparent(bridge) Firewall
#               make bridge interface(clxbr0) and tie 2 NIC to clxbr0 and
#               setup firewall & NAT(MASQUERADE) of iptables
#
# Clunix.inc <alang@clunix.com> 2004.5.1 #

# Source function library.
. /etc/init.d/functions

# Source Network config
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
        exit 0
fi

[ -x /usr/local/sbin/brctl ] || exit 0

RETVAL=0

start() {
        # check /var/lock/subsys/bridge file
        if [ -f /var/lock/subsys/bridge ] ; then
                return
        fi

        # make bridge interface
        echo -n $"Starting Bridge: "
        /usr/local/sbin/brctl addbr clxbr0 > /dev/null 2>&1 &&
        /usr/local/sbin/brctl addif clxbr0 eth0 > /dev/null 2>&1 &&
        /usr/local/sbin/brctl addif clxbr0 eth1 > /dev/null 2>&1
        RETVAL=$?
        if [ $RETVAL -eq 0 ] ; then
                success "bridge startup"
        else
                failure "bridge startup"
        fi
        echo

        # start networking of bridge
        echo -n $"Starting Network of Bridge: "
        ifup lo && ifconfig eth0 0.0.0.0 && \\
          ifconfig eth1 0.0.0.0 && ifup clxbr0
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success "Network of bridge startup" \\
        || failure "Network of bridge startup"
        echo

        touch /var/lock/subsys/bridge
        return $RETVAL
}

stop() {
        # check /var/lock/subsys/bridge file
        if [ ! -f /var/lock/subsys/bridge ] ; then
                return
        fi

        # stop networking of bridge
        echo -n $"Stopping Network of bridge: "
        ifdown clxbr0 && ifconfig eth1 down && ifconfig eth0 down && ifdown lo
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success "Network of bridge stopping" \\
        || failure "Network of bridge stopping"
        echo

        # stop bridge interface
        echo -n $"Stopping Bridge: "
        /usr/local/sbin/brctl delif clxbr0 eth1 > /dev/null 2>&1 &&
        /usr/local/sbin/brctl delif clxbr0 eth0 > /dev/null 2>&1 &&
        /usr/local/sbin/brctl delbr clxbr0 > /dev/null 2>&1
        RETVAL=$?
        if [ $RETVAL -eq 0 ] ; then
                success "bridge stopping"
        else
                failure "bridge stopping"
        fi
        echo
        rm -f /var/lock/subsys/bridge
        return $RETVAL
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        /usr/local/sbin/brctl show
        ;;
  restart)
        stop
        sleep 2
        start
        ;;
  *)
        echo  $"Usage: $0 {start|stop|status|restart}"
        exit 1
esac

exit $RETVAL

------------------------------------------------------------------------------

# ln -sf /etc/rc.d/init.d/bridge /etc/rc3.d/S11bridge # chkconfig --add bridge


5. iptables script 사용하기

# vi /etc/rc.d/init.d/brctl
------------------------------------------------------------------------------

#! /bin/sh
#
# iptables      Start/Stop firewall with iptables
#
# description:  Clunix Firewall filtering & NAT with iptables
#
# Clunix.inc <alang@clunix.com> 2004.05.01
#

# Source function library.
. /etc/init.d/functions

# Source Network config
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
        exit 0
fi

[ -x /usr/local/sbin/iptables ] || exit 0

RETVAL=0

start() {

        # check /var/lock/subsys/firewall file
        if [ -f /var/lock/subsys/firewall ] ; then
                return
        fi

        # print "start firewall" msg
        echo -n $"Starting Firewall: "

        #
        # start firewall & NAT
        #

        # 내부 네트워크 영역 설정

        INTER_AREA="211.241.202.128/25"

        modprobe ip_conntrack_ftp
        modprobe ip_conntrack_irc
        modprobe ipt_string
        modprobe ipt_state
        modprobe ipt_REJECT
        modprobe ipt_REDIRECT
        modprobe ipt_MASQUERADE
        modprobe ip_nat_snmp_basic
        modprobe ip_nat_ftp
        modprobe ip_nat_irc

        
        echo 1 > /proc/sys/net/ipv4/ip_forward

        #
        # init iptables
        #
        # flush all chains

        iptables -F
        iptables -X
        chains=`cat /proc/net/ip_tables_names 2>/dev/null`
        for i in $chains
        do
                iptables -t $i -F
                iptables -t $i -X
                iptables -t $i -Z
        done


        # 기본 정책 설정

        iptables -P INPUT DROP
        iptables -P OUTPUT ACCEPT
        # firewall filtering
        iptables -P FORWARD DROP


        ######################################################################
        # User defined chains
        ######################################################################
        #
        # refuse :
        # explicit refuse chains
        # logging to /var/log/firewall (via syslog kern.debug) & reject
        #
        iptables -N refuse
        iptables -A refuse ! -i eth1 -m limit --limit 1/m -j LOG \\
          --log-prefix "refused: " --log-level debug
        iptables -A refuse -p tcp -m limit --limit 10/s -j REJECT \\
          --reject-with tcp-reset
        iptables -A refuse -p udp -m limit --limit 10/s -j REJECT
        iptables -A refuse -j DROP

        #
        # global_icmp :
        # specified ICMP packets are accepted globally
        #
        # accept following icmp pkt
        #  -  0 : echo reply
        #  -  3 : dest unreachable
        #  -  5 : redirect
        #  -  8 : echo request
        #  - 11 : time exceed
        iptables -N global_icmp
        iptables -A global_icmp -p icmp --icmp-type 0 -j ACCEPT
        iptables -A global_icmp -p icmp --icmp-type 3 -j ACCEPT
        iptables -A global_icmp -p icmp --icmp-type 5 -j ACCEPT
        iptables -A global_icmp -p icmp --icmp-type 8 -j ACCEPT
        iptables -A global_icmp -p icmp --icmp-type 11 -j ACCEPT

        #
        # global_udp :
        # specified udp packets are accepted globally
        #
        iptables -N global_udp

        # edoneky (4661-4663/tcp, 4665/udp) for all PC

        iptables -A global_udp -p udp --dport 4665 -j ACCEPT


        #
        # global_tcp :
        # specified tcp packets (that is valid) are accepted globally
        #
        # specified tcp packets (that is valid) are accepted globally
        #

        iptables -N global_tcp

        # accept tcp syn pkt
        # iptables -A global_tcp -p tcp --syn -j ACCEPT
        # drop new pkt that has no syn
        iptables -A global_tcp -p tcp ! --syn -m state --state NEW -j DROP

        # MSN file transfer (6891-6900/tcp) for all PC
        # http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q278887&
        iptables -A global_tcp -p tcp --dport 6891:6900 -j ACCEPT
        # edoneky (4661-4663/tcp, 4665/udp) for all PC
        iptables -A global_tcp -p tcp --dport 4661:4663 -j ACCEPT

        #
        # open :
        # accept connection by each server:port
        #

        iptables -N open
        iptables -A open -p tcp -d 211.241.202.153 --dport 22 -j ACCEPT
        iptables -A open -p tcp -d 211.241.202.152 --dport 25 -j ACCEPT



        # String Rule

        # Nimda, CodeRed

        iptables -A FORWARD -p tcp --tcp-flags ACK ACK --dport 80 -m string \\
        --string "/default.ida?" -j REJECT --reject-with tcp-reset
        iptables -A FORWARD -p tcp  --tcp-flags ACK ACK --dport 80 -m string \\
        --string "XXXXXXXX" -j REJECT --reject-with tcp-reset
        iptables -A FORWARD -p tcp  --tcp-flags ACK ACK --dport 80 -m string \\
        --string "cmd.exe" -j REJECT --reject-with tcp-reset
        iptables -A FORWARD -p tcp  --tcp-flags ACK ACK --dport 80 -m string \\
        --string "root.exe?" -j REJECT --reject-with tcp-reset

        # Mail Subject,Content String

        iptables -A FORWARD -p tcp --dport 25 -m string --string "test" -j REJECT \\
        --reject-with tcp-reset

        iptables -A FORWARD -p tcp --dport 25 -m string --string "광고" -j REJECT \\
        --reject-with tcp-reset

        # SQL Slammer
        iptables -A FORWARD -p udp -m string --string "Qh.dllhel32hkern" -j REJECT

        ######################################################################
        # FORWARD chain rules
        ######################################################################
        # accept all packets from internal network (eth1)
        iptables -A FORWARD -p ALL -i eth1 -j ACCEPT
        iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
        
        # New Rules Forward

        iptables -A FORWARD -p icmp -j global_icmp
        iptables -A FORWARD -p udp -j global_udp
        iptables -A FORWARD -p tcp -j global_tcp
        iptables -A FORWARD -j open

        # otherwise, refuse it
        iptables -A FORWARD -j refuse

        # accept all pkt from local loopback interface
        iptables -A INPUT -i lo -j ACCEPT

        # accept all packets by stateful-inspection
        iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

        # filter by global icmp pkt
        iptables -A INPUT -p icmp -j global_icmp

        # filter by  global tcp pkt
        iptables -A INPUT -p tcp -j global_tcp


        # accept only ssh(22/tcp) pkt
        iptables -A INPUT -p tcp -i eth1 --dport 22 -j ACCEPT
        iptables -A INPUT -p tcp -i eth0 --dport 22 -j ACCEPT


        # otherwise, refuse pkt
        iptables -A INPUT -j refuse


        #
        # accept all out pkt
        #

        iptables -A OUTPUT -o br0 -j ACCEPT
        iptables -A OUTPUT -o lo -j ACCEPT


        ######################################################################
        # for NAT(masquerade)
        ######################################################################
        #
        # masquerade
        #

        iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE

        # print "firewall startup" msg
        [ $? -eq 0 ] && success "firewall startup" || \\
        # print "firewall startup" msg
        [ $? -eq 0 ] && success "firewall startup" || \\
          failure "firewall startup"
        echo

        # lock
        touch /var/lock/subsys/firewall

}

stop() {

        # check /var/lock/subsys/firewall file
        if [ ! -f /var/lock/subsys/firewall ] ; then
                return
        fi

        # print "stop firewall" msg
        echo -n $"Stopping Firewall: "

        #
        # flush & delete iptables rules
        #
        chains=`cat /proc/net/ip_tables_names 2>/dev/null`
        for i in $chains
        do
                iptables -t $i -F
                iptables -t $i -X
        done
        iptables -P INPUT ACCEPT && \\
        iptables -P OUTPUT ACCEPT && \\
        iptables -P FORWARD ACCEPT && \\
        iptables -t nat -P PREROUTING ACCEPT && \\
        iptables -t nat -P POSTROUTING ACCEPT && \\
        iptables -t nat -P OUTPUT ACCEPT && \\
        iptables -t mangle -P PREROUTING ACCEPT && \\
        iptables -t mangle -P OUTPUT ACCEPT

        #
        # start firewall & NAT
        #
        echo 0 > /proc/sys/net/ipv4/ip_forward

#        rmmod ip_conntrack_ftp
#        rmmod ip_conntrack_irc
        rmmod ipt_string
        rmmod ipt_state
        rmmod ipt_REJECT
        rmmod ipt_REDIRECT
        rmmod ipt_MASQUERADE
        rmmod ip_nat_snmp_basic
        rmmod ip_nat_ftp
        rmmod ip_nat_irc




        # print "firewall stop" msg
        [ $? -eq 0 ] && success "firewall stop" || failure "firewall stop"
        echo

        # unlock
        rm -f /var/lock/subsys/firewall
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        /sbin/iptables -L INPUT
        /sbin/iptables -L OUTPUT
        /sbin/iptables -L FORWARD
        ;;
  restart)
        stop
        sleep 1
        start
        ;;
  *)
        echo  $"Usage: $0 {start|stop|status|restart}"
        exit 1
esac

exit $RETVAL

---------------------------------------------------------------------------------

# ln -sf /etc/rc.d/init.d/brctl /etc/rc3.d/S70brctl

그런 후 리부팅 후에도 자동으로 Brige Server 로 작동하는지를 확인한다.

# ifconfig
# iptables -L ( /etc/rc.d/init.d/brctl status ) 

모바일웹용 mp4 동영상 스트리밍 재생 방법

StudyRoom/Linux_Server

 

1. 필요항목


1.1 스트리밍 동영상 서버

- 옴니아용 - Window Media Server ( mms 프로토콜로 동영상 스트리밍)
- 안드로이드용 - 다윈스트리밍서버(무료제품 http://www.devpia.com/Maeul/Contents/Detail.aspx?BoardID=278&MAEULNo=20&no=29095&ref=29095  )
- IPhone용 - 웹서버

1.2 테스트를 위한 도구

-옴니아폰, 안드로이드폰, iPhone

1.3 hint를 처리하는 프로그램

- 안드로이드 계열은 rtsp 프로토콜로 mp4파일의 스트리밍을 지원한다. rtsp로 스트리밍을 위해서는 hint로 처리해야한다.

mp4box 라는 프로그램이 있다. (예 : mp4box -hint video.mp4  주의 : 같은파일 여러번 처리하면 파일이 깨진다. )


2. 인코딩


옴니아 : wmv 파일

iPhone : mp4

안드로이드 : iPhone용으로 mp4로 인코딩한 파일을 hint 처리하면 된다.



3. html 소스상


옴니아  : <a href='mms://동영상파일명'>동영상</a>
안드로이드 : <a href='rtsp://동영상파일명'>동영상</a>
iphone  : iphone의 경우는 http로 직접링크를 걸면, 해킹폰에서 다운로드받을 수 있다. 아래와 같이 object를 사용하면 다운로드는 되지 않은다.

<div id="centerbutton">
<!-- 여러가지 이벤트로 동영상을 제어할 수 있다. -->
<a href="javascript:document.movieQuick.Play();"> 강의보기</a>
</div>

<object id="qt_event_source" classid="clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=7,2,1,0" ></object>
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=7,2,1,0" width="0" height="0" type="video/quicktime" id="movieQuick" style="behavior:url(#qt_event_source);">
<param name="src" value="video.mp4" />
<param name="qtsrc" value="video.mp4" />
<param name="postdomevents" value="true" />
<param name="AUTOPLAY" value="False" />
<embed src="video.mp4" qtsrc="video.mp4" width="0" height="0" id="movieQuick" name="movieQuick" postdomevents="true" AUTOPLAY="False" /></object>



4.hint 처리하는 mp4box 프로그램


다운로드 : http://kurtnoise.free.fr/mp4tools/

hint 처리 후 모토로이/ 갤럭시등 안드로이드 폰에서 오디오가 나오지 않을때 처리 옵션(코덱의 문제로 보인다)

MP4Box0.4.5.exe -hint -latm  ./2.MP4    <--오디오를  Advanced Audio Coding(latm )으로 강제로 사용하도록 처리


도움말 : http://gpac.sourceforge.net/doc_mp4box.php




### 추가 ###

실 시간 동영상 스트리밍 서버를 만들어서 테스트를 하는데 어찌된 일인지 셈플 동영상은 잘 플레이가 되는데 새로 인코딩해서 테스트를 해보면 동작을 하지 않아서 오랜 삽질 끝에 인코딩 된 동영상에 hint를 추가해 주어야 한다는 것을 알았다.
hint를 추가하는 것은 보통 mp4box를 많이 사용하는데 사용 방법은 간단하다.


 
프롬프트창을 열어서 mp4box.exe가 있는 곳으로 이동하여 아래와 같이 입력하면 된다.
 
mp4box -hint video.mp4

 
* 여기서 video.mp4는 해당 동영상을 의미함.

'StudyRoom > Linux_Server' 카테고리의 다른 글

VSFTP 설정  (0) 2011.09.06
RED5 + FFMPEG + FFserver 스트리밍 서버 구축하기  (0) 2011.09.06
Bridge Server Install  (0) 2011.09.06
아파치 웹서버 로그파일 상세분석  (0) 2011.01.05
GeoIP 데이터 업데이트  (0) 2011.01.05

아파치 웹서버 로그파일 상세분석

StudyRoom/Linux_Server

1) 아파치 로그파일 기록되는 위치
    /var/log/httpd/access_log
    (레드햇의 경우임. 아파치를 컴파일해 설치했다면 /usr/local/apache/logs/access_log 임)
     

2) 로그 기록 내용
     
    211.36.215.78 -  manager [22/Jun/2000:23:09:09 +0900] "GET / HTTP/1.1" 200 5
    ------------- ---  ----   ---------------------------  --- -- ---- -
          1        2    3               4                  5   6   7        8  9

    1 : 접속한 클라이언트의 IP 주소, 혹은 도메인 (httpd.conf 에서 HostnameLookups off 로
         설정하면 리버스 도메인 찾기를 않음)
    2 : REMOTE_IDENT (RFC 931 identification (아이덴티피케이션:동일함 확인)
         - 서버가 RFC 931 을 지원하는 경우 이 환경 변수에 클라이언트 시스템에서
         CGI프로그램을 실행시킨 사용자 이름이 저장된다고 합니다. 몰겠습니다.
         아직 한번도 여기 뭔가가 찍힐 것 확인 못해서..
    3 : 사용자이름( .htaccess .htpasswd 에 정의된 사용자 id )
    4 : 클라이언트(사용자 브라우저)의 접속시간정보 ( httpd 접속시간 )
        (구성 : [day/month/year:hour:minute:second zone])
    5 : 클라이언트(사용자 브라우저) 요청종류 ( GET , POST )
    6 : 클라이언트가 요청한 홈페이지 URL 주소 ( 요청한 자료 & 자료위치 )
    7 : 프로토콜 버전
    8 : 상태코드 ( 예. 200 정상처리 )
    9 : 전송데이터 크기
        상태코드 일부 304 은 - (하이픈) 로 표시
            hits  - 모든 상태 코드 포함
            files - 상태코드 200번만
    통계 프로그램 Webalizer (웹알리저) 2.00 기준입니다.
    응답 코드별 히트 수
    아래 코드는 상태 코드입니다. 클라이언트가 서버에게 요청했을 때 결과에 대한 상태 코드죠. 여기서 설명한 상태 코드 외에도 더 있지만 차후 추가하겠습니다.
    이 용어는 알아두셔야 될 듯.
    * entity body
      엔터티 본체는 요청/응답 메시지를 통해서 전달될 수 있는 데이타 자체를 나타내는
      바이트 스트림(byte stream:흐름)이다.
    말은 거창 한데.. 그냥 데이타 보내고 받는 부분입니다. 이 스트림은 엔터티 헤더에서 지정되는 데이타 타입과 인코딩 형식을 갖게 된다.
     
    Code 200 - OK

    사용자가 요청한(get , post) 가 성공적으로 수행되었을 때 요청한 처리 결과를 클라이언트에게 전달되는 정보는 사용된 메소드(method:방법)에 따라서 달라진다.. 위에 get 이나 post 가 있습니다.
     
    Code 206 - Partial(퍄셜) Content(컨텐트)  ( 일부 내용 )

    서버가 요청을 처리했지만 클라이언트에게 일부만 전달되었을 때..
     
    Code 301 - Moved Permanently (퍼머렌트리) ( 영구히, 불변하게 이동했다. )

    요청된 자원의 URL 값이 완전히 변경되었으므로 앞으로는 새로운 URL 값을 사용하여야 한다. 새로운 URL 값은 location(로케이션,위치) 헤더를 통해서 클라이언트에 전달된다. 또한, HEAD method 를 제외한 모든 경우에 요청  메시지의 entity body를 통해서 새로운 URL의 하이퍼 링크를 포함하는 짧은 메세지를 전달해 주어야 한다.
    웹 브라우저는 post method 를 사용한 요청의 결과로 301 상태코드를 전달받는 경우에는 자동으로 새로운 URL에 접속을 해서는 안된다. 반드시, 사용자의 확인을 거쳐야 한다.
     
    Code 304 - Not Modified ( 수정 모했따 )

    conditional(컨디셔널) 잠정적인(조건부의,가정적인) get method가 사용된 경우에 전달된다. Request(리퀘스트 : 요구)를 처리한 결과 If-Modified-since 헤더에  지정된 날짜/시간 이래로 지정된 문서가 변경된 사실이 없는 경우 서버는 이 상태코드로 응답해야 한다. 이때, entity body(실제 본문) 는 전송되지 않는다. (?) 웹브라우저 캐쉬사용 출력 속도 향상
     
    Code 400 - Bad Request  ( 잘못 요청 )

    Request(리퀘스트:요청) 메세지의 syntax(신택스:구문)가 잘못되어서 서버가 request 를 처리할 수 없다. 재 접속을 하는 경우에 클라이언트는 반드시 올바른 request메시지를 사용해야 한다.
     
    Code 401 - Unauthorized  (언어더라이즈드 :  권한없는, 허가받지 않은 )

    Request가 user authentication을 필요로 한다는 것을 클라이언트에게 알려주기 위해서 사용된다. WWW-Authenticate 헤더를 통해서 요청된 자원에 적용되는 challenge를 전달한다. 401 response(리스판(폰)스:감응,응답) 를 받은 클라이언트는 적절한  Authorization(어더리제이션:위임,권한부여) credentials(크리덴셜:신용 증명 물)를 포함하는 Authorization 헤더와 함께 다시 Request 메시지를 전송한다. Request 메시지에 그와 같은 Authorization credentials이 포함된 경우에  401 상태코드가 전달되면 user authentication(어던트케잇:인증)이 실패한 것을 나타낸다. - 인증 실패
     
    Code 404 - Not Found ( 못 찾았다 )

    Request-URL(요청 URL)에 해당하는 자원을 찾을 수 없을 경우에 사용된다 그런 상태가 일시적인 것인지 아니면 언제나 그렇게 되는지를 나타내는 어떤 정보도 전달되지 않는다. 이런 상태를 클라이언트에게 알리고 싶지 않을 경우에는 403 상태코드를 대신 사용해도 된다.
     * 403 코드 :  Forbidden(퍼비든:출입금지구역)

■ 일반적 용어
    ● 페이지뷰(page view)
    웹사이트의 특정 웹페이지에 이용자가 접속하여 페이지의 내용이 브라우저에 나타날 때, 그 1 회의 접속을 1 페이지뷰라 정의한다. 페이지뷰는 동일 인이 중복 접속하여도 그 숫자가 계속 증가하게 설정이 가능하다.
     
    ● 히트(Hit)수
    한명의 사용자가 웹서버의 한 파일에 접속하는 것을 말한다. 히트수는 웹사이트의 인기를 측정하는 단위로 사용되고 있지만 사실 잘못 알고 있는 것이다.
    어떤 사이트의 히트수가 `10’ 이라고 해서 10 명의 이용자가 방문한 것은 아니다. 요컨대, 히트란 서버의 한 파일 접속 수이기 때문에 한 사이트에 이미지가 10개가 포함되어 있다면 히트수는 이미지 10개와 웹페이지 1개를 포함한 11이 되는 것이다. 통계 프로그램 Webalizer(웹알리저) 2.00 기준입니다.
     
    ● Hits
    Any request made to the server which is logged, is considered a 'hit'. The requests can be for anything... html pages, graphic images, audio files, cgi scripts, etc...  Each valid line in the server log is counted as a hit.  This number represents the total number of requests that were made to the server during the specified report period.
    설명이 좀 이상한 건지 .. 전 이거 해석해도 정확하게 이해가 안갑니다... 돌머리라서 그런지..암튼 모든 서버 요청 기록을 말합니다. 위에 일반적인 hit 수 개념으로 생각하시면 됩니다.
     
    ● Files
    Some requests made to the server, require that the server then send something back to the requesting client, such as a html page or graphic image.  When this happens, it is considered a 'file' and the files total is incremented.  The relationship between 'hits' and 'files' can be thought of as 'incoming requests' and 'outgoing responses'.
    ※ 이것두  좀 이상해서 소스 뒤적여 봤거든요..이건 위에 말하는 outgoing responses(나가는 응답?) 중에서도..정확하게 나간거.. 그러니까 제가 위에 상태코드 적어 놓은거 중에서도.. 200 번으로 끝나는 수치의 총계입니다..
     
    ● Pages / pageviews
    This does not include the other stuff that goes into a document, such as graphic images, audio clips, etc...
    페이지 내의 이미지, 오디오 클립, 기타 제외   '.htm', '.html', '.cgi' 페이지 만 인정
    A lot of sites will probably define other extensions,  such as '.phtml', '.php3' and '.pl' as pages as well.  많은 사이트는 더우기 '.phtm의 같은 다른 확장자 , '.php3'과 '.pl' 들도 페이지로 규정할 것입니다. Some other programs (and people :) refer to this as 'Pageviews'. " 페이지 뷰 " 라고도 한답니다.
     
    ● Sites (사이트)
     
    211.36.215.78 -  manager [22/Jun/2000:23:09:09 +0900] "GET / HTTP/1.1" 200 5
    ------------- ---  ----   ---------------------------  --- -- --- -
          1        2    3               4                  5   6   7        8  9

    1 : 접속한 클라이언트의 IP 주소, 혹은 도메인
    1 번의 경우로 사이트 수를 검사할 수밖에 없습니다, 이 수가 각각의 사용자   즉 IP 1개가 1사용자를 의미하지는 않습니다.  (실제 사용자) 공정한 기록을 결정하기에는 어렵습니다. 왜일까요?
    인터넷 사용자 중에는 방화벽이나 IP 공유 기능을 이용해 인터넷 상에서 사용되는 IP 가 아닌 내부 IP (192.168.0.1 ~ 또는 172.0.0.1 ~ etc..) 로 사용하는 경우가 있습니다. 그럴 경우 인터넷 상의 IP 정의는 1개지만. 사용자는 수 백 명 또는 수 천 명이 될 수도 있습니다. 그래서 정확한 기록 결정을 내리기가 힘들다는 거죠.. *^^ 참고 되셨길..
     
    ● Visits (방문)
    디폴트 타임아웃 값은 30분(변경할 수 있다) 입니다, 그래서 사용자가 오후에 1시00분에(서) 당신의 사이트를 방문한다면, 3시00분에(서) 돌아옵니다, 2 의 방문이 기록되었습니다.
    Note: Visits only occur on PageType requests, that is, for any request whose URL is one of the 'page' types defined with the PageType option.  Due to the limitation of the HTTP protocol, log rotations and other factors, this number should not be taken as absolutely accurate,  rather, it should be considered a pretty close "guess".
    방문은 오직 페이지 타입에 지정된  페이지 형에 대한 요청에 대해 적용한다.
     
    ★ 현재 셋팅 상태
    PageType        htm*
    PageType        cgi
    PageType        moum
    PageType        phtml
    PageType        php3
    PageType        pl

    ● KBytes
    로그 기록 내용
     
    211.36.215.78 -  manager [22/Jun/2000:23:09:09 +0900] "GET / HTTP/1.1" 200 5
    ------------- ---  ----   ---------------------------  --- -- --- -
          1        2    3               4                  5   6   7        8  9

    전송데이터의 모두 합한 총계입니다. Note: A kilobyte is 1024 bytes, not 1000 :) 킬로 바이트는 1024 바이트입니다. 1000 바이트가 아닙니다.
    ※ 하드 용량의 차이에 관해서 여기서 약간 언급을 해야겠습니다.
    - 하드 용량을 보면 15G 짜리는 사면 제조회사마다 약간의 차이가 있을 거에요.
       그런 의문 가지신 적 없는지?  바로 위와 같은 계산 방식 때문입니다.
       1 Kbyte 를 1024로 하느냐..1000 으로 하느냐..
       전산을 전공한 분이라면 1024가 맞지만 수치상으로 보자면 1000 도 맞는 표현이죠..
    하드는 대부분이 1000 을 기준으로 합니다.!!! 1024 기준이 아님!!
     
    ● top Entry and Exit pages
    The Top Entry and Exit tables give a rough estimate of what URL's are used to enter your site, and what the last pages viewed are. Because of limitations in the HTTP protocol, log rotations, etc... this number should be considered a good "rough guess" of the actual numbers, however will give a good indication of the overall trend in where users come into, and, your site.
     
    톱 엔트리와 종료 홈페이지
    첫 번 입력 항목과 마지막 페이지로서 사용자가 접속한 사이트의 URL을 추측할 수 있다. 이 수자가 실제 연결수자의 근사치로 볼 수 있다. 또한 사용자 어디에서 시작해 어느 곳에서 종료하는지를 파악하는 자료이다.

    [출처] 설명이 잘되어 있어서 퍼옴