Linux2013. 5. 8. 11:17

In order to run ProFTPd as a Windows service under Cygwin the following needs to be set in the /etc/proftpd.conf file:

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

:

# Port 21 is the standard FTP port.
#Port                           21
Port                            2122
:

# Set the user and group under which the server will run.
User                            SYSTEM
Group                           Administrators

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

:

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

 

The server can then be run as a service:

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

cygrunsrv --install proftpd \
          --path /usr/sbin/proftpd.exe \
          --args "--nodaemon" \
          --type manual \
          --disp "CYGWIN proftpd" \
          --desc "ProFTPd FTP daemon"

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

 

Then it needs to be run:

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

cygrunsrv --start proftpd

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

 

'Linux' 카테고리의 다른 글

Cygwin 설치 및 개발환경 구축  (0) 2013.04.19
RPM 패키지 설치 및 삭제방법  (0) 2012.08.31
init와 Runlevel  (0) 2012.08.31
유니티 각 부분의 명칭 및 키보드 단축키  (0) 2011.07.20
유니티(unity) 초기화  (0) 2011.07.20
Posted by iWithJoy
Linux2013. 4. 19. 11:22



회사에서의 개발환경은 cygwin + gcc + gmake이다.  따라서 cygwin을 설치한다.

http://www.cygwin.com/setup.exe 를 다운받아놓도록 한다. 
향후 패키지를 추가/제거할 때도 사용하여야 하니까 그냥 다운 받아놓는 것이 낫다.  용량도 400KB 정도...

이걸 실행시키면 어디를 통해서 install 할 것인지를 물어본다. 
여기에서 Install from Internet을 사용한다.

Root Directory는 기본 설정인 C:\cygwin을 그냥 사용하는 것이 제일 무방할 듯 싶다. 
검색해본 결과 많은 사람들이 여기에 기반을 두고 작업을 하였기 때문에 헷갈리지 않을터이다. 
밑의 설정은 All Users와 Unix/binary에 체크한다. (기본 설정)

여기서 다음을 누르면 어디에 다운을 받을 것인지, 어떤 방법으로 받을 것인지 물어보는데 기본값을 쓰면 되고,
download site는 http://ftp.daum.net을 추가해서 쓰면 괜찮을 듯 하다.

기본값은 진짜 기본만 설치하게 되므로 나중에 되는게 하나도 없다
All 옆에 Default를 몇 번 클릭하여 Uninstall로 바꾸고, 원하는 패키지의 Unintall을 Install로 바궈서. 필요한 패키지만 설치하자.

직감적으로 gcc나 make, gdb, vim 등등은 당연히 해야할 것이라는 느낌이 온다.  
다음은 필요하다고 생각되는 package들을 정리한 것이다.

Admin - cygrunsrv (sshd 등을 bg로 돌릴 유틸)
Devel - gcc, make, ctags 관련
Editors - vim 관련
Net - openssh 관련 (ssh를 사용할 것이라면)
Shell - rxvt 관련 (xterm을 사용할 것이라면)

위에서 열거한 package 말고도 필요한 패키지들을 선택하도록 하고,
나중에 또 추가가 되므로 크게 신경 쓸 일은 아닌듯 하다.

어쨌거나 설치가 끝나면 환경변수를 설정하도록 한다. 
내 컴퓨터 우클릭하여 '속성'->'고급'->'환경변수'를 선택하여 사용자 변수와 시스템 변수를 추가하도록 한다.

사용자 변수
HOME=d:\home (linux에서의 ~ 를 말함)
LOGNAME= (windows 계정과 동일하게)

시스템 변수
CYGWIN (ntsec binmode)을 새로 만들고
PATHC:\Cygwin\bin을 추가한다 (당연히 항목과 항목 사이는 ;으로 구분한다).






만약 cygwin 자체의 terminal을 쓴다면 상관은 없지만, cygwin의 xterm을 사용하고 싶다면, 추가의 작업이 필요하다.

c:\cygwin을 보면 cygwin.bat가 있다.  autoexec.bat 이후로 bat 파일은 진짜 오랜만이다.  어쨌거나 이거 내용을 보면 다음과 같다.

@echo off

C:
chdir C:\cygwin\bin

bash --login -i

이거를 응용해서 rxvt,bat를 하나 만든다 (xterm용)

@echo off

C:
chdir C:\cygwin\bin

rxvt.exe -tn xterm -rv -sr -sw -bg gray -fg black -sl 1000 -sbt 15 -fn "Dotumche" -e /bin/bash --login -i

rxvt의 각 항목의 값들이 궁금하다면 cygwin에서 rxvt --help를 해보면 알 수 있다.  대충 xterm으로 띄우는데 scrolling이 가능하도록 하고 검은 배경에 회색글씨를 쓰겠다... 폰트는 Dotumche를 쓰겠고.. 뭐 이런 거다.

이게 끝난 다음에 만든 rxvt.bat를 실행시키면 익숙한 shell prompt를 확인할 수 있다.

cygwin에서 개발하려면 다른 editor도 있겠지만, 아무래도 vim을 가장 많이 사용하지 않을까 싶다.  cygwin에서 vim을 사용하려면 이거저거 걸리는게 많다.  일단 기본적으로 설정 파일이 없기 때문에 원 리눅스에서의 컬러풀(?)한 터미널을 기대하면 안된다.  또 한글입력에 문제가 많아서 요거 2가지 처리를 해줘야 한다.

먼저 vim을 설정해야 되는데, 항목이 워낙 많으니 그냥 /usr/share/vim/vim71/vimrc_example.vim을 home 디렉토리에 .vimrc로 복사하고, 좀 손을 봐준다.  쭉 내리다보면 다음과 같은 부분이 있다.

if has("vms")
  set nobackup
else
  set backup
endif

요 부분을 주석처리한다.  vimrc에서의 주석은 " (double quotation mark)를 맨 앞에 붙여주면 된다.  이거 안하면 저장하고 나올때마다 backup 파일이 생기는 짜증나는 (필요하긴 하지만) 현상을 목격하게 된다.  어쨌거나 이거 됐으면 다음 작업을 진행한다.  역시 .vimrc에 다음과 같은 항목을 추가하여 준다.

set fileencoding=euc-kr
set encoding=cp949

vi에서 한글을 사용하기 위한 설정이다.  이렇게 다 됐으면 저장하고 다시 vi로 아무 c파일이나 짜본다.

#include <stdio.h>

int main (void)
{
  printf ("헬로, 시그윈 월드\n");

  return 0;
}

잘 된다.  하지만 이렇게 하면 vim에서만 한글이 잘 보일뿐, 막상 쉘에서 ls해보면 잘 안나온다.  요것도 수정해야 하는데, 홈 디렉토리에 .bash_profile을 다음과 같은 내용을 추가한다.

alias ls='ls -F --color=auto --show-control-char'

쉘에서 ls를 해도 한글이 무리 없이 잘 나오게 된다.  후아... 이정도 했으면 큰 문제 없이 cygwin을 사용할 수 있을 것 같다.  헌데, 작업하다보면 새로운 terminal을 띄워야 할 때가 있는데 이때마다 마우스로 손이 가는건 상당히 부하가 큰 작업(-_-?)이다.  요거를... 키보드에서만 해결하도록 다음과 같은 alias도 하나 추가한다.

alias rxvtTerm='/cygdrive/c/cygwin/bin/rxvt -tn xterm -rv -sr -sw -bg gray -fg black -sl 1000 -sbt 15 -fn "Dotumche" -e /bin/bash --login -i &'

이러면 그냥 쉘 프롬프트에서 rxvtTerm을 실행시켜서 새로운 xterm 하나를 더 얻을 수 있게 된다.

 

 

CYGWIN SSH 설치

 

< 윈도우 초기 설정 >

- Administarator 계정으로 로그인
- 현재 Administarator 계정과, 다른 User 계정에 Password를 지정해준다.


< CYGWIN 설치 >

- C:\cygwin 폴더를 생성한후, http://www.cygwin.com/ 에서 다운로드 받은 setup.exe 파일을 폴더에 저장한다.
(Cygwin의 setup.exe 파일은 초기 설치 후에도 cygwin package들을 추가하고 삭제하고 재설치 할때 사용된다.)
- setup.exe 파일을 실행시켜 cygwin을 설치한다.

1) 설치 정보 화면
2) Choose A Download Source 화면에서 Install from Internet 선택
3) Select Root Install Directory 화면 에서 Root Directory 는 C:\cygwin 으로 Install For 는 All User 선택, Default Text File Type 은 Unix/Binary 선택
4) Local Package Directory 는 C:\cygwin -> Select Your Internet Connection 은 DirectConnection 선택
5) Select package to install 화면
+ View 버튼을 클릭하면 버튼 옆에 Full 이라고 표시된다.
+ 목록 중에 openssh, tcp_wrappers, diffutils, zlib 패키지 중 New 칼럼에 skip 이라고 표시되있는 상태이면 skip을 클릭하여 설치 상태로 변경한다.

< 시스템 환경 변수 설정 및 기타 설정 >

- 시스템 등록 정보 화면에서 고급탭의 환경 변수 설정
-> 새로운 변수 설정 : 변수 이름 - CYGWIN, 변수 값 - ntsec tty
-> Path 변수 수정 : 뒤에 ;c:\cygwin\bin  를 추가한다.


< Cygwin 설치후, 실행 및 설정 >

- 권한 문제가 발생할 가능성이 있으므로 아래 세 명령어 실행
# chmod +r  /etc/passwd
# chmod +r  /etc/group
# chmod  755  /var

- ssh 설정 스크립트 실행
# ssh-host-config  -y

privilege separation -> yes
create a local user sshd on this machine -> yes
install sshd as a service -> yes
environment variable CYGWIN= ->  ntsec tty

- Windows 사용자 정보와 cygwin좨의 사용자정보를 싱크(중요)
# mkpasswd   -cl   >   /etc/passwd
# mkgroup   --local    >   /etc/group

- ssh 서비스 실행

# net start sshd 
or
# cygrunsrv  --start  sshd

- ssh 서비스 로컬 테스트

#whoami
#ssh    localhost
or
#ssh  -vvv  localhost
or
#ssh    "$USERNAME@127.0.0.1"
(사용자 명이 스페이스가 존재한다면, 스페이스 자리에 \[space]를 대신한다. ex> ab cd -> ab\ cd )

처음 접속시, The authenticity of host '....<xxx.x.x.xx>" can't be established......
라는 문구가 나오는데.. 이는 yes라고 답하고 계속 진행한다.

그리고 명령어 입력 프롬포트가 나타나면 다음과 같이 명령한다.

cd   /cygdrive/c
ls

ls 명령이 정상적으로 수행이 되, 디렉토리와 파일 리스트가 출력되면 정상이다.

- 윈도우(XP SP2 기준) 방화벽 설정 : 제어판 - 보안센터 - Windows 방화벽 - 예외 탭

1) 포트 추가 설정
: 포트추가 화면에서 이름 SSH 포트번호 22 로 설정하고 TCP 선택
2) 프로그램 추가 설정
: 프로그램 추가 설정에서 프로그램 경로를 C:\cygwin\bin\ssh.exe 를 설정

- 원격지에서 접속 테스트

-> 원격지에서 Putty나 기타 클라이언트 프로그램에서 접속 확인
-> 접속이 되지 않을 경우, /etc/hosts.deny, /etc/hosts.allow 파일확인(참조 링크 확인)

예를 들어, 특정IP에게 거절되지 않게 설정하려면,

/etc/hosts.deny 를 편집기로 열어서, 아래의 내용을 추가하면 된다.

ALL:ALL EXCEPT 특정IP:DENY

 

-> 참고사항 : SSHD 가 실행된 이후로, 윈도우의 환경 변수(특히 PATH)를 변경하면 적용되지 않는다.  윈도우 서비스의 SSHD를 재시작하거나, 윈도우를 재시작하면 된다. 

더욱정리가 잘되어있는 사이트는 요아래에 있으니 참고해주세요~~

Cygwin 설치

cygwin이라는 프로그램을 windows에 설치하면 Linux 명령과 bash sell을 사용 할 수 있습니다.
보통 개인적 취향이나 학습의 목적으로 cygwin을 자신의 컴퓨터에 설치하여 사용하고는 하는데,
나아가서 원격머신 흔히 서버로 사용할 머신이 windows 계열일때의 불편을 해소하고자 할 때
이 보다 좋은 방법은 없는듯 합니다.

목차 :
  1. cygwin을 깔면 무얼 할 수 있나?
  2. cygwin 설치 방법
  3. 한글 설정
  4. sshd 띄워 원격에서 접속하기
 
1. cygwin을 깔면 무얼 할 수 있나?
 cygwin이라는 프로그램은 windows에 설치하여 Linux와 같은 환경을 제공합니다.

cygwin을 실행한 모습


위의 그림처럼 cygwin을 실행시키면 Dos창과 비슷한 콘솔이 열리는데, 이것을 이용해서 Unix 명령과 각종 Shell을 실행 시킬 수 있습니다.
물론 이미 설치되어 있는 모든 프로그램의 실행도 가능합니다.  GUI를 갖는 윈도우 프로그램도 포함해서 말이죠.(물론 그렇게 할 필요는 없어 보이지만..)

IT, 특히 개발자로서는 grep, find, tail 명령만으로도 이 프로그램을 사용하는 충분한 이유가 될 수 있을듯 합니다.
Unix 환경에 익숙하지 않은 사람은 이것을 이용해서 학습을 할 수 있을 것이구요.

제가 이와 같이 개인적 성향이나 학습의 가능성을 알리기 위해 이렇게 글 까지 쓰지는 않았을 겁니다. 자기 혼자 사용하는 개인용 PC인 경우라면 grep이나 find가 없어도 알아서 잘들 쓰고 있고, 이런게 있는데 좋으네 마네 설명하고 자시고 할 필요는 없어 보입니다.

그런데, 서버 환경이 Windows인 경우에는 문제가 다릅니다.
원격 서버에서 실행되어야 하는 각종 서버 데몬의 실행과 중단 명령, 원격 서버에 쌓이고 있는 로그파일의 tail, 원격 서버의 CPU, Memory 사용률과 Process List를 확인 하려 할때, 윈도우 원격 데스트탑 연결(mstsc.exe)이나 VNC를 이용해야 하는것은 무척 불편하고 퇴근시간을 늦추는 요인이 됩니다.

CecureCRT로 cygwin을 이용한 ssh 접속모습


cygwin의 sshd를 이용하면 원격에서 telnet과 같이 ssh를 이용하여 모든 콘솔 명령을 이용할 수 있으니 소스적용이나 시스템 모니터링에서 windows와 Unix의 차이를 모르고 작업 할 수 있게 해줍니다.
자 어때요. 이정도면 cygwin 쓸만 한가요? 그렇다면 설치와 환경 설정 방법을 설명해 드릴께요.

2. cygwin 설치 방법
  cygwin을 설치 하기 위해서는 ftp가 열려 있어야 합니다.
금융사 내부에서 인터넷을 할때는 대부분 ftp가 닫혀 있기 때문에 설치 프로그램이 필요한 패키지를 다운로드 하지 못하는 경우가 있읍니다. 이 경우에는 첨부한 설치 프로그램과 패키지를 이용해서 설치해야 합니다.

 가. FPT가 가능하다면 http://www.cygwin.com에 방문하여 설치 프로그램을 다운로드 받습니다.
FTP가 불가능하다면 첨부 파일인 setup.exe를 다운받습니다.

http://www.cygwin.com


 나. 설치 프로그램을 실행하여 평소처럼 "다음"을 눌줍니다.
 

cygwin installer


 다. 만약 FTP가 가능하다면 "Install from Internet"을 선택하고 "다음"을 클릭합니다.
   만약 FTP가 불가능 하다면 "Install from Local Directory"를 선택합니다.

  라. 설치할 경로와 설치 환경을 설정합니다. 왠만하면 그대로 두시면 됩니다.

  마. 패키지 경로를 지정합니다.
   FTP가 가능한 경우는 패키지를 다운받을 경로를 지정하시면 되고,
   FTP가 불가능한 경우는 첨부파일 release.zip을 다운받아 압축해제한 경로를 지정하시면 됩니다.

 바. FTP 접속 방법 선택
  FTP가 불가능한 경우에는 해당 사항 없는 화면입니다.
  FTP로 다운받아 설치하는 경우에 FTP를 어떻게 접속할지를 선택하는 방법입니다.
   어떤걸 선택할 지는 알아서 판단 해야 겠죠.

  사. 다운로드 사이트 선택
   release.zip을 다운받으신 경우에은 마찬가지로 해당 사항 없는 화면입니다.
   어느 미러 사이트에서 받을지 묻는 것인데, ftp://ftp.kaist.ac.kr 가 제일 빠르다고 합니다.

   아. 설치 패키지 선택
   어떤 패키지를 설치 할지 선택하는 것인데요, 이부분은 모두 해당 되는 부분입니다.
    패키지를 설명하고 자시고 할 자신은 없으니 모두 설치를 하십시요.
   이때!! "All Default"라고 되어있는 "Default"를 클릭하여 "Install"로 바꾸시는 것은 매우 중요합니다.
 

  자. 설치 진행 및 종료
    나머지는 굳이 설명 안드리겠습니다. 그냥 놔두면 설치하고 "마침" 클릭하시면 되겠습니다.

 자 이제 생성된 아이콘을 클릭하여 cygwin을 실행하고 Unix 처럼 사용하시면 됩니다.
  
  • C: D: 드라이브 변경은 Dos에서 처럼  "cd c:" , "cd d:" 하시면 되고 /(root) 디렉토리는 cygwin이 설치된 경로, 다시말해 디폴트로 설치했다면 "c:\cygwin" 이 되게 됩니다.
    ~(home) 디렉토는  "c:\document and settings\계정이름" 입니다.

 
3. 한글 설정
cygwin을 설치하고 바로 쓰면 한글 파일명이나 디렉토리명이 물음표(?)로 표시되고, 한글 입력도 잘 되지 않습니다. 그래서 설치 후 한글 설정 작업이 필요합니다.

 가. c:\cygwin\Cygwin.bat 파일을 노트패드로 열어 굵은 글씨로 된 문장을 추가 합니다.
... 생략
set CYGWIN=tty

bash --login -i

 나. cygwin콘솔에서 vi로  ~/.bashrc 열어 아래 내용을 맨 아래에 넣습니다.
alias ls='ls -ahF --color=tty --show-control-char'
 그 밖에 alias를 추가 하거나 수정하셔도 됩니다.

다. cygwin 콘솔에서 vi로 ~/.inputrc 를 열어 아래 내용을 맨 아래에 추가합니다.
set meta-flag on
set convert-meta off
set output-meta on

자. 이제 한글 입/출력도 잘 될것입니다.
로칼에서만 사용하실 꺼라면 이대로 잘 사용하시면 됩니다.


4. sshd 설정하여 원격에서 접속하기
  가. 환경변수 설정
 내컴퓨터 아이콘의 속성을 선택해서 "시스템 등록정보" 창을 열어 봅니다.
"고급" 탭의  "환경변수"를 클릭하여 환경변수를 추가합니다.

저장할 변수내용은 다음과 같습니다.
CYGWIN=ntsec tty

    나. cygwin 콘솔에서 다음 명령을 실행합니다.
 
ssh-host-config
CYGWIN=ntsec tty

  다. cygwin 콘솔에서 sshd 데몬을 실행합니다.
cygrunsrv --start sshd
 
이와 같이 하고 나면 윈도우 서비스에 sshd 가 추가 되어 실행되고 있는 것을 확인 할수 있습니다.


라. ssh 접속

 Putty 또는 SecureCRT와 같은 ssh를 지원하는 콘솔 프로그램을 이용해서 원격에서 접속해 봅니다. 
 계정은 windows 로그인 계정과 같습니다. 대부분 Administrator 이겠죠.


자 이제 윈도우 시스템을 원격에서도 Unix와 같이 사용해서 퇴근 시간이 빨라지길 바랍니다.
X를 띄워 쓰는 분도 있으니 더 쓸모 있는 방법이 있지 않알까 생각도 됩니다.

 

Cygwin 설치

cygwin이라는 프로그램을 windows에 설치하면 Linux 명령과 bash sell을 사용 할 수 있습니다.
보통 개인적 취향이나 학습의 목적으로 cygwin을 자신의 컴퓨터에 설치하여 사용하고는 하는데,
나아가서 원격머신 흔히 서버로 사용할 머신이 windows 계열일때의 불편을 해소하고자 할 때
이 보다 좋은 방법은 없는듯 합니다.

목차 :
  1. cygwin을 깔면 무얼 할 수 있나?
  2. cygwin 설치 방법
  3. 한글 설정
  4. sshd 띄워 원격에서 접속하기
 
1. cygwin을 깔면 무얼 할 수 있나?
 cygwin이라는 프로그램은 windows에 설치하여 Linux와 같은 환경을 제공합니다.

cygwin을 실행한 모습


위의 그림처럼 cygwin을 실행시키면 Dos창과 비슷한 콘솔이 열리는데, 이것을 이용해서 Unix 명령과 각종 Shell을 실행 시킬 수 있습니다.
물론 이미 설치되어 있는 모든 프로그램의 실행도 가능합니다.  GUI를 갖는 윈도우 프로그램도 포함해서 말이죠.(물론 그렇게 할 필요는 없어 보이지만..)

IT, 특히 개발자로서는 grep, find, tail 명령만으로도 이 프로그램을 사용하는 충분한 이유가 될 수 있을듯 합니다.
Unix 환경에 익숙하지 않은 사람은 이것을 이용해서 학습을 할 수 있을 것이구요.

제가 이와 같이 개인적 성향이나 학습의 가능성을 알리기 위해 이렇게 글 까지 쓰지는 않았을 겁니다. 자기 혼자 사용하는 개인용 PC인 경우라면 grep이나 find가 없어도 알아서 잘들 쓰고 있고, 이런게 있는데 좋으네 마네 설명하고 자시고 할 필요는 없어 보입니다.

그런데, 서버 환경이 Windows인 경우에는 문제가 다릅니다.
원격 서버에서 실행되어야 하는 각종 서버 데몬의 실행과 중단 명령, 원격 서버에 쌓이고 있는 로그파일의 tail, 원격 서버의 CPU, Memory 사용률과 Process List를 확인 하려 할때, 윈도우 원격 데스트탑 연결(mstsc.exe)이나 VNC를 이용해야 하는것은 무척 불편하고 퇴근시간을 늦추는 요인이 됩니다.

CecureCRT로 cygwin을 이용한 ssh 접속모습


cygwin의 sshd를 이용하면 원격에서 telnet과 같이 ssh를 이용하여 모든 콘솔 명령을 이용할 수 있으니 소스적용이나 시스템 모니터링에서 windows와 Unix의 차이를 모르고 작업 할 수 있게 해줍니다.
자 어때요. 이정도면 cygwin 쓸만 한가요? 그렇다면 설치와 환경 설정 방법을 설명해 드릴께요.

2. cygwin 설치 방법
  cygwin을 설치 하기 위해서는 ftp가 열려 있어야 합니다.
금융사 내부에서 인터넷을 할때는 대부분 ftp가 닫혀 있기 때문에 설치 프로그램이 필요한 패키지를 다운로드 하지 못하는 경우가 있읍니다. 이 경우에는 첨부한 설치 프로그램과 패키지를 이용해서 설치해야 합니다.

 가. FPT가 가능하다면 http://www.cygwin.com에 방문하여 설치 프로그램을 다운로드 받습니다.
FTP가 불가능하다면 첨부 파일인 setup.exe를 다운받습니다.

http://www.cygwin.com


 나. 설치 프로그램을 실행하여 평소처럼 "다음"을 눌줍니다.
 

cygwin installer


 다. 만약 FTP가 가능하다면 "Install from Internet"을 선택하고 "다음"을 클릭합니다.
   만약 FTP가 불가능 하다면 "Install from Local Directory"를 선택합니다.

  라. 설치할 경로와 설치 환경을 설정합니다. 왠만하면 그대로 두시면 됩니다.

  마. 패키지 경로를 지정합니다.
   FTP가 가능한 경우는 패키지를 다운받을 경로를 지정하시면 되고,
   FTP가 불가능한 경우는 첨부파일 release.zip을 다운받아 압축해제한 경로를 지정하시면 됩니다.

 바. FTP 접속 방법 선택
  FTP가 불가능한 경우에는 해당 사항 없는 화면입니다.
  FTP로 다운받아 설치하는 경우에 FTP를 어떻게 접속할지를 선택하는 방법입니다.
   어떤걸 선택할 지는 알아서 판단 해야 겠죠.

  사. 다운로드 사이트 선택
   release.zip을 다운받으신 경우에은 마찬가지로 해당 사항 없는 화면입니다.
   어느 미러 사이트에서 받을지 묻는 것인데, ftp://ftp.kaist.ac.kr 가 제일 빠르다고 합니다.

   아. 설치 패키지 선택
   어떤 패키지를 설치 할지 선택하는 것인데요, 이부분은 모두 해당 되는 부분입니다.
    패키지를 설명하고 자시고 할 자신은 없으니 모두 설치를 하십시요.
   이때!! "All Default"라고 되어있는 "Default"를 클릭하여 "Install"로 바꾸시는 것은 매우 중요합니다.
 

  자. 설치 진행 및 종료
    나머지는 굳이 설명 안드리겠습니다. 그냥 놔두면 설치하고 "마침" 클릭하시면 되겠습니다.

 자 이제 생성된 아이콘을 클릭하여 cygwin을 실행하고 Unix 처럼 사용하시면 됩니다.
  
  • C: D: 드라이브 변경은 Dos에서 처럼  "cd c:" , "cd d:" 하시면 되고 /(root) 디렉토리는 cygwin이 설치된 경로, 다시말해 디폴트로 설치했다면 "c:\cygwin" 이 되게 됩니다.
    ~(home) 디렉토는  "c:\document and settings\계정이름" 입니다.

 
3. 한글 설정
cygwin을 설치하고 바로 쓰면 한글 파일명이나 디렉토리명이 물음표(?)로 표시되고, 한글 입력도 잘 되지 않습니다. 그래서 설치 후 한글 설정 작업이 필요합니다.

 가. c:\cygwin\Cygwin.bat 파일을 노트패드로 열어 굵은 글씨로 된 문장을 추가 합니다.
... 생략
set CYGWIN=tty

bash --login -i

 나. cygwin콘솔에서 vi로  ~/.bashrc 열어 아래 내용을 맨 아래에 넣습니다.
alias ls='ls -ahF --color=tty --show-control-char'
 그 밖에 alias를 추가 하거나 수정하셔도 됩니다.

다. cygwin 콘솔에서 vi로 ~/.inputrc 를 열어 아래 내용을 맨 아래에 추가합니다.
set meta-flag on
set convert-meta off
set output-meta on

자. 이제 한글 입/출력도 잘 될것입니다.
로칼에서만 사용하실 꺼라면 이대로 잘 사용하시면 됩니다.


4. sshd 설정하여 원격에서 접속하기
  가. 환경변수 설정
 내컴퓨터 아이콘의 속성을 선택해서 "시스템 등록정보" 창을 열어 봅니다.
"고급" 탭의  "환경변수"를 클릭하여 환경변수를 추가합니다.

저장할 변수내용은 다음과 같습니다.
CYGWIN=ntsec tty

    나. cygwin 콘솔에서 다음 명령을 실행합니다.
 
ssh-host-config
CYGWIN=ntsec tty

  다. cygwin 콘솔에서 sshd 데몬을 실행합니다.
cygrunsrv --start sshd
 
이와 같이 하고 나면 윈도우 서비스에 sshd 가 추가 되어 실행되고 있는 것을 확인 할수 있습니다.


라. ssh 접속
 Putty 또는 SecureCRT와 같은 ssh를 지원하는 콘솔 프로그램을 이용해서 원격에서 접속해 봅니다.

 계정은 windows 로그인 계정과 같습니다. 대부분 Administrator 이겠죠.


자 이제 윈도우 시스템을 원격에서도 Unix와 같이 사용해서 퇴근 시간이 빨라지길 바랍니다.
X를 띄워 쓰는 분도 있으니 더 쓸모 있는 방법이 있지 않알까 생각도 됩니다.

 

 

한글사용을 위해 아래의 파일의 내용을 확인하여 추가 및 수정한다.

 

.bash_profile

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

# source the users bashrc if it exists
if [ -f "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
        INPUTRC=/etc/inputrc
fi

#export PS1='[\u@\h \w]\$ '
export PS1='[\w]\$ '

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

 

.bashrc

--------------------------------------------------------------------------------
# Some shortcuts for different directory listings
# alias ls='ls -hF --color=tty'                 # classify files in colour
 alias ls='ls --color=tty --show-control-char'
 alias dir='ls --color=auto --format=vertical'
 alias vdir='ls --color=auto --format=long'
 alias ll='ls -l'                              # long list
 alias la='ls -A'                              # all but . and ..
 alias l='ls -CF'                              #

if [[ "${COLORTERM}" == "rxvt-xpm" || "${TERM}" == "cygwin" ]]; then
  #export LANG=ko_KR
  export LANG=ko_KR.eucKR
  #export LANG=C.eucKR
  #export LANG=ko_KR.UTF-8
fi
--------------------------------------------------------------------------------

 

.inputrc

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

# equivalent to "\C-?": delete-char
"\e[3~": delete-char

# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# kvt
"\e[H": beginning-of-line
"\e[F": end-of-line

# rxvt and konsole (i.e. the KDE-app...)
"\e[7~": beginning-of-line
"\e[8~": end-of-line

# VT220
"\eOH": beginning-of-line
"\eOF": end-of-line

# Allow 8-bit input/output
set meta-flag on
set convert-meta off
set input-meta on
set output-meta on
--------------------------------------------------------------------------------

 

.minttyrc

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

Font=Fixedsys
BoldAsFont=no
Locale=ko_KR
Charset=eucKR
--------------------------------------------------------------------------------

 

.profile

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

# Set user-defined locale
export LANG=$(locale -uU)

# This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login
# exists.
#
# if running bash
if [ -n "${BASH_VERSION}" ]; then
  if [ -f "${HOME}/.bashrc" ]; then
    source "${HOME}/.bashrc"
  fi
fi
--------------------------------------------------------------------------------

 

Posted by iWithJoy
Linux/CentOS2012. 10. 10. 11:19

yum command sample (install, Uninstall,Update .. )

 

1.  패키지설치 (yum install)

[root@www ~]# yum -y install java-1.6.0-openjdk.i386


2.  패키지 삭제하기 (yum remove)

[root@www ~]# yum -y  remove java-1.6.0-openjdk.i386

 

3. 패키지 업데이트 (yum update)

[root@www ~]# yum update java-1.6.0-openjdk.i386

 

4. 패키지 찾기 (yum search)

[root@www ~]# yum search java

 

5. 패키지 정보 확인하기 (yum info)

[root@www ~]# yum info kernel


6. 설치 가능한 패키지 전체 리스트보기

[root@www ~]# yum list | less

 

7. 설치된 패키지 리스트 보기

[root@www ~]# yum list installed | less

 

8. 패키지그룹 설치하기

[root@www ~]# yum -y groupinstall "Development Tools"

 

9. 패키지그룹 업데이트

[root@www ~]# yum groupupdate "Development Tools"

 

10. 패키지그룹 삭제하기

[root@www ~]# yum groupremove "Development Tools"

 

'Linux > CentOS' 카테고리의 다른 글

집 컴퓨터를 웹서버로 만들기  (0) 2013.09.16
CentOS 6.4(x86 64Bit) 웹서버 설치  (0) 2013.09.15
BackupPC for CentOS  (0) 2012.10.09
아파치 모듈 mod_rewrite 설정  (0) 2012.09.13
CentOS Iptables 방화벽 포트 OPEN  (0) 2012.09.07
Posted by iWithJoy
Linux/CentOS2012. 10. 9. 11:41

backuppc 를 이용한 백업구성.

참고:  http://wiki.centos.org/HowTos/BackupPC

 
== 서버 설정.
* 백업서버에 backuppc 설치.
  o TEST repo 추가.
 # cd /etc/yum.repos.d
 # wget http://dev.centos.org/centos/6/testing/CentOS-Testing.repo

 # yum install yum-priorities
 
  o BackupPC 설치

   # yum --enablerepo=c6-testing install httpd (주의! 기존에 Apache를 이용하여 홈페이지를 운영 중인 웹서버라면, httpd를 설치 금지) 
   # yum --enablerepo=c6-testing install mod_perl

   주요설치모듈 
      httpd-2.2.8-1.el5s2.centos.i386.rpm
      mod_perl.i386 2.0.4-6.el5 (기존에 설치되어 있음)

http://www.centos.org/modules/newbb/viewtopic.php?topic_id=39424&forum=55&post_id=171289#forumpost171289

참고하여,

http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/repoview/epel-release.html

에서

epel-release-6-7.noarch 를 다운로드 받아서

# rpm -Uvh epel-release-6-7.noarch.rpm

을 수행하고,

# yum install BackupPC

를 실행하여 설치하면 된다.

 


  o Apache 설정
 # vim /etc/httpd/conf/httpd.conf
또는
# vim /usr/local/apache/conf/httpd.conf (설치에 따라 위치 상이)
 ## Change User apache to User backuppc
 User backuppc
 ServerName backuppc.domain.com:80   

 # vim /etc/httpd/conf.d/BackupPC.conf
 ## Change Allow from 127.0.0.1 to all
 Allow from all

 # htpasswd -c /var/lib/backuppc/passwd/htpasswd your_user   <--admin
 New password: your_password
 Re-type new password: your_password
 Adding password for user your_user

 # service httpd start
 # chkconfig httpd on

  o 웹인터페이스 접속 :  http://localhost  접속하여 apache 설정오류 확인.. 접속되면 OK
 
  o BackupPC Main config 설정.
 # vim /etc/BackupPC/config.pl
 
 ## Default transfer method BackupPC uses.
 $Conf{XferMethod} = 'rsync';
 
 ## Path to where actual backup data is stored.
 $Conf{TopDir}      = '/var/lib/backuppc';
 
 ## Path to init.d which is used to to start server.
 $Conf{ServerInitdPath} = '/etc/init.d/backuppc';
 $Conf{ServerInitdStartCmd} = '$sshPath -q -x -l root $serverHost$serverInitdPath start';
 
 ## Allowed user that you created using htpasswd.
 $Conf{CgiAdminUsers}     = 'your_user';   <-- admin


  o sudo 설정.
 # visudo
 
 ## Comment out Defaults requiretty
 ## Add the following two lines.
 Defaults !lecture
 backuppc ALL=NOPASSWD:/bin/gtar,/bin/tar

  o httpd, backuppc  restart
 # service httpd restart
 # service backuppc start
 # chkconfig backuppc on

  o 웹 접속 확인  :  http://serverip/backuppc  접속하여 로그인(admin)되면 OK
 
  o SSH Key 설정 : 원격서버 접속(rsync 등)을 위해서.
 # cd /var/lib/backuppc
 # mkdir .ssh
 # chown backuppc.backuppc .ssh
 # chmod 700 .ssh

 # su -s /bin/bash backuppc
 bash-3.2$ ssh-keygen -t dsa
 
 Generating public/private dsa key pair.
 Enter file in which to save the key (/var/lib/backuppc/.ssh/id_dsa):
 Enter passphrase (empty for no passphrase):      <--공백을 입력해야 원격서버 접속시 요청을 안함.
 Enter same passphrase again:
 Your identification has been saved in /var/lib/backuppc/.ssh/id_dsa.
 Your public key has been saved in /var/lib/backuppc/.ssh/id_dsa.pub.
 The key fingerprint is:
 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx backuppc@host.domain.name

 bash-3.2$ ssh-copy-id -i .ssh/id_dsa.pub root@host_to_backup   <--클라이언트 IP
 bash-3.2$ ssh root@host_to_backup    --> 원격서버 접속 확인. 최초한번 패스워드를 요청함.


  o 웹에서 백업을 수행할 사용자 등록 : backupuser
 # htpasswd  /var/lib/backuppc/passwd/htpasswd backupuser   <--admin
 
 
== 백업client(원격서버) 설정.
* 가정 : client 설정 : linux, 10.10.10.44

* 웹인터페이스에서 hosts 추가 : http://serverid/backuppc   (admin/xxxxx)
  o 메뉴위치 : 좌측하단의 "Edit Hosts" 클릭  우측의 add 버튼
   - host : 원격서버(client) hostname
   - user : 웹인터페이스에서 담당할 계정  (backupuser)
   

== 백업 client(원격서버) 설정 : windows, rsyncd 방식
* 윈도우용 cygwin-rsyncd  데몬 다운로드 :
   http://sourceforge.net/projects/backuppc/files/latest/download  
   rsync 적용시 한글파일명지원을 위하여 필요시 cygwin1.dll을 패치를 해야하는 경우가 있다.
    http://isulnara.com/tt/161
  
* 압축을 해제한후 c:\rsyncd 폴더에 복사함.
 o rsyncd.conf 설정
 use chroot = false
 max connections = 4
 log file = c:/rsyncd/rsyncd.log
 pid file = c:/rsyncd/rsyncd.pid
 lock file = c:/rsyncd/rsyncd.lock
 
 [backuppc]
   path = d:\xxxx
   comment = user comment
   auth user = backupuser
   secrets file = c:/rsyncd/rsyncd.secrets
   # hosts allow = 172.16.0.17
   strict modes = true
   read only = true
   list = false
  o rsyncd.secrets 에 사용자 IP:PW 설정.
    backupuser:xxxxxxx
   
  o rsync 서비스 시작 : xinet 도는 inetd
   
  o 웹인터페이스에서 hosts 추가 : http://serverid/backuppc   (admin/xxxxx)
   - 메뉴위치 : 좌측하단의 "Edit Hosts" 클릭  우측의 add 버튼
      host : 원격서버(client) hostname
      user : 웹인터페이스에서 담당할 계정  (backupuser)
  o 웹인터페이스에서 좌측상단의 hosts 를 선택하여 개별사항설정하기.
   - Edit Config > Xfer
     XferMethod : rsyncd
     RsyncShareName : backuppc
     RsyncdUserName : backupuser
     rsyncdPasswd : your_password
     Save 버튼 클릭.
   - Edit Config > Backup Settings
     ClientNameAlias : 실제IP를 입력함.
     Save 버튼 클릭.
    
    
    
== 참고사항 ==
* smb 방식에서
 o window 파일 SMB방식으로 백업수행시 tree connect failed: NT_STATUS_ACCESS_DENIED 메세지 발생시
   Got fatal error during xfer (No files dumped for share xxxx)
  - Xfer 메뉴의 SmbClientFullCmd 파라미터에 "-N" 파라미터를 제거하거나
    또는 "-U $userName -N" 제거후 시도해 본다.
    http://www.mail-archive.com/backuppc-users@lists.sourceforge.net/msg12207.html
    https://bugs.launchpad.net/ubuntu/+source/backuppc/+bug/283652
   
    smb : http://wiki.kldp.org/wiki.php/LinuxdocSgml/SMB-HOWTO
   
   
* cygwin-rsyncd download :: http://sourceforge.net/projects/backuppc/files/   2009.08.10 현재 2.6.8_0   


* samba 사용법
  http://int.hcc.ac.kr/~swnam/%B0%AD%C0%C7%C0%DA%B7%E1/%B8%AE%B4%AA%BD%BA/07.%B8%AE%B4%AA%BD%BA_Samba.ppt#332,37,사용자별 공유폴더 사용하기
 
 
* mssql2000 백업방법...
http://sqler.pe.kr/sql2k/102.asp

 

==== sun pkg install
http://www.sunfreeware.com/pkg-get.html
pkg-get -U   <--처음한번.
=====================


# pkg-get -u rsync

# vi /etc/services 파일에 다음추가
  rsync 873/tcp  # rsync
 
# vi /etc/inetd.conf   아래추가
    rsync stream tcp nowait root /usr/local/bin/rsync rsyncd --daemon
   
# vi /etc/rsyncd.conf  파일생성
use chroot = false
max connections = 4

log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock

[www]
    path = /home/www
    comment = webserver1
    uid = nobody
    gid = nobody
    read only = yes
    ###hosts allow = 10.10.
    timeout = 600
    list = false
    strict modes = false
    auth users = backupuser

    secrets file = /etc/rsyncd.secrets
   

# vi /etc/rsyncd.secrets   생성
  backupuser:yourpassword
  
 
# ps -ef | grep inetd
# kill -HUP inetd_pid  
# netstat -an | grep 873    <-- 포트오픈 확인.

 

 

=== rsync  For HP-UX ===

http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/rsync-3.0.6/

 

 

=== iis 백업하기 ==

iis backup :: http://blog.naver.com/saint7710?Redirect=Log&logNo=10040107329
cd c:\windoes\system32
백업 :: iisback /backup /b 백업으로저장될이름
리스트보기 :: iisback /list
복구하기 :: iisback /restore /b 백업된이름 /v 1

 

 

=== 백업내용제거시 ===
su -s /bin/bash backuppc
/usr/bin/BackupPC_nightly 0 150

 

=== troubleshoting == 
su -s /bin/bash backuppc 
BackupPC_dump -v -f hostname

 

참고
http://wiki.qnap.com/wiki/How_to_install_the_BackupPC_application

'Linux > CentOS' 카테고리의 다른 글

CentOS 6.4(x86 64Bit) 웹서버 설치  (0) 2013.09.15
리눅스 yum 명령어  (0) 2012.10.10
아파치 모듈 mod_rewrite 설정  (0) 2012.09.13
CentOS Iptables 방화벽 포트 OPEN  (0) 2012.09.07
Wowza Media Server 설치  (0) 2012.09.07
Posted by iWithJoy
Linux/CentOS2012. 9. 13. 11:00

발단은 퍼마링크(permalink:  permanent link, 고유링크) 접속이 불가하여 확인하던 중에 mod_rewrite 설정이 필요했다.

 

1)mod_rewrite이 설치되어 있는지 확인해보자
- 아파치 설정 파일에 다음 라인이 있는지 확인하고 없다면 적고 저장한다
LoadModule rewrite_module modules/mod_rewrite.so
- 아파치 재시작
/etc/init.d/httpd restart
- index.php에 <? phpinfo(); ?> 를 코딩하고 DocumentRoot로 지정된 디렉토리에 저장하자
- 웹브라우저로 index.php 확인하자
apache2handler Loaded Modules 항목에 mod_rewrite이 보이면
이미 rewrite 모듈이 설치된 것이다

 

2)
DocumentRoot로 지정된 디렉토리에(/var/www/html) cloth/freece라는 이름의 하위 디렉토리들을 만들고
# mkdir -p /var/www/html/cloth/freece
그 아래에 123.html 파일을 저장하자
# cd /var/www/html/cloth/freece
# touch 123.html

3)
/var/www/html에 .htaccess 파일을 생성하고 다음을 적어주자
RewriteRuleEngine on
RewriteRule /products/([0-9]+) /products/freece/$1
RewriteRule의 기본 형식은 다음과 같다
RewriteRule Pattern Substitution [Flag(s)]
[0-9]+는 숫자가 하나 이상 있음을 의미한다
예)아래와 같은 형태의 파일이 매칭된다

http://localhost/products/123.html

http://localhost/products/4323.html

http://localhost/products/43374823.html

소괄호로 감싼 부분은 태그를 부여하는 것이다 뒤에서 $1로 참조할 수 있다
 
4)
.htaccess 파일을 사용하기 위해서 /etc/httpd/conf/httpd.conf의 다음 부분을 수정하자
<Directory /var/www/html>
    AllowOverride ALL #원래는 None인데 ALL로 수정하자
</Directory>
설정을 변경했으니 아파치 재시작한다
/etc/init.d/httpd restart

 

5)

테스트를 해볼 차례다
/var/www/html에 test.html을 만들고 다음을 저장하자
<html>
    <head>
        <title>example</title>
    </head>
<body>
<p>
<a href="http://192.168.0.3/products/123.html">test</a>
</p>
</body>
</html>
웹브라우저 주소창에 http://192.168.0.3/test.html을 입력하고 test라는 링크를 클릭하면
http://192.168.0.3/products/123.html 페이지 대신에 http://192.168.0.3/cloth/freece/123.html 페이지가 로드된다

 

6) 
웹서버에 존재하지도 않는 http://192.168.0.3/products/123.html을 주소창에 입력해도
http://192.168.0.3/cloth/freece/123.html로 리다이렉트되기 때문에
오류없이 http://192.168.0.3/cloth/freece/123.html 페이지를 볼 수 있게 된다 

mod_rewrite에 대해서 쉽게 설명한 웹사이트
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
http://www.sitepoint.com/article/guide-url-rewriting/2/

출처: http://blog.naver.com/timberx/30040695435

 

 

 

apache 서버에서 mod_rewrte 가 동작 하도록 설정하기

 

rewrite 모듈은 설치가 되어 있다는 것을 가정한다.

 

httpd.conf 에서

 

DocumentRoot "C:/webroot"
<Directory "C:/webroot">
   Options Includes ExecCGI FollowSymLinks
    AddHandler cgi-script .cgi .pl
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

 

 

AllowOverride  All 이걸 해줘야 웹루트의 .htaccess 파일에 있는 rewrite rule 이 동작한다.

None 로 해두면 무시 된다.

 

Options FollowSymLinks 이 부분도 있어야 동작한다.

 

.htaccess

 

파일에

 

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

 

이렇게 넣어두면

 

http://localhost/users => http://localhost/index.php?url=users 로 맵핑된다.

 

'Linux > CentOS' 카테고리의 다른 글

리눅스 yum 명령어  (0) 2012.10.10
BackupPC for CentOS  (0) 2012.10.09
CentOS Iptables 방화벽 포트 OPEN  (0) 2012.09.07
Wowza Media Server 설치  (0) 2012.09.07
CentoOS DSS(Darwin Streaming Server) 설치  (0) 2012.09.07
Posted by iWithJoy
Linux/CentOS2012. 9. 7. 15:02

CentOS 에서는 Install을 하는경우 자동적으로 Iptables 방화벽이 설치되는 것 같다.

 

그럼 우선 설치다하고 나서 WAS , MYSQL 등등의 Setting 후 외부에서 접속하는 방법에 대해서 알아보자.

 

[1] 방화벽 설정파일은 어디있는가?

아래 경로를 보면 방화벽 설정파일을 열어볼 수가 있다.

 # vim /etc/sysconfig/iptables

 

[2] 설정파일을 대충 파악하자.

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

 

(노랑색) 위 설정을 보면 22번 sshd port가 현재 열려있는것을 확인가능하다.

(파랑색) 또한 22번 이외의 다른 것들은 모두 막아라 라는 코드가 있다.

 

그럼 3306,21,80 포트를 를 추가하여 보자.

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 

 

위 처럼 포트를 추가하고 저장한다음 잘 추가되었는지 보도록 하자.

 

단!! 주의사항은 위 파랑색으로 된 -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

요코드드는 삭제한 후에 해야 한다 그럼 다음과 같이 되겠죠?

 

 

 # Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

COMMIT

 

자 , 이제 iptables가 잘 적용이 되었는지 확인해 보도록 하자.

 

 

[root@localhost sysconfig]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http

[root@localhost sysconfig]# 

 

위 보는바와 같이 적용이 잘 되었다. 이제 데몬을 재시작 하도록 하자.

 

 # /etc/init.d/iptables restart

 

 

다시 이제 방화벽을 적용해야 한다, 아까 위에서 빼버린 코드를 넣고 다시금 재시작 하도록 한다.

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited 코드 추가함

 

최종 적으로 , 다시 iptables -L 명령어를 통해 보도록 하자.

 

 

[root@localhost sysconfig]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

 

위 코드에서 보듯이 다시금 reject를 통해서 방화벽이 추가된 것을 확인할 수 있따.

 

이상이 IPTABLES의 PORT를 여는 방법에 대해서 서술 하였다.

 

출처: http://srzero.tistory.com/125

'Linux > CentOS' 카테고리의 다른 글

BackupPC for CentOS  (0) 2012.10.09
아파치 모듈 mod_rewrite 설정  (0) 2012.09.13
Wowza Media Server 설치  (0) 2012.09.07
CentoOS DSS(Darwin Streaming Server) 설치  (0) 2012.09.07
부팅 시에 네트워크 자동 시작  (0) 2012.09.05
Posted by iWithJoy
Linux/CentOS2012. 9. 7. 09:41

와우자 미디어서버로 모든 스트리밍 서비스를 하려고 합니다.

현재 cafe24에서 테라서버 호스팅을 이용중에 있습니다.
곰인코더를 통해 mp4로 해당 영상을 변환하고 ftp로 업로드 후
jwplayer를 통해 홈페이지에서 동영상을 서비스하고 있는 형태입니다.

이렇게 했을때 문제가 발생하는데 제가 겪고 있는 가장 큰 애로는 아래 두 가지입니다.
1. 멀티디바이스 서비스 애로
2. 트래픽 가중

1. 멀티디바이스 서비스의 경우 코딩을 통해 어느정도 해결이 가능할거 같은데
    솔직히 실력이 안돼서라고 말하지만, 귀찮아서 안한다고로 버티는 중이구요.
2. 트래픽 가중은 좀 심각한 상황입니다.
    한달에 트래픽이 약 1테라 정도 발생하는데 가끔씩 약정 트래픽에 오버되어 추가 비용이 발생하는 상황이죠.
    유저가 홈페이지를 통해 동영상을 볼때 해당 페이지를 빠져나가거나 재생중지를 하는 경우
    스트리밍도 중단이 되어야 하는데, 너무나 착실하게 다운로드를 하니까 이런 문제가 발생하는 듯합니다.

그리하여 와우자 미디어 서버(Wowza media server를 설치하여 위 두가지의 문제점을
해결하고자 합니다.

cafe24 테라서버의 경우 CentOs 5.5 버전이 설치되어 있습니다.

먼저 jdk를 설치해야 하는데요.
http://gauryan.blogspot.kr/2011/04/centos-jdk.html  이곳을 참고하면 쉽게 설치가 가능합니다.

내용은 아래와 같고요. 링크를 통해 확인 가능합니다.

CentOS에서 JDK 설치하기

CentOS에서 JDK를 설치하려면, 내장 패키지인 OpenJDK 를 설치하면 아주 쉽게 된다. 물론 Oracle 에서 다운로드 받아서 해도 되지만, 쉬운 방법이 있으니 그냥 쉽게 하자. OpenJDK도 특별히 문제 없고, 대부분 리눅스 배포판에서도 지원하고 있으니, 맘 놓고 사용하면 될 것 같다.


  • OpenJDK 패키지 확인/설치
    # yum list all | grep jdk
    gnu-crypto-sasl-jdk1.4.i386 2.1.0-2jpp.1 base
    java-1.6.0-openjdk.i386 1:1.6.0.0-1.16.b17.el5 updates
    java-1.6.0-openjdk-demo.i386 1:1.6.0.0-1.16.b17.el5 updates
    java-1.6.0-openjdk-devel.i386 1:1.6.0.0-1.16.b17.el5 updates
    java-1.6.0-openjdk-javadoc.i386 1:1.6.0.0-1.16.b17.el5 updates
    java-1.6.0-openjdk-src.i386 1:1.6.0.0-1.16.b17.el5 updates
    ldapjdk.i386 4.18-2jpp.3.el5 base
    ldapjdk-javadoc.i386 4.18-2jpp.3.el5 base
    mockobjects-alt-jdk1.4.i386 0.09-14jpp.3 base
    mockobjects-jdk1.4.i386 0.09-14jpp.3 base



    # yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel
  • Java 버전을 확인해본다.
    # javac -versionjavac 1.6.0_17# java -version
    java version "1.6.0_17"
    OpenJDK Runtime Environment (IcedTea6 1.7.5) (rhel-1.16.b17.el5-i386)
    OpenJDK Client VM (build 14.0-b16, mixed mode)

이제 와우자홈페이지 (www.wowza.com)에서 해당 프로그램을 다운받아 설치해보자.
저는 여기서 (http://www.wowza.com/pricing/installer) Linux RPM버전을 다운받아
설치했습니다. 

설치방법은 아래와 같습니다.
sudo chmod +x WowzaMediaServer-3.1.2.rpm.bin
sudo ./WowzaMediaServer-3.1.2.rpm.bin

 
설치방법은 와우자 포럼페이지에서도 확인가능합니다. - 쭈욱 훑어보시기 바랍니다.
http://www.wowza.com/forums/content.php?217#installWowza

 


설치는 간단합니다.

약관(?)을 다 읽고 yes만 쳐주면 1분도 되지 않아 설치가 다 됩니다.

설치후에는 라이센스 키를 입력해야하는데 화면에 나와있듯이 /usr/local/WowzaMediaServer/bin에서
./startup.sh를 실행하면 라이센스 키를 입력하라는 화면이 나옵니다.

*라에센스 키 받는법.
1. 산다.
2. Trial키를 받는다.- 30일짜리
3. Developer 키를 받는다. - 180일짜리

메일주소를 비롯한 기본 정보를 넣고 신청하면 메일로 옵니다.
그걸 ./startup.sh 를 실행했을때 입력하면 됩니다.

 


해당라이센스키를 입력하면 위의 그림처럼 와우자 미디어 서버가 시작되었다는 메세지가 뜹니다.
근데 이렇게 계속하면 안되구요.

Starting and Stopping the Server (System Service) 방식으로 저는 했습니다.
두 번째 방법(진한글씨)으로 했습니다.

service WowzaMediaServer start

or


/etc/init.d/WowzaMediaServer start


or


/sbin/service WowzaMediaServer start


이렇게 실행하고 나면 웹페이지에서 제대로 돌아가는지 확인을 해야겠죠.
확인하는 방법은 해당도메인에 1935포트번호를 붙여주면 되죠.
http://www.abc.com:1935/

 

저는 개발자 버전 키를 받아서 내년 2월7일까지 사용이 가능합니다.

*이렇게 1935포트를 이용해서 서버 버전등을 알 수 있는데 이걸 또 비공개화 하는 방법이 있습니다.

 

출처: http://zicman.egloos.com/2953224

출처: http://zicman.egloos.com/2953415

 

 

 

[wowza] 모바일 rtsp링크를 웹에 임베딩 할때

 

윈도우에 미디어 플레이어 임베딩 하는 것 처럼
rtsp 플레이어인 vlc 플레이어를 임베딩 한다
 
<OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8"
codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
width="400" height="300" id="vlc" events="True">
<param name="Src" value="rtsp://[wowza-ip-address]/vod/mp4:sample.mp4" />
<param name="ShowDisplay" value="True" />
<param name="AutoLoop" value="True" />
<param name="AutoPlay" value="True" />
<param name="Volume" value="100">
</OBJECT>
 
 
자세한 내용은 VIDEOLAN 홈페이지를 참고하세요.
 
 
 
 
플레쉬 임베딩시에는 아래 참조
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='640' height='480' id='single1' name='single1'>
<param name='movie' value='http://플레이어위치/player.swf'>
<param name='allowfullscreen' value='true'>
<param name='allowscriptaccess' value='always'>
<param name='wmode' value='transparent'>
<param name='flashvars' value='file=스트림파일&screencolor=EEEEEE&bufferlength=1&streamer=rtmp://서버아이피또는 주소/live&autostart=true'>
</object>

 

출처: http://www.jnetwork.co.kr/bbs/board.php?bo_table=useguide&wr_id=116 

'Linux > CentOS' 카테고리의 다른 글

아파치 모듈 mod_rewrite 설정  (0) 2012.09.13
CentOS Iptables 방화벽 포트 OPEN  (0) 2012.09.07
CentoOS DSS(Darwin Streaming Server) 설치  (0) 2012.09.07
부팅 시에 네트워크 자동 시작  (0) 2012.09.05
사용자 계정 추가  (0) 2012.09.03
Posted by iWithJoy
Linux/CentOS2012. 9. 7. 09:35

모바일 스트리밍 관련 서버가 필요하여서 알아보던중 같은 mp4 파일로 아이폰과 안드로이드에 서비스가 되어 야한다고 하여서 찾아보던중...
iphone은 어차피 http 80 port로 서비스를 그냥 하면되고  android는 http로는 스트리밍 서비스가안되어 rtsp로 서비스를 해야 되야 됐다.

그래서 검색하다 찾은것이 DSS(Darwin Streaming Server)였다. 모 검색한 간단한 설명을 붙이면

 애플사의 퀵타임 스트리밍 서버는 애플의 소스 공개 정책에 따라 윈도우즈와 매킨토시 양쪽을 모두 지원하는 다윈 스트리밍 서버(Darwin Streaming Server) 프로그램이 소스까지 공개되어 있기 때문에 누구든지 무료로 설치하여 사용할 수 있고, 동영상, MP3등의 디지털미디어를 실시간으로 배포하고 라이브 이벤트를 실현시킬 수 있으며, Linux, Solaris, Windows NT/2000 등 가장 대중적인 엔터프라이즈급 플랫폼을 지원합니다.


이 서버 프로그램은 업계 표준 스트리밍 프로토콜인 RTP/RTSP를 지원하며, 음성과 이미지의 고품질으로 인기가 높습니다.
id qtss
# useradd qtss <--- 수행 시에 그룹에 관한 오류가 발생할 경우, 다음과 같은 명령으로 user를 생성한다.

useradd: group qtss exists - if you want to add this user to that group, use -g.
# useradd -g qtss qtss

# id qtss

uid=505(qtss) gid=505(qtss) groups=505(qtss)


# cd /usr/local/src
# wget http://dss.macosforge.org/downloads/DarwinStreamingSrvr6.0.3-Source.tar
# tar xvf DarwinStreamingSrvr6.0.3-Source.tar
# wget http://www.abrahamsson.com/dss-6.0.3.patch
# patch -p0 < dss-6.0.3.patch
# cd DarwinStreamingSrvr6.0.3-Source
# ./buildtarball
# cd DarwinStreamingSrvr-Linux
# ./Install
Installing Darwin Streaming Server

Checking for and Killing currently running Darwin Streaming Server
...(생략)...

characters long
Enter DSS Administrator Username : (Admin Username 입력)

DSS Administrator Password cannot contain spaces, or quotes, either single or double, and cannot be more than 80
characters long
Enter DSS Administrator Password: (패스워드 입력)
Re-enter DSS Administrator Password: (패스 워드 확인)
Adding userName admin
Setup Complete!

 이렇게 진행되었으면 설치는 완료 되것이다.

# netstat -nlp

해보면 아래와 같은 포트가 열려진것을 확인해볼수 있을것이다. 

tcp        0      0 0.0.0.0:8000                0.0.0.0:*                   LISTEN      4273/DarwinStreamin 
tcp        0      0 0.0.0.0:8001                0.0.0.0:*                   LISTEN      4273/DarwinStreamin 
tcp        0      0 0.0.0.0:1220                0.0.0.0:*                   LISTEN      4316/perl           
tcp        0      0 0.0.0.0:554                 0.0.0.0:*                   LISTEN      4273/DarwinStreamin  
tcp        0      0 0.0.0.0:7070                0.0.0.0:*                   LISTEN      4273/DarwinStreamin 
......

 기본영상이 올라가는 기본경로는 
/usr/local/movies
이니 적당한 폴더를 생성하여 사용하는것이 좋을것이다.

 

http://Server주소:1220 으로 접속해 보면 관리 화면으로 접속해 볼수 있을것 이다.

처음 접속하면 새로운 패스워드를 접해주면 되고

80포트 사용이라든지 디렉토리 경로 설정이라든지 SSL 사용 설정을 하게 되고

관리 페이지로 들어가게 될것이다.

여기서 여러가지 설정값을 사용할수 있고

Play list 메뉴에서 영상을 추가해주면된다.

그리고 virtualhosts에서 해당 디렉토리(예 /usr/local/movies)를 설정하여 하여 http와 rtsp가 같은 곳을 바로보게 한다면

소스를 iphone 접속과 android 접속을 구분해 준다면 같은 파일을 가지고 스트리밍 서비스를 할수 있다.

# ps aux
root 23117 0.0 0.0 4348 464 ? Ss 11:38 0:00 /usr/local/sbin/DarwinStreamingServer
qtss 23118 0.0 0.0 46016 2380 ? Sl 11:38 0:00 /usr/local/sbin/DarwinStreamingServer
qtss 23119 0.0 0.1 9628 3908 ? Ss 11:38 0:00 /usr/bin/perl /usr/local/sbin/streamingadminserver.pl


로그인 화면이 나오면 Admin Username 과 Password 입력합니다.

MP3보안에 대한 페이지가 나옵니다.

해당 서버에 OPENSSL이 설치되어 있는 경우에는 보안을 이용한 SSL송신이 가능합니다. 없으면 NEXT

콘텐츠가 위치할 디렉토리를 설정합니다. 디폴트가 편합니다.

출력포트를 80번으로 할것인지 물어봅니다. 그냥 넘어갑니다.

Playlists 목록에 들어가 New Movie Playlist 에서 원하는 파일(기본으로 샘플 파일이 있음) 추가 한 후 저장합니다.

마지막으로 QuickTime Player 실행한 후 URL열기에서
rtsp://해당서버IP/파일이름.mp4 실행하면 완료!!
rtsp://xxx.xxx.xxx.xxx/sample_100kbit.mp4



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


Darwin Streaming Server (DSS) 설치

애플사의 퀵타임 스트리밍 서버는 애플의 소스 공개 정책에 따라 윈도우즈와 매킨토시 양쪽을 모두 지원하는 다윈 스트리밍 서버(Darwin Streaming Server) 프로그램이 소스까지 공개되어 있기 때문에 누구든지 무료로 설치하여 사용할 수 있고, 동영상, MP3등의 디지털미디어를 실시간으로 배포하고 라이브 이벤트를 실현시킬 수 있으며, Linux, Solaris, Windows NT/2000 등 가장 대중적인 엔터프라이즈급 플랫폼을 지원한다.

이 서버 프로그램은 업계 표준 스트리밍 프로토콜인 RTP/RTSP를 지원하며, 음성과 이미지의 고품질으로 인기가 높다.

그럼, 이제 소스를 다운 받아 설치해보자.
소스는 http://developer.apple.com/darwin/projects/streaming/ 에서 구할수 있다.

다운받은 파일을 /usr/local/에 카피한 후 압축을 푼다.


# cp DarwinStreamingSrvr4.1.3-Linux.tar.gz /usr/local/
# cd /usr/local/
# tar xvzf DarwinStreamingSrvr4.1.3-Linux.tar.gz


압축을 푼 파일을 보면 친절하게도 인스톨 파일이 있다. 그럼 인스톨 파일을 실행시킨다.


# ls
3rdPartyAcknowledgements.rtf qtpasswd sample.mp3
AdminHtml qtusers streamingadminserver.pl
DarwinStreamingServer readme.pdf StreamingLoadTool
Install relayconfig.xml-Sample streamingloadtool.conf
MP3Broadcaster sample_100kbit.mov StreamingServerModules
perlpath.pl sample_100kbit.mp4 streamingserver.xml
PlaylistBroadcaster sample_300kbit.mov streamingserver.xml-sample
qtgroups sample_300kbit.mp4
# ./Install
Installing Darwin Streaming Server

Checking for and Killing currently running Darwin Streaming Server
...(생략)...

Installation Complete

Darwin Streaming Server Setup

DSS Administrator Username cannot contain spaces, or quotes, either single or double, and cannot be more than 255
characters long
Enter DSS Administrator Username : (Admin Username 입력)

DSS Administrator Password cannot contain spaces, or quotes, either single or double, and cannot be more than 80
characters long
Enter DSS Administrator Password: (패스워드 입력)
Re-enter DSS Administrator Password: (패스워드 확인)
Adding userName admin
Setup Complete!
#


여기까지 하면 설치는 모두 끝났다.

 

Darwin Streaming Server (DSS) 설정

그럼 이제 DSS(Darwin Streming Server)의 서버 설정을 해보자.

웹브라우져를 띄워서 http://IP_Address:1220 를 입력하자. (1220 포트는 DSS(Darwin Streming Server)의 관리자 페이지 접속을 위한 포트이다.)
로그인 화면이 나오면 지정한 Admin 계정과 패스워드를 넣고 다음으로 넘어가면, MP3 Broadcast를 위한 패스워드 설정이 나온다. 설정을 하고 다음으로 넘어간다.
다음으로 Secure Administration 설정이 나온다. 설정하고 또 넘어간다.
이제 Media Folder 설정이 나온다. 관리를 편하게 하기 위해 media 계정을 생성하고, 계정의 홈 디렉토리를 이용하면 나중에 관리하기 용이하다. 설정을 하였으면 넘어간다.
끝으로 Streaming on Port 80 설정이 나온다. 설정하고 완료한다.

여기까지를 모두 마치면, DSS(Darwin Streming Server) 관리자 페이지가 보일 것이고, 서버상태를 요약한 메인 화면이 보인다.


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


Friday, August 29, 2008

Darwin Streaming Server 6.0.3 on Linux

digg_url="http://cwshep.blogspot.com/2008/08/darwin-streaming-server-603-on-linux.html";0diggsdigg

Quick tutorial for installing DSS on Ubuntu 8.04.1 64bit (x86_64).

Most of these details can be found here: http://dss.macosforge.org/trac/ticket/6

Hopefully they will integrate these patches in to the next release, but until then here are the build instructions for Ubuntu:

Download DSS 6.0.3: http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar

Download this patch: http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch (Thank you Sverker Abrahamsson!)

And this patch: http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch

Finally get the modified Install script: http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install

The basic process is:

1. Get the build dependencies from the repositories.
2. Set up the qtss user (this is because the Install script does it in a way that is incompatible with Ubuntu)
3. Extract the source code.
4. Apply both patches.
5. Replace the Install script and chmod +x it.
6. Compile.
7. Install.

Notably for ssl admin you need the openssl and libnet-ssleay-perl packages, unfortunately even with these packages I was unable to get ssl admin to work.

I created the modified Install script; you can do a diff with the original if you want to see what I changed. Mostly just the paths were broken, but I am guessing that some other modules and such will probably not work.

Here is the bash script I used to do everything (including automatically download everything):


#!/bin/bash

sudo apt-get install build-essential wget
sudo addgroup --system qtss
sudo adduser --system --no-create-home --ingroup qtss qtss

wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar
tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch
patch -p0 < dss-6.0.3.patch
mv DarwinStreamingSrvr6.0.3-Source.orig DarwinStreamingSrvr6.0.3-Source
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch
patch -p0 < dss-hh-20080728-1.patch
#need to answer n then y
cd DarwinStreamingSrvr6.0.3-Source
mv Install Install.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install
chmod +x Install
./Buildit
sudo ./Install




Update 2/2/2009: I changed the links to all point to dss.macosforge.org, which is a much more reliable host. Everyone should also take a look at that thread, as there are a lot of updates, including a newer patch from Horace Hsieh. I haven't played with this in a while, but if I get a chance I will try to update this with the newer patch. Please let me know if there are any problems (I just turned comment notifications on :/).

 

출처: http://blog.vinestory.com/87 

 

 

Automating startup of Darwin Streaming Server

Recently I have been using Darwin Streaming Media Server for some small movies. However, I quickly found out that when I rebooted the server Darwin does not automatically start up with it. It was necessary to start it manually each time the server was rebooted or started. Needless to day I find this very inconvenient. So I decided to write a startup script. It was really very easy, as you will see below.

I am using Fedora Core 4 and did a normal install of Darwin 5.5 from Apple.

Then I added the following script as the directory /etc/rc.d/init.d/darwinssd with darwinssd being the filename, not a directory.
You will need to be superuser in order to write to this directory.

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

#!/bin/bash
#
# created by Adam Culp of Unique Web Sites, Inc.
# at www.uniquewebsites.com
#
# darwinssd     Startup script for the Darwin Streaming Server
#
# chkconfig: 345 85 15
# description: Darwin Streaming Server startup/shutdown script
# processname: darwinssd
# pidfile: /var/run/darwinssd.pid
 
darwinssd=/usr/local/sbin/DarwinStreamingServer
RETVAL=0
 
# Source function library.
. /etc/rc.d/init.d/functions
 
case "$1" in
start)
echo -n "Starting Darwin Streaming Server[darwinssd]: "
daemon $darwinssd
RETVAL=$?
echo
touch /var/lock/subsys/darwinssd
;;
stop)
echo -n "Shutting down Darwin Streaming Server[darwinssd]: "
killproc $darwinssd
RETVAL=$?
echo
rm -f /var/lock/subsys/darwinssd
rm -f /var/run/darwinssd.pid
;;
status)
status $darwinssd
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reloading darwinssd: "
killproc $darwinssd -HUP
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
 
esac
 
exit 0

Of course you will also need to change the permissions on the file darwinssd to be -rwxr-xr-x (or 755).

# chmod -c 755 darwinssd

 

At this point you can treat darwinssd as if it was any other daemon. You can add it to the starup with:(must be root user for this command)

# chkconfig darwinssd on

# chkconfig --level 35 darwinssd on  <--- runlevel 35: autorun

As a superuser you would type it as:

# /sbin/chkconfig darwinssd on

It also has other features such as start, stop, restart, and reload.
The same applies here for any of these commands:

# service darwinssd restart

or as superuser

# /sbin/service darwinssd restart

 

출처: http://www.geekyboy.com/archives/9

 

 

 

Darwin Streaming Server


This article was for the following Ubuntu versions tested:

  • Feisty Fawn 7.04 Gutsy Fawn 7.04
  • Dapper Drake 6.06 (Long Term Support)

Darwin Streaming Server is the free version of QuickTime commercial server from Apple. Here are some of it's features:

  • Support for open standards: MP3, MPEG-4, H.264/AVC, RTP, RTSP
  • Open Source pursuant to Apple Public Source License
  • No term, no user restrictions, etc.
  • Free

In addition, the server through a Web interface, a simple configuration, even from another computer.



The Darwin server is suited for on-demand streaming, where the audio / video data is already in coded form as a file and available on demand by a user of each other. In connection with the Live encoder mp4live from mpeg4ip project, but it can also live streaming applications (eg Internet-TV).

The following instructions should assist in the installation and configuration of the Darwin server.

Preparation

For the installation of the Darwin Streaming Server, the following two packages need to be installed:

Libstdc + +5 (is already installed by default)
Checkinstall (Dapper)

To the Darwin streaming server after installation test can also be a good player for playback. This can be either locally on the server, or even better on a second computer to the server network is installed. It is proposed to take this opportunity to install the VLC media player with MPEG-4 support, but there are certainly other players to use.

The Darwin Streaming Server is not as a finished package for Ubuntu or Debian available, but must via Web browser as tar file from Apple's Web Download (registration required). The installation is described here the package Official Release - DSS 5.5.5 -> Linux -> streaming server is required, which the Linux binaries. The file is then downloaded and unpacked in the home directory.

Installation

After unpacking a terminal is opened and executed the following commands:

cd DarwinStreamingSrvrlinux Linux
sudo addgroup --system qtss
sudo adduser --system --no-create-home --ingroup qtss qtss

Gutsy Fawn

Under Ubuntu 7.04 Dapper Fawn the command is:

sudo. / Install

Dapper Drake

Under Ubuntu 6.06 Dapper Drake is the call warrant against:

sudo checkinstall - pkgname = darwin-server - pkgversion = 5.5.5. / Install

Here is a brief explanation of what the different commands effect:

  1. Change in the scale when unpacking subdirectory
  2. Creating a user group "qtss" (otherwise the installation doesn't work)
  3. Creating a user "qtss" (as before, but strangely ubuntu not necessary?)
  4. Calling the installation routine

After entering the last command line, the installation routine automatically and directed all the necessary directories and so spontaneous. It will also name and password for the administrator of the Darwin server queried. After completing the installation, the Darwin server automatically.

The installation of the server software is closed and the terminal can be closed.

Directories

The following table presents an overview of the most important files and directories of the Darwin server:

/usr/local/sbin/Darwin Streaming Server ---- Server Software
/usr/local/sbin/streamingadminserver.pl ---- Web Frontend
/etc/streaming ---- Configuration Dir
/etc/streaming/streamingserver.xml ---- Configuration File Server
/var/streaming/logs ---- Logs
/usr/local/movies ---- Default directory for video files

Then, the file /etc/streaming/streamingserver.xml must be given write privledges, otherwise no configuration can be saved:

sudo chmod 755 /etc/streaming/streamingserver.xml

Configuration and Test

The configuration of the Darwin server via a web interface and the following link called:

http://<Server-IP>:1220

After signing up as an administrator using the software installation previously elected login information can now be made more settings. When you first call up the site initially queried following information:

  • MP3 Broadcast Password
  • Secure Administration
  • Media Folder: /usr/local/movies
  • Streaming on Port 80 Streaming on Port 80

It is important here first is that the path to the video files (Media Folder) correctly specified, all other issues can safely with the "Next" button skipped.In the specified directory /usr/local/movies are already some demo videos, for the first function tests can be used. It is therefore appropriate that this requirement to make changes at any time are on the configuration menu. After defining these four points will eventually configuration mask for the Darwin server, in other settings can be made. Leave the configuration screen by clicking on "Sign Out" (left column bottom).

Now you can test whether the Darwin server works as desired. This is the VLC media player opened and the menu "File -> Open Network Stream" stream following address:

rtsp://<Server-IP>/sample_100kbit.mp4

If everything is installed correctly, you should now be a player in the supplied sample videos will be shown. Congratulations!

Start Server

During power of the computer is not of the Darwin server automatically, but servers and web interface must either in a terminal on the following two lines of command

sudo /usr/local/sbin/DarwinStreamingServer
/usr/local/sbin/streamingadminserver.pl

Or by corresponding entries in the Start menu manually invoked. As servers and web interface can also start automatically, is contributing startup. In addition, there are init scripts for the Darwin server and the admin interface.

MPEG-4 video streaming

In order to use the server as streaming video-on-demand server videos must be in MPEG-4 format (file extension .mp4). Using the under video editing or DVD rippin tools. Videos in Quicktime format (. Mov) could also be used, but are probably less interesting.

However, before an MPEG-4 video with the Darwin server can be streamed must have known in advance hint tracks in the data stream added. They are required to fast forward and rewind the video. For inserting the hint tracks use Tool MP4Box in the package:

  • gpac (multiverse, [2])

The syntax for the command call for inserting the hint tracks reads:

MP4Box -hint dateiname.mp4

With the option-unhint can be inserted information may also be removed.

Alternatively, can the hint tracks with the tool mp4creator from the MPEG4IP project.

After inserting the hint tracks, the video file only in the video directory of the Darwin server will be copied or moved, immediately thereafter, the video for the call may be accessed via the web interface also includes a playlist can be created.

MP3 audio streaming

With the Darwin server can not only MPEG-4 videos, but also MP3 audio files stream. As you can create MP3 files, for example, in the contribution rip CDs. To existing MP3 files on stream, must first play lists, which, thanks to the existing web interfaces but made relatively quickly. (Guide in German, not included)

The MP3 player, the create play lists at the address:

http://<Server-IP>:8000/Mountpunkt

 

--- Re

Command
Code:
/usr/local/sbin/streamingadminserver.pl
must be run as root too
Code:
sudo /usr/local/sbin/streamingadminserver.pl
or otherwise you'll get an error
Code:
Couldn't find the en language messages file! at /usr/local/sbin/streamingadminserver.pl line 2167.
Killing the server
Code:
root@mansikki:~# ps -Af | grep -i stream
root      5857     1  0 11:28 ?        00:00:00 /usr/local/sbin/DarwinStreamingServer
qtss      5858  5857  0 11:28 ?        00:00:00 /usr/local/sbin/DarwinStreamingServer
qtss      6061     1  0 11:32 ?        00:00:00 /usr/bin/perl /usr/local/sbin/streamingadminserver.pl
root      6233  6205  0 11:35 pts/9    00:00:00 grep -i stream

killall DarwinStreamingServer 
kill 6061

 

--- Re 

There is file /etc/streaming/qtusers
to manage the file use qtpasswd tool as follows:
/usr/bin/qtpasswd -c -p password administrator

 

'Linux > CentOS' 카테고리의 다른 글

CentOS Iptables 방화벽 포트 OPEN  (0) 2012.09.07
Wowza Media Server 설치  (0) 2012.09.07
부팅 시에 네트워크 자동 시작  (0) 2012.09.05
사용자 계정 추가  (0) 2012.09.03
CentOS VNC 설정 및 사용법  (0) 2012.08.31
Posted by iWithJoy
Linux/CentOS2012. 9. 5. 20:12

설정 중에 네트워크 설정이 바뀌었거나

랜카드가 2개 장착된 경우, 설정을 바꿀 때 자동 시작이 풀렸을 때,

리부팅했을 때, 랜카드 연결이 자동으로 되지 않을 때는 아래와 같은 설정을 확인하여 수정한다.

 

# vi /etc/sysconfig/network-scripts/ifcfg-eth0   <--- eth0 부분은 네트워크 카드명

 

DEVICE="eth0"
BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="47ec6d4e-47ee-4d66-be2f-bfb0b1701017"
IPADDR=xxx.xxx.xxx.xxx
PREFIX=27
GATEWAY=xxx.xxx.xxx.xxx
DNS1=168.126.63.1
DNS2=168.126.63.2
DOMAIN=xxx.com
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:26:66:43:20:59
LAST_CONNECT=1346799755

위의 내용 중에 ONBOOT="no"로 바뀐 경우,

시스템 재시작 시에 랜카드 연결이 자동으로 수행되지 않는다.

Posted by iWithJoy
Linux/CentOS2012. 9. 3. 11:04

계정 추가
# useradd [계정이름]

비밀번호 설정
# passwd [계정이름]

계정 삭제
# userdel [계정이름]

계정 관련 데이터 삭제
# userdel -r [계정이름]

 

시스템>관리>사용자및그룹 에서 확인

 

참고: http://blog.naver.com/reum900415?Redirect=Log&logNo=10105614191

Posted by iWithJoy