PostgerSQL 9.1 Install on CentOS 5.x

카테고리 없음 2012. 3. 29. 13:50


본 문서는 외부에서 특정 사용자로 접속이 가능한 상태까지를 가이드 합니다. 
이후의 작업은 pgAdmin III으로 작업하는 것을 상정합니다.


[root@localhost ~]# wget http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
--2012-03-29 02:58:42--  http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pgrpms.org... failed: name resolution에서 일시적인 실패.
wget: unable to resolve host address `yum.pgrpms.org'
[root@localhost ~]# vi /etc/resolv.conf
....
search localdomain
nameserver 164.124.101.2
nameserver 203.248.252.2
....
[root@localhost ~]# wget http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
--2012-03-29 02:19:26--  http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pgrpms.org... 98.129.198.114
Connecting to yum.pgrpms.org|98.129.198.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4925 (4.8K) [application/x-redhat-package-manager]
Saving to: `pgdg-centos91-9.1-4.noarch.rpm.1'

100%[=========================================================================>] 4,925       26.1K/s   in 0.2s

2012-03-29 02:19:28 (26.1 KB/s) - `pgdg-centos91-9.1-4.noarch.rpm.1' saved [4925/4925]

[root@localhost ~]# rpm -i pgdg-centos91-9.1-4.noarch.rpm
경고: pgdg-centos91-9.1-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 442df0f8
 [root@localhost ~]# yum install postgresql91-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.daum.net
* extras: ftp.daum.net
* updates: ftp.daum.net
pgdg91                                                                                      | 2.8 kB     00:00
pgdg91/primary_db                                                                           |  79 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
--> Processing Dependency: postgresql91 = 9.1.3-1PGDG.rhel5 for package: postgresql91-server
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql91-server
--> Running transaction check
---> Package postgresql91.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
---> Package postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================
Package                           Arch                 Version                         Repository            Size
===================================================================================================================
Installing:
postgresql91-server               x86_64               9.1.3-1PGDG.rhel5               pgdg91               5.2 M
Installing for dependencies:
postgresql91                      x86_64               9.1.3-1PGDG.rhel5               pgdg91               1.6 M
postgresql91-libs                 x86_64               9.1.3-1PGDG.rhel5               pgdg91               216 k

Transaction Summary
===================================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 7.0 M
Is this ok [y/N]: Y
Downloading Packages:
(1/3): postgresql91-libs-9.1.3-1PGDG.rhel5.x86_64.rpm                                       | 216 kB     00:01
(2/3): postgresql91-9.1.3-1PGDG.rhel5.x86_64.rpm                                            | 1.6 MB     00:01
(3/3): postgresql91-server-9.1.3-1PGDG.rhel5.x86_64.rpm                                     | 5.2 MB     00:01
-------------------------------------------------------------------------------------------------------------------
Total                                                                              1.5 MB/s | 7.0 MB     00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : postgresql91-libs                                                                           1/3
  Installing     : postgresql91                                                                                2/3
  Installing     : postgresql91-server                                                                         3/3

Installed:
  postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel5

Dependency Installed:
  postgresql91.x86_64 0:9.1.3-1PGDG.rhel5               postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel5

Complete!
[root@localhost ~]# service postgresql-9.1 initdb
데이타베이스를 초기화함:                                   [  OK  ]
[root@localhost ~]# service postgresql-9.1 start
postgresql-9.1 서비스를 시작 중:                           [  OK  ]
[root@localhost ~]# chkconfig postgresql-9.1 on

[root@localhost ~]# cd /var/lib/pgsql/9.1/data
[root@localhost data]# ls
PG_VERSION  pg_clog        pg_log        pg_serial    pg_tblspc    postgresql.conf
base        pg_hba.conf    pg_multixact  pg_stat_tmp  pg_twophase  postmaster.opts
global      pg_ident.conf  pg_notify     pg_subtrans  pg_xlog      postmaster.pid
[root@localhost data]#
[root@localhost data]# vi postgresql.conf
....
...
# - Connection Settings -

#listen_addresses = 'localhost'         # what IP address(es) to listen on;
listen_addresses = '*'                          # what IP address(es) to listen on;
                                                                  # comma-separated list of addresses;
....
...
[root@localhost data]# vi pg_hba.conf
....
...

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
#host    all             all             127.0.0.1/32            ident
host    all             all             0.0.0.0/0                md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
...
...
[root@localhost data]# service postgresql-9.1 restart
postgresql-9.1 서비스를 중지 중:                           [  OK  ]
postgresql-9.1 서비스를 시작 중:                           [  OK  ]
[root@localhost data]# su postgres
bash-3.2$ createuser -P ls_admin
Enter password for new role:
비밀번호 확인:
Shall the new role be a superuser? (y/n) y
CREATE ROLE
bash-3.2$
bash-3.2$ dropuser ls_admin
DROP ROLE


12. MediaTomb 설치 - UPnP 또는 DLNA [NAS 구축기][ubuntu 10.4]

얼렁뚱땅설명서 2012. 3. 20. 03:02

요즘은 고민이 되는 것이 좀 있다. 우분투 12.04 LTS 버전이 조만간 출시될 텐데 10.04에서 계속 이런 포스트를 올려야 하나??
뭐, 12.04가 나왔다고 별다르게 바뀌는 것이 있겠냐 마는..... 오늘은 Media Tomb을 설치한다.


유니버설 플러그 앤 플레이
 (UPnP)는 UPnP 포럼이 공표한 컴퓨터 네트워크 프로토콜의 집합이다. UPnP의 목표는 장치들을 부드럽게 연결하고 가정 네트워크와 회사 환경의 기능(데이터 공유, 통신, 엔터테인먼트)을 단순화하는 것이다. UPnP는 개방된 인터넷 기반의 통신 표준 기반의 UPnP 장치 제어 프로토콜을 정의하고 출판함으로써 이를 달성한다.
UPnP라는 용어는 컴퓨터에 직접 장치를 유동적으로 부착하는 기술인 플러그 앤 플레이에서 비롯한 것이다.


DLNA(디지털 리빙 네트워크 얼라이언스, Digital Living Network Alliance)는 소니가 2003년 6월에 설립한 비영리 단체로, 모바일, 가전 기기, PC, 서비스 제공자 산업의 250개 이상의 회사와 연계하고 있다. 2003년 6월에 디지털 홈 워킹 그룹(Digital Home Working Group)이라는 이름으로 설립되었다가, DNLA의 가이드라인이 확립되어 공표된 12개월 후에 현재의 이름으로 자리잡혔다.


Media Tomb은 UPnP 또는 DLNA을 대표(?)하는 프로그램이다. UPnPDLNA에 대해 위키백과에서는 위와 같이 정의 하고 있다. 이것이 뭐하는 것이냐 하면, 한마디로 영화-음악-사진 등을 간편하게 시청 감상할 수 있는 서비스를 지원 한다는 것이다. 어디서? 당신이 가지고 있는 스마트 폰이나 랜케이블을 꼽을 수 있거나 무선랜 카드를 장작할 수 있는 최신 스마트 TV를 가지고 있다면 말이다.
한계성이라고 한다면... 디지털 리빙 네트워크라는 말처럼 집(서버가 있는 네트워크에서만 ... )에서만 된다는 것이다. 

우분투에서  Media Tomb 의 설치는 매우 간단하다. 아래와 같이 명령을 내리면 된다. 이런 간편함은 우분투의 축복이다.

user@Team4Svr:~$ sudo -s
root@Team4Svr:~# apt-get install mediatomb
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 패키지를 더 설치할 것입니다:
  libffmpegthumbnailer4 libswscale0 mediatomb-common mediatomb-daemon
다음 새 패키지를 설치할 것입니다:
  libffmpegthumbnailer4 libswscale0 mediatomb mediatomb-common mediatomb-daemon
0개 업그레이드, 5개 새로 설치, 0개 지우기 및 10개 업그레이드 안 함.
1,243k바이트 아카이브를 받아야 합니다.
이 작업 후 3,432k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]?
받기:1 http://ftp.daum.net/ubuntu/ lucid-updates/main libswscale0 4:0.5.1-1ubuntu1.3 [175kB]
받기:2 http://ftp.daum.net/ubuntu/ lucid/universe libffmpegthumbnailer4 2.0.0-1 [31.2kB]
받기:3 http://ftp.daum.net/ubuntu/ lucid/universe mediatomb-common 0.12.0~svn2018-6ubuntu2 [991kB]
받기:4 http://ftp.daum.net/ubuntu/ lucid/universe mediatomb-daemon 0.12.0~svn2018-6ubuntu2 [24.2kB]
받기:5 http://ftp.daum.net/ubuntu/ lucid/universe mediatomb 0.12.0~svn2018-6ubuntu2 [21.8kB]
내려받기 1,243k바이트, 소요시간 0초 (2,122k바이트/초)
전에 선택하지 않은 libswscale0 패키지를 선택합니다.
(데이터베이스 읽는중 ...현재 163341개의 파일과 디렉토리가 설치되어 있습니다.)
libswscale0 패키지를 푸는 중입니다 (.../libswscale0_4%3a0.5.1-1ubuntu1.3_amd64.deb에서) ...
전에 선택하지 않은 libffmpegthumbnailer4 패키지를 선택합니다.
libffmpegthumbnailer4 패키지를 푸는 중입니다 (.../libffmpegthumbnailer4_2.0.0-1_amd64.deb에서) ...
전에 선택하지 않은 mediatomb-common 패키지를 선택합니다.
mediatomb-common 패키지를 푸는 중입니다 (.../mediatomb-common_0.12.0~svn2018-6ubuntu2_amd64.deb에서) ...
전에 선택하지 않은 mediatomb-daemon 패키지를 선택합니다.
mediatomb-daemon 패키지를 푸는 중입니다 (.../mediatomb-daemon_0.12.0~svn2018-6ubuntu2_all.deb에서) ...
전에 선택하지 않은 mediatomb 패키지를 선택합니다.
mediatomb 패키지를 푸는 중입니다 (.../mediatomb_0.12.0~svn2018-6ubuntu2_all.deb에서) ...
man-db에 대한 트리거를 처리하는 중입니다 ...
ureadahead에 대한 트리거를 처리하는 중입니다 ...
ureadahead will be reprofiled on next reboot
desktop-file-utils에 대한 트리거를 처리하는 중입니다 ...
python-gmenu에 대한 트리거를 처리하는 중입니다 ...
Rebuilding /usr/share/applications/desktop.ko_KR.utf8.cache...
python-support에 대한 트리거를 처리하는 중입니다 ...
libswscale0 (4:0.5.1-1ubuntu1.3) 설정하는 중입니다 ...

libffmpegthumbnailer4 (2.0.0-1) 설정하는 중입니다 ...

mediatomb-common (0.12.0~svn2018-6ubuntu2) 설정하는 중입니다 ...
mediatomb-daemon (0.12.0~svn2018-6ubuntu2) 설정하는 중입니다 ...
* Starting upnp media server mediatomb                                                      [ OK ]

mediatomb (0.12.0~svn2018-6ubuntu2) 설정하는 중입니다 ...

libc-bin에 대한 트리거를 처리하는 중입니다 ...
ldconfig deferred processing now taking place
root@Team4Svr:~#



설치는 잘 끝난 모양이다. 그럼 이제 뭘하지? 설치되고난 터미널을 보면 막막하다. Media Tomb은 자신의 설정을 위해 웹 인터페이스를 제공하는데 포트가 워낙 난잡하고 알기 어렵다.  Media Tomb의 서비스 포트를 알기 위해서는 아래의 명령어를 입력하여 확인하는 방법도 있다.
netstat -lnp로 보면 49152 포트에서 대기하고 있다고 표시되어 있다. 

root@Team4Svr:~# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      11195/smbd
tcp        0      0 0.0.0.0:49152           0.0.0.0:*               LISTEN      21171/mediatomb
tcp        0      0 0.0.0.0:3689            0.0.0.0:*               LISTEN      1328/mt-daapd
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      11195/smbd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      841/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1351/cupsd
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1299/master
tcp6       0      0 :::22                   :::*                    LISTEN      841/sshd
tcp6       0      0 ::1:631                 :::*                    LISTEN      1351/cupsd
udp        0      0 0.0.0.0:53930           0.0.0.0:*                           868/avahi-daemon: r
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           868/avahi-daemon: r
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           21171/mediatomb
udp        0      0 192.168.10.5:137        0.0.0.0:*                           1523/nmbd
udp        0      0 0.0.0.0:137             0.0.0.0:*                           1523/nmbd
udp        0      0 192.168.10.5:138        0.0.0.0:*                           1523/nmbd
udp        0      0 0.0.0.0:138             0.0.0.0:*                           1523/nmbd
udp        0      0 127.0.0.1:59671         0.0.0.0:*                           21171/mediatomb


netstat -lnp 확인한 포트를 서버 IP 뒤에 붙여 입력하면 아래와 같은 설정페이지륻 얻을 수 있다. Filesystem 탭에서 서비스할 폴더를 선택하여 (+) 버튼을 클릭하면 바로 서비스를 시작한다. Database 탭에서는 아이템을 삭제하거나 편집할 수 있다.
인터페이스는 매우 간단하고 심플하다.



netstat 와 같은 터미널 친화적인 명령어로 포트를 확인하고 그런 것이 싫다면, 우아하게 그래픽 터미널에서 Media Tomb 설정 화면을 띄울 수 있다. 본인의 경우에는 그래픽 터미널을 띄우기 싫어 그냥 터미널을 좋아한다.



하여간, 본인은 스마트 TV가 없으므로 대신 스마트 폰으로 테스트 하겠다. 스마트 폰 앱은 UPnP나 DLNA로 검색하면 된다.
본인은 WOON이라는 앱을 받아 사용한다. 아래는 흔한 UPnP-DLNA 앱 화면 되겠다.







11. ffmpeg + AirVideo Server 설치 [NAS 구축기][ubuntu 10.4]

얼렁뚱땅설명서 2012. 3. 6. 10:58


ffmpeg는 인코딩 프로그램을 유명하다. Airvideo Server을 설치하기 전에 먼저 설치하는 이유는  Airvideo Server가 더 훌륭해 지거나 Live Conversion이 매우 빠르게 수행될 것 같은 느낌 때문이다. 근거는 없다. 

ffmpeg는 컴파일을 해야하므로 일단, 시스템을 업데이트 하고 기본적인 컴파일 도구를 설치한다.
덤으로 인코딩에 사용할 여러개의 라이브러리도 설치한다. 명령어가 조금 길다.

username@Team4Svr:~$ sudo -s
root@Team4Svr:~#  apt-get update
.......
.......
....... 
 
패키지 목록을 읽는 중입니다... 완료
root@Team4Svr:~# apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libvpx-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
build-essential 패키지는 이미 최신 버전입니다.
.....
.....
..... 
0개 업그레이드, 61개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
28.1M바이트 아카이브를 받아야 합니다.
이 작업 후 86.7M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]?
.....
.....
너무 길어서 이하생략
.....
.....
libxvidcore-dev (2:1.2.2+debian-0ubuntu2) 설정하는 중입니다 ...
subversion (1.6.6dfsg-2ubuntu1.3) 설정하는 중입니다 ...
texi2html (1.82-1) 설정하는 중입니다 ...
yasm (0.8.0-1) 설정하는 중입니다 ...
libc-bin에 대한 트리거를 처리하는 중입니다 ...
ldconfig deferred processing now taking place



x264 라이브러리를 설치한다. x264는 H.264의 구현으로 '매우 높은 데이터 압축률을 가지는 디지털 비디오 코덱 표준으로 MPEG-4 파트 10 또는 MPEG-4/AVC(고급 비디오 부호화, Advanced Video Coding)라 부르기도 한다.-한국위키-'....... 하여간 좋은 거다.;
 

root@Team4Svr:~# cd
root@Team4Svr:~# git clone git://git.videolan.org/x264.git
Initialized empty Git repository in /home/fishingday/x264/.git/
remote: Counting objects: 15359, done.
remote: Compressing objects: 100% (2923/2923), done.
remote: Total 15359 (delta 12578), reused 15174 (delta 12395)
Receiving objects: 100% (15359/15359), 3.80 MiB | 749 KiB/s, done.
Resolving deltas: 100% (12578/12578), done.
root@Team4Svr:~# cd x264
root@Team4Svr:~/x264#
root@Team4Svr:~/x264# ./configure   <--- yasm 버전이 낮다고 한다. 아래와 같이 한다.
Found yasm 0.8.0.2194
Minimum version is yasm-1.0.0
If you really want to compile without asm, configure with --disable-asm.
root@Team4Svr:~/x264# ./configure --enable-shared --disable-asm
platform:      X86_64
system:        LINUX
cli:           yes
libx264:       internal
shared:        yes
static:        no
asm:           no
interlaced:    yes
avs:           no
lavf:          no
ffms:          no
gpac:          no
gpl:           yes
thread:        posix
filters:       crop select_every
debug:         no
gprof:         no
strip:         no
PIC:           yes
visualize:     no
bit depth:     8
chroma format: all

You can run 'make' or 'make fprofiled' now.
root@Team4Svr:~/x264#
isualize:     no
bit depth:     8
chroma format: all

You can run 'make' or 'make fprofiled' now.
root@Team4Svr:~/x264# checkinstall --pkgname=x264 --pkgversion "2:0.`grep X264_BUILD x264.h -m1 | cut -d' ' -f3`.`git rev-list HEAD | wc -l`+git`git rev-list HEAD -n 1 | head -c 7`" --backup=no --deldoc=yes --fstrans=no --default

checkinstall 1.6.1, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 -  Maintainer: [ root@Team4Svr ]
1 -  Summary: [ Package created with checkinstall 1.6.1 ]
2 -  Name:    [ x264 ]
3 -  Version: [ 2:0.120.2164+gitda19765 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ x264 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ x264 ]

Enter a number to change any of them or press ENTER to continue:

Installing with make...Installing with install...

========================= Installation results ===========================
....
.... 생략...
....
======================== Installation successful ==========================

Copying documentation directory...
./
./AUTHORS
./doc/
./doc/vui.txt
./doc/standards.txt
./doc/threads.txt
./doc/regression_test.txt
./doc/ratecontrol.txt
./COPYING
grep: /var/tmp/tmp.llEegCHGR8/newfile: 그런 파일이나 디렉터리가 없습니다

Some of the files created by the installation are inside the build
directory: /home/fishingday/x264

You probably don't want them to be included in the package,
especially if they are inside your home directory.
Do you want me to list them?  [n]: n
Should I exclude them from the package? (Saying yes is a good idea)  [y]: y

Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Deleting doc-pak directory...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been installed and saved to

 /home/fishingday/x264/x264_2:0.120.2164+gitda19765-1_amd64.deb

 You can remove it from your system anytime using:

      dpkg -r x264

**********************************************************************

root@Team4Svr:~/x264#


 이제 ffmpeg를 설치해 준다.

root@Team4Svr:~# cd
root@Team4Svr:~# svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
....
....
A    ffmpeg/MAINTAINERS
A    ffmpeg/COPYING.LGPLv3
 U   ffmpeg
체크아웃된 리비전 26402.
root@Team4Svr:~# cd ffmpeg
root@Team4Svr:~/ffmpeg# ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
.......
.......
.......
Enabled bsfs:
aac_adtstoasc           mjpeg2jpeg              mp3_header_decompress
chomp                   mjpega_dump_header      noise
dump_extradata          mov2textsub             remove_extradata
h264_mp4toannexb        mp3_header_compress     text2movsub
imx_dump_header

Enabled indevs:
alsa                    oss                     v4l2
dv1394                  v4l                     x11_grab_device

Enabled outdevs:
alsa                    oss

License: nonfree and unredistributable
Creating config.mak and config.h...
root@Team4Svr:~/ffmpeg# make
CC      libavdevice/alldevices.o
CC      libavdevice/alsa-audio-common.o
CC      libavdevice/alsa-audio-dec.o
CC      libavdevice/alsa-audio-enc.o
CC      libavdevice/avdevice.o
.....
.....
.....
POD     doc/ffmpeg.pod
MAN     doc/ffmpeg.1
POD     doc/ffplay.pod
MAN     doc/ffplay.1
POD     doc/ffprobe.pod
MAN     doc/ffprobe.1
POD     doc/ffserver.pod
MAN     doc/ffserver.1
root@Team4Svr:~/ffmpeg# checkinstall --pkgname=ffmpeg --pkgversion "4:SVN-r`LANG=C svn info | grep Revision | awk '{ print $NF }'`" --backup=no --deldoc=yes --fstrans=no --default
....
....
....
Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Deleting doc-pak directory...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been installed and saved to

 /home/fishingday/ffmpeg/ffmpeg_4:SVN-r26402-1_amd64.deb

 You can remove it from your system anytime using:

      dpkg -r ffmpeg

**********************************************************************

root@Team4Svr:~/ffmpeg# hash x264 ffmpeg ffplay
root@Team4Svr:~/ffmpeg# make tools/qt-faststart
CC      tools/qt-faststart.o
LD      tools/qt-faststart
rm tools/qt-faststart.o
root@Team4Svr:~/ffmpeg# checkinstall --pkgname=qt-faststart --pkgversion "4:SVN-r`LANG=C svn info | grep Revision | awk '{ print $NF }'`" --backup=no --deldoc=yes --fstrans=no --default install -D -m755 tools/qt-faststart /usr/local/bin/qt-faststart

checkinstall 1.6.1, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 -  Maintainer: [ root@Team4Svr ]
1 -  Summary: [ Package created with checkinstall 1.6.1 ]
2 -  Name:    [ qt-faststart ]
3 -  Version: [ 4:SVN-r26402 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ ffmpeg ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ qt-faststart ]

Enter a number to change any of them or press ENTER to continue:

Installing with install...Installing with -D...Installing with -m755...Installing with tools/qt-faststart...Installing with /usr/local/bin/qt-faststart...

========================= Installation results ===========================

======================== Installation successful ==========================

.......
.......
.......

Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Deleting doc-pak directory...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been installed and saved to

 /home/fishingday/ffmpeg/qt-faststart_4:SVN-r26402-1_amd64.deb

 You can remove it from your system anytime using:

      dpkg -r qt-faststart

**********************************************************************

root@Team4Svr:~/ffmpeg#

짜잔 FFmpeg의 설치가 끝났다. CentOS에서 설치할땐 하루 종일 걸렸던 것 같은데.... 우분투에선 금방 이다. 
그럼 이제 ffmpeg를 실행 해 보자. 기대와 달리 실행할 수 없다는 오류를 냉큼 떨어뜨린다. ㅡㅡ;

root@Team4Svr:~/ffmpeg# ffmpeg
ffmpeg: error while loading shared libraries: libx264.so.120: cannot open shared object file: No such file or directory
root@Team4Svr:~/ffmpeg#

 공유 라이브러리를 찾을 수 없다는 오류 이므로, 아래와 같은 조치를 취한 후 다시 실행해 준다.

root@Team4Svr:~/ffmpeg# vi /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

/usr/local/lib   <--- 추가하고 저장 한다.
~
root@Team4Svr:~/ffmpeg# ldconfig
root@Team4Svr:~/ffmpeg# ffmpeg
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
  built on Mar  6 2012 10:44:30 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
  libavutil     50.36. 0 / 50.36. 0
  libavcore      0.16. 1 /  0.16. 1
  libavcodec    52.108. 0 / 52.108. 0
  libavformat   52.93. 0 / 52.93. 0
  libavdevice   52. 2. 3 / 52. 2. 3
  libavfilter    1.74. 0 /  1.74. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
root@Team4Svr:~/ffmpeg#



FFmpeg의 간단하 사용방법이다.

### One-pass CRF
ffmpeg -i input.avi -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 output.mp4

### Two-Pass 인코딩
ffmpeg -i input.avi -pass 1 -vcodec libx264 -vpre fast_firstpass -b 512k -bt 512k    -threads 0 -f rawvideo -an -y /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre fast -b 512k -bt 512k -threads 0 output.mp4

### iPod 640x480 으로 인코딩
ffmpeg -i input.avi -acodec libfaac -aq 100 -ac 2 -vcodec libx264 -vpre slow -vpre ipod640 -crf 26 -map_meta_data 0:0 -vf scale=640:-1 -threads 0 output.mp4


아래는 오래전(?)에 테스트 하면서 사용한 명령어이다. 여러가지 포맷으로 변환이 된다.

[root@localhost test] ffmpeg -i 640x480.wmv -y -s 640x360 -acodec libfaac -ar 32000 -ab 48000 -ac 2 -f flv -vcodec flv -b 700k tranc640x360.flv 
....
[root@localhost test] ffmpeg -i 640x480.wmv -y -threads 4-s 640x360 -acodec libfaac -ar 32000 -ab 48000 -ac 2 -f mp4 -vcodec libx264 -vpre fast -b 1000k -g 30 -bf 2 -b_strategy 1 tranc640x360.mp4

[root@localhost test] ffmpeg -i 640x480.wmv -y -threads 4-s 640x360 -acodec libfaac -ar 32000 -ab 48000 -ac 2 -f mp4 -vcodec mpeg4 -b 1000k  tranc640x360.mp4

인코딩 참고 사이트 : http://ospace.tistory.com/125, http://xmlangel2.blogspot.com/2010/04/ffmpeg-%EA%B8%B0%EB%B3%B8-%EC%82%AC%EC%9A%A9%EB%B2%95.html, http://ffmpeg.org/ffmpeg-doc.html 

※ ffmepg 설치방법은 여기서(http://ubuntuforums.org/showthread.php?t=786095) 참고 했다. 배꼈다. ㅡㅡ;



이제 드디어 Airvideo Server를 설치할 차례이다. 설치는 매우 간단하고 빠르다.

root@Team4Svr:~# add-apt-repository ppa:rubiojr/airvideo
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv A58221FEBF9C6AC1914B24ACC2B39E5DF6BD82A0
gpg: requesting key F6BD82A0 from hkp server keyserver.ubuntu.com
gpg: key F6BD82A0: public key "Launchpad PPA for rubiojr" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
root@Team4Svr:~# apt-get update
....
....
root@Team4Svr:~# sudo apt-get install airvideo-server
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
........
........
  airvideo-server ca-certificates-java faac icedtea-6-jre-cacao java-common
  libaccess-bridge-java libaccess-bridge-java-jni libclucene0ldbl libfaad2 libiodbc2
  libmodplug0c2 libmp4v2-0 libmpeg4ip-0 libmysqlclient16 libphonon4 libqscintilla2-5
  libqt4-dbus libqt4-designer libqt4-multimedia libqt4-network libqt4-opengl libqt4-ruby1.8
  libqt4-script libqt4-sql libqt4-sql-mysql libqt4-svg libqt4-test libqt4-webkit libqt4-xml
  libqt4-xmlpatterns libqtruby4shared2 libruby1.8 libsmokeqt4-3 libsmokesoprano3 libsoprano4
  libx264-85 libxcb-shape0 libxcb-shm0 libxcb-xv0 libxine1 libxine1-bin libxine1-console
  libxine1-misc-plugins libxine1-x mpeg4ip-server mysql-common openjdk-6-jre
  openjdk-6-jre-headless openjdk-6-jre-lib phonon phonon-backend-xine ruby ruby1.8
  soprano-daemon ttf-dejavu-extra tzdata-java virtuoso-nepomuk
0개 업그레이드, 57개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
78.9M바이트 아카이브를 받아야 합니다.
이 작업 후 228M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]?
......
......
......
openjdk-6-jre (6b20-1.9.13-0ubuntu1~10.04.1) 설정하는 중입니다 ...
update-alternatives: /usr/lib/jvm/java-6-openjdk/jre/bin/javaws 사용해서 자동 모드에서 /usr/bin/javaws (javaws) 제공.
update-alternatives: /usr/lib/jvm/java-6-openjdk/jre/bin/pluginappletviewer 사용해서 자동 모드에서 /usr/bin/pluginappletviewer (pluginappletviewer) 제공.
update-alternatives: /usr/lib/jvm/java-6-openjdk/jre/bin/policytool 사용해서 자동 모드에서 /usr/bin/policytool (policytool) 제공.

airvideo-server (0alpha6ubuntu1~lucid1) 설정하는 중입니다 ...
libc-bin에 대한 트리거를 처리하는 중입니다 ...
ldconfig deferred processing now taking place
root@Team4Svr:~# vi /opt/airvideo-server/AirVideoServerLinux.properties
path.ffmpeg = /opt/airvideo-server/bin/ffmpeg
path.mp4creator = /usr/bin/mp4creator
path.faac = /usr/bin/faac
password =
subtitles.encoding = euc-kr   <-- 변경
subtitles.font = undotum  <-- 변경
folders = Movies:/DataCenter/Movies,/DataCenter/Study  <-- 변경

이제 설치가 끝났다. AirVideo Server를 실행하기 위해선 아래의 화면과 같이 프로그램>음악과비디오>Airvideo Server 를 찾아서 실행한다.
서버를 띄우면 아래 화면처럼 아이콘이 생기는 것을 볼 수 있다. 여기서 Start Server를 눌러주면 된다.



아래는 아이폰을 통해 Airvideo Server에 접속한 모습니다. 아이폰의 Airvideo 프로그램은 유료 버전과 무료 버전이 있다. 유료와 무료의 차이점은 목록이 전부다 나오느냐, 일부만 나오느냐의 차이다. 그 외에는 차이는 없는 듯 하다. [+] 버튼을 눌러 Specify Address Manually를 선택한 다음 서버주소와 포트 번호를 누르면 서버를 간단히 추가할 수 있다. 그리고, 서버를 누르면 목록을 볼 수 있고, 목록에서 동영상을 선택하면 된다. mp4로 인코딩 된 동영상은 바로 실행이 되지만, 그 외에는 Play with Live Conversion을 통해 동영상을 즐길 수 있다.




10. 아이튠즈 서버 설치하기 [NAS 구축기][ubuntu 10.4]

얼렁뚱땅설명서 2012. 3. 5. 15:23


지금까지는 NAS의 가장 기본 기능을 끝냈다.
Samba 서버를 이용하여, 언제 어디서나 네트워크 드라이브로 설정할 수 있는 기능을 완성했으며,
덤으로 SSH나 FTP 서버도 설치했다. 
그럼 이제부터, 재미있는 기능들을 설치해 보도록 하자.

처음은 아이튠즈 서버다.  리눅스용 아이튠즈 서버는 firefly(or mt-daapd)가 있다.  apple의 DAAP(Digital Audio Access Protocol)를 구현한 것으로, PC의 아이튠즈나 아이폰, 안드로이드 등에서 사용할 수 있다.


root@Team4Svr:~# apt-get install dpkg-dev
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
다음 패키지를 더 설치할 것입니다:
  build-essential g++ g++-4.4 libstdc++6-4.4-dev xz-utils
제안하는 패키지:
  debian-keyring debian-maintainers g++-multilib g++-4.4-multilib gcc-4.4-doc libstdc++6-4.4-dbg
  libstdc++6-4.4-doc
다음 새 패키지를 설치할 것입니다:
  build-essential dpkg-dev g++ g++-4.4 libstdc++6-4.4-dev xz-utils
0개 업그레이드, 6개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
8,174k바이트 아카이브를 받아야 합니다.
이 작업 후 26.2M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]?
받기:1 http://ftp.daum.net/ubuntu/ lucid/main libstdc++6-4.4-dev 4.4.3-4ubuntu5 [1,522kB]
받기:2 http://ftp.daum.net/ubuntu/ lucid/main g++-4.4 4.4.3-4ubuntu5 [5,756kB]
받기:3 http://ftp.daum.net/ubuntu/ lucid/main g++ 4:4.4.3-1ubuntu1 [1,450B]
받기:4 http://ftp.daum.net/ubuntu/ lucid/main xz-utils 4.999.9beta+20091116-1 [233kB]
받기:5 http://ftp.daum.net/ubuntu/ lucid-updates/main dpkg-dev 1.15.5.6ubuntu4.5 [654kB]
받기:6 http://ftp.daum.net/ubuntu/ lucid/main build-essential 11.4build1 [7,278B]
내려받기 8,174k바이트, 소요시간 1초 (6,234k바이트/초)
전에 선택하지 않은 libstdc++6-4.4-dev 패키지를 선택합니다.
(데이터베이스 읽는중 ...현재 128781개의 파일과 디렉토리가 설치되어 있습니다.)
libstdc++6-4.4-dev 패키지를 푸는 중입니다 (.../libstdc++6-4.4-dev_4.4.3-4ubuntu5_amd64.deb에서) ...
전에 선택하지 않은 g++-4.4 패키지를 선택합니다.
g++-4.4 패키지를 푸는 중입니다 (.../g++-4.4_4.4.3-4ubuntu5_amd64.deb에서) ...
전에 선택하지 않은 g++ 패키지를 선택합니다.
g++ 패키지를 푸는 중입니다 (.../g++_4%3a4.4.3-1ubuntu1_amd64.deb에서) ...
전에 선택하지 않은 xz-utils 패키지를 선택합니다.
xz-utils 패키지를 푸는 중입니다 (.../xz-utils_4.999.9beta+20091116-1_amd64.deb에서) ...
전에 선택하지 않은 dpkg-dev 패키지를 선택합니다.
dpkg-dev 패키지를 푸는 중입니다 (.../dpkg-dev_1.15.5.6ubuntu4.5_all.deb에서) ...
전에 선택하지 않은 build-essential 패키지를 선택합니다.
build-essential 패키지를 푸는 중입니다 (.../build-essential_11.4build1_amd64.deb에서) ...
man-db에 대한 트리거를 처리하는 중입니다 ...
xz-utils (4.999.9beta+20091116-1) 설정하는 중입니다 ...
dpkg-dev (1.15.5.6ubuntu4.5) 설정하는 중입니다 ...
libstdc++6-4.4-dev (4.4.3-4ubuntu5) 설정하는 중입니다 ...
g++-4.4 (4.4.3-4ubuntu5) 설정하는 중입니다 ...
g++ (4:4.4.3-1ubuntu1) 설정하는 중입니다 ...
update-alternatives: /usr/bin/g++ 사용해서 자동 모드에서 /usr/bin/c++ (c++) 제공.

build-essential (11.4build1) 설정하는 중입니다 ...
root@Team4Svr:~# apt-get install avahi-daemon
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
avahi-daemon 패키지는 이미 최신 버전입니다.
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
0개 업그레이드, 0개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
root@Team4Svr:~# apt-get install libgdbm-dev libid3tag0-dev
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
다음 패키지를 더 설치할 것입니다:
  libid3tag0 zlib1g-dev
다음 새 패키지를 설치할 것입니다:
  libgdbm-dev libid3tag0 libid3tag0-dev zlib1g-dev
0개 업그레이드, 4개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
287k바이트 아카이브를 받아야 합니다.
이 작업 후 950k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]?
받기:1 http://ftp.daum.net/ubuntu/ lucid/main libgdbm-dev 1.8.3-9 [38.4kB]
받기:2 http://ftp.daum.net/ubuntu/ lucid/main libid3tag0 0.15.1b-10build2 [39.6kB]
받기:3 http://ftp.daum.net/ubuntu/ lucid/main zlib1g-dev 1:1.2.3.3.dfsg-15ubuntu1 [167kB]
받기:4 http://ftp.daum.net/ubuntu/ lucid/main libid3tag0-dev 0.15.1b-10build2 [41.6kB]
내려받기 287k바이트, 소요시간 0초 (874k바이트/초)
전에 선택하지 않은 libgdbm-dev 패키지를 선택합니다.
(데이터베이스 읽는중 ...현재 129763개의 파일과 디렉토리가 설치되어 있습니다.)
libgdbm-dev 패키지를 푸는 중입니다 (.../libgdbm-dev_1.8.3-9_amd64.deb에서) ...
전에 선택하지 않은 libid3tag0 패키지를 선택합니다.
libid3tag0 패키지를 푸는 중입니다 (.../libid3tag0_0.15.1b-10build2_amd64.deb에서) ...
전에 선택하지 않은 zlib1g-dev 패키지를 선택합니다.
zlib1g-dev 패키지를 푸는 중입니다 (.../zlib1g-dev_1%3a1.2.3.3.dfsg-15ubuntu1_amd64.deb에서) ...
전에 선택하지 않은 libid3tag0-dev 패키지를 선택합니다.
libid3tag0-dev 패키지를 푸는 중입니다 (.../libid3tag0-dev_0.15.1b-10build2_amd64.deb에서) ...
man-db에 대한 트리거를 처리하는 중입니다 ...
libgdbm-dev (1.8.3-9) 설정하는 중입니다 ...
libid3tag0 (0.15.1b-10build2) 설정하는 중입니다 ...

zlib1g-dev (1:1.2.3.3.dfsg-15ubuntu1) 설정하는 중입니다 ...
libid3tag0-dev (0.15.1b-10build2) 설정하는 중입니다 ...
libc-bin에 대한 트리거를 처리하는 중입니다 ...
ldconfig deferred processing now taking place
root@Team4Svr:~# apt-get install libsqlite0
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
libsqlite0 패키지는 이미 최신 버전입니다.
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
0개 업그레이드, 0개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
root@Team4Svr:~# apt-get install libsqlite0-dev
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
제안하는 패키지:
  sqlite-doc
다음 새 패키지를 설치할 것입니다:
  libsqlite0-dev
0개 업그레이드, 1개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
234k바이트 아카이브를 받아야 합니다.
이 작업 후 770k바이트의 디스크 공간을 더 사용하게 됩니다.
받기:1 http://ftp.daum.net/ubuntu/ lucid/main libsqlite0-dev 2.8.17-6build2 [234kB]
내려받기 234k바이트, 소요시간 0초 (1,979k바이트/초)
전에 선택하지 않은 libsqlite0-dev 패키지를 선택합니다.
(데이터베이스 읽는중 ...현재 129857개의 파일과 디렉토리가 설치되어 있습니다.)
libsqlite0-dev 패키지를 푸는 중입니다 (.../libsqlite0-dev_2.8.17-6build2_amd64.deb에서) ...
libsqlite0-dev (2.8.17-6build2) 설정하는 중입니다 ...
root@Team4Svr:~# apt-get install gawk
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
gawk 패키지는 이미 최신 버전입니다.
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
0개 업그레이드, 0개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
root@Team4Svr:~#
root@Team4Svr:~# apt-get install gcc
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
gcc 패키지는 이미 최신 버전입니다.
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
0개 업그레이드, 0개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
root@Team4Svr:~# apt-get install mt-daapd
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
다음 새 패키지가 전에 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  x11vnc xvnc4viewer tk freenx-session-launcher expect freenx-rdp libvncserver0 freenx-smb freenx-vnc tcl tcl8.5
  freenx-server
이들을 지우기 위해서는 'apt-get autoremove'를 사용하십시오.
다음 패키지를 더 설치할 것입니다:
  javascript-common libavcodec52 libavformat52 libavutil49 libgsm1 libjs-prototype libjs-scriptaculous
  libschroedinger-1.0-0 libtagc0 wwwconfig-common
제안하는 패키지:
  apache2 httpd mysql-client postgresql-client apache apache-ssl
다음 새 패키지를 설치할 것입니다:
  javascript-common libavcodec52 libavformat52 libavutil49 libgsm1 libjs-prototype libjs-scriptaculous
  libschroedinger-1.0-0 libtagc0 mt-daapd wwwconfig-common
0개 업그레이드, 11개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
3,374k바이트 아카이브를 받아야 합니다.
이 작업 후 9,744k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까 [Y/n]?
받기:1 http://ftp.daum.net/ubuntu/ lucid/universe wwwconfig-common 0.2.1 [22.8kB]
받기:2 http://ftp.daum.net/ubuntu/ lucid/universe javascript-common 7 [3,854B]
받기:3 http://ftp.daum.net/ubuntu/ lucid-updates/main libavutil49 4:0.5.1-1ubuntu1.3 [65.8kB]
받기:4 http://ftp.daum.net/ubuntu/ lucid/main libgsm1 1.0.13-3 [29.3kB]
받기:5 http://ftp.daum.net/ubuntu/ lucid/main libschroedinger-1.0-0 1.0.9.is.1.0.8-0ubuntu1 [213kB]
받기:6 http://ftp.daum.net/ubuntu/ lucid-updates/main libavcodec52 4:0.5.1-1ubuntu1.3 [2,207kB]
받기:7 http://ftp.daum.net/ubuntu/ lucid-updates/main libavformat52 4:0.5.1-1ubuntu1.3 [372kB]
받기:8 http://ftp.daum.net/ubuntu/ lucid/universe libjs-prototype 1.6.1-1 [34.9kB]
받기:9 http://ftp.daum.net/ubuntu/ lucid/universe libjs-scriptaculous 1.8.3-1 [127kB]
받기:10 http://ftp.daum.net/ubuntu/ lucid-updates/main libtagc0 1.6.3-0ubuntu1 [14.3kB]
받기:11 http://ftp.daum.net/ubuntu/ lucid/universe mt-daapd 0.9~r1696.dfsg-15build1 [284kB]
내려받기 3,374k바이트, 소요시간 1초 (2,525k바이트/초)
전에 선택하지 않은 wwwconfig-common 패키지를 선택합니다.
(데이터베이스 읽는중 ...현재 129866개의 파일과 디렉토리가 설치되어 있습니다.)
wwwconfig-common 패키지를 푸는 중입니다 (.../wwwconfig-common_0.2.1_all.deb에서) ...
전에 선택하지 않은 javascript-common 패키지를 선택합니다.
javascript-common 패키지를 푸는 중입니다 (.../javascript-common_7_all.deb에서) ...
전에 선택하지 않은 libavutil49 패키지를 선택합니다.
libavutil49 패키지를 푸는 중입니다 (.../libavutil49_4%3a0.5.1-1ubuntu1.3_amd64.deb에서) ...
전에 선택하지 않은 libgsm1 패키지를 선택합니다.
libgsm1 패키지를 푸는 중입니다 (.../libgsm1_1.0.13-3_amd64.deb에서) ...
전에 선택하지 않은 libschroedinger-1.0-0 패키지를 선택합니다.
libschroedinger-1.0-0 패키지를 푸는 중입니다 (.../libschroedinger-1.0-0_1.0.9.is.1.0.8-0ubuntu1_amd64.deb에서) ...
전에 선택하지 않은 libavcodec52 패키지를 선택합니다.
libavcodec52 패키지를 푸는 중입니다 (.../libavcodec52_4%3a0.5.1-1ubuntu1.3_amd64.deb에서) ...
전에 선택하지 않은 libavformat52 패키지를 선택합니다.
libavformat52 패키지를 푸는 중입니다 (.../libavformat52_4%3a0.5.1-1ubuntu1.3_amd64.deb에서) ...
전에 선택하지 않은 libjs-prototype 패키지를 선택합니다.
libjs-prototype 패키지를 푸는 중입니다 (.../libjs-prototype_1.6.1-1_all.deb에서) ...
전에 선택하지 않은 libjs-scriptaculous 패키지를 선택합니다.
libjs-scriptaculous 패키지를 푸는 중입니다 (.../libjs-scriptaculous_1.8.3-1_all.deb에서) ...
전에 선택하지 않은 libtagc0 패키지를 선택합니다.
libtagc0 패키지를 푸는 중입니다 (.../libtagc0_1.6.3-0ubuntu1_amd64.deb에서) ...
전에 선택하지 않은 mt-daapd 패키지를 선택합니다.
mt-daapd 패키지를 푸는 중입니다 (.../mt-daapd_0.9~r1696.dfsg-15build1_amd64.deb에서) ...
man-db에 대한 트리거를 처리하는 중입니다 ...
ureadahead에 대한 트리거를 처리하는 중입니다 ...
ureadahead will be reprofiled on next reboot
wwwconfig-common (0.2.1) 설정하는 중입니다 ...
javascript-common (7) 설정하는 중입니다 ...

libavutil49 (4:0.5.1-1ubuntu1.3) 설정하는 중입니다 ...

libgsm1 (1.0.13-3) 설정하는 중입니다 ...

libschroedinger-1.0-0 (1.0.9.is.1.0.8-0ubuntu1) 설정하는 중입니다 ...

libavcodec52 (4:0.5.1-1ubuntu1.3) 설정하는 중입니다 ...

libavformat52 (4:0.5.1-1ubuntu1.3) 설정하는 중입니다 ...

libjs-prototype (1.6.1-1) 설정하는 중입니다 ...
libjs-scriptaculous (1.8.3-1) 설정하는 중입니다 ...
libtagc0 (1.6.3-0ubuntu1) 설정하는 중입니다 ...

mt-daapd (0.9~r1696.dfsg-15build1) 설정하는 중입니다 ...
Starting mt-daapd: mt-daapd.

libc-bin에 대한 트리거를 처리하는 중입니다 ...
ldconfig deferred processing now taking place
root@Team4Svr:~#
root@Team4Svr:~# service mt-daapd stop
Stopping mt-daapd: mt-daapd.
Waiting for mt-daapd to terminate.....OK, all clear.

root@Team4Svr:~# vi /etc/mt-daapd.conf

...
...
#
# admin_pw (required)
#
# This is the password to the administrative pages
#

admin_pw = input password
...
...
#
# mp3_dir (required)
#
# Location of the mp3 files to share.  Note that because the
# files are stored in the database by inode, these must be
# in the same physical filesystem.
#

mp3_dir = /DataCenter/Music
...
...

root@Team4Svr:~# service mt-daapd start


이렇게 하면 아이튠즈에서 아이튠즈 서버가 보인다.  
그러나, 한참을 기다려도 음악파일 목록 따위는 보이지 않고, 뺑글뺑글 돌아가는 서버이름만.....ㅡ.ㅜ
아이튠즈 10.5 이상은 패치를 해야만 한다.



패치 방법은 아래와 같다. 
이번엔 길어서 패치과정을 뺐다.

root@Team4Svr:~# service mt-daapd stop
root@Team4Svr:~# aptitude install gpa devscripts debhelper dpatch libflac-dev libvorbis-dev libmpcdec-dev libavcodec-dev libavformat-dev libid3tag0-dev libtagc0-dev libavahi-client-dev libsqlite3-dev libjs-prototype libjs-scriptaculous avahi-daemon autotools-dev
....
....
root@Team4Svr:~# mkdir ~/mt-daapd
root@Team4Svr:~# cd ~/mt-daapd
root@Team4Svr:~# apt-get source mt-daapd
...
...
...

root@Team4Svr:~# cd ~/mt-daapd/mt-daapd-0.9~r1696.dfsg/debian/patches/
root@Team4Svr:~# wget http://www.zero-factorial.com/coding/21_itunes10.5.dpatch
root@Team4Svr:~# echo 21_itunes10.5.dpatch >> 00list
root@Team4Svr:~# cd ../..
root@Team4Svr:~# dch -i "Fix for iTunes 10"
root@Team4Svr:~# debuild -us -uc
...
...
...
root@Team4Svr:~# cd ../../..
root@Team4Svr:~# sudo dpkg -i mt-daapd_0.9~r1696.dfsg-15build2_amd64.deb
...
...
root@Team4Svr:~# service mt-daapd start

 

위와 같이 작업하면 일단 아이튠즈에서 서버가 떠있는 것은 확인할 수 있다. 아이튠즈 서버 관리는 웹브라우저를 통해서도 가능하다.
아이피 주소와 포트번호만 넣어주면 된다. 본인의 경우는 http://192.168.10.5:3689 로 입력하였다. 
 그러면 아래와 같은 화면을 볼 수 있을 것이다. 
사용자 이름은 admin 비밀번호는  mt-daapd.conf 에서 입력한 패스워드를 입력하면 된다.


일단, configuration 항목에 가서 Music Folder의 위치를 입력한다.
여기까지만해도 아이튠즈에서 음악파일 목록을 확인할 수 있을 것이다.


Smart playlists로 음악파일의 목록을 만들어주면, 좀더 심플한 목록을 볼 수 있지만..
이 작업은 노가다가 심하다는 단점이 있다. ㅡㅡ;;
나중에 이것을 어떻게 간단하게 만들어 줄수 있는지 연구(?)해 볼 참이다.



위의 작업이 끝났으면 아래와 같이 아이튠즈에서도, iPhone에서도, 안드로이드에서도 우리의 홈서버가 보유하고 있는 모든 음악을 서비스 받을 수 있다. 



 




09. NTFS 마운트 하기 또는 cp를 이용한 데이터 백업 [NAS 구축기][ubuntu 10.4]

얼렁뚱땅설명서 2012. 3. 1. 22:57

NAS에 대한 고민은 그동안 날려먹은 수 많은 하드디스크의 데이터 때문이었다.
수 많은 밤을 꼴딱새고, 멍한 정신 상태에서 파티션을 날려먹거나 포맷을 한다거나,
삭제 버튼을 눌러버리는 일은 참으로 흔하고 소소한 일들이었다. 시간도 얼마 걸리지 않는다.
그러고 나면, 그 멍한 정신상태에서 다시 복구를 위한 작업에 착수한다.
FinalData 라든가 LiveData라는 결코 가까지 하고 싶지 않은 프로그램을 설치하고 
수 많은 시간들을 기다려야 했다.
그러고 나면, 살리는 데이터 반, 날리는 데이터 반이였다.
아~씨바, 다시는 이런 일로 밤새우지 않으리라... 다짐 했건만...ㅡ.ㅜ


하여간, SSH를 이용한 원격드라이브의 설정까지 무사히 끝냈다면, 
이젠 하드디스크를 하나둘씩 추가하여 용량을 늘일 차례이다.
추가되는 하드디스크는 마운트를 해서 사용한다. 
기본 적인 마운트/언 마운트 명령은 아래의 명령을 이용해서 작업한다.

root@homesvr:/# mount -t ext4 /dev/sde1 /mnt

명령은 mount -t [파일시스템유형] [마운트할장치] [마운트할디렉토리] 로 구성된다.
언 마운트는 좀더 간단하다. 
명령 구성은 umount [마운트한디렉토리] 이다.

root@homesvr:/# umount /mnt


윈도우에서 사용하는 파일시스템 유형은 NTFS이다. 
NTFS를 읽기/쓰기가 가능하도록 마운트하기 위해서는 약간의 수고로움이 있다.
즉, 프로그램 하나를 설치 해야 한다.

root@homesvr:/# apt-get install ntfs-3g
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
ntfs-3g 패키지는 이미 최신 버전입니다.
0개 업그레이드, 0개 새로 설치, 0개 지우기 및 0개 업그레이드 안 함.
root@homesvr:/# (이미 설치 했다는 군요.)
root@homesvr:/# mount -t ntfs-3g /dev/sde1 /mnt


지금까지는 마운트할 하드디스크가 이미 포맷되어 있다는 가정으로 한것이다.
그러나, 처음 하드디스크를 구입할 때는 포맷이 되어 있지 않다.
하드디스크의 포맷은 아래의 그림처럼 GParted를 사용하면 간단히 끝낼 수 있다.
 



마운트 명령을 이용해서 마운트한 하드디스크는 시스템이 리붓되면, 마운트가 되지 않은 상태로 올라온다.
이것을 방지하기 위해서는 /etc/fstab 등록해 주면 된다. 아래는 본인의 서버에 설정된 fstab 이다.
add Disk 라인 위는 시스템이 알아서 설정한 부분이며, 아래의 붉은 줄은 본인이 입력해서 넣은 것이다.

UUID 대신 마운트할 때처럼 /dev/sde1 과 같이 입력해도 마운트가 되는 것으로 안다.
그러나 권장사항이 UUID를 사용하는 것 같다. 맨 아래의 NTFS 하드디스크를 마운트한 것이다.

root@homesvr:/# vi /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=e544659b-d683-4e82-a2c3-8b582d1257da /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=037ff56d-08ba-4abb-a555-7ed9a68bdb91 none            swap    sw              0       0

############# add Disk #############
## /dev/sdb1
UUID=acb938e8-36ae-4cd1-b1c1-49661d5d1a45 /DataCenter               ext4    errors=remount-ro 0       1
## /dev/sdc1
UUID=5bd2619a-f0e7-4d74-bb43-baf2f5054acc /DutyDisk               ext4    errors=remount-ro 0       1
## /dev/sdd1
UUID=f6804a34-4094-480d-9fa9-186bdabe0e25 /BackupDisk               ext4    defaults   0       2
## /dev/sde1
UUID=E0C62960C62937E4  /NtfsBackup     ntfs-3g defaults,locale=ko_KR.UTF-8     0       0 


UUID는 아래의 명령으로 확인할 수 있다.
 

root@HomeSvr:~# ls -l /dev/disk/by-uuid/
합계 0
lrwxrwxrwx 1 root root 10 2011-11-10 01:06 037ff56d-08ba-4abb-a555-7ed9a68bdb91 -> ../../sda5
lrwxrwxrwx 1 root root 10 2011-11-10 01:06 4a1bf1a9-e9d0-472d-9878-3a98692d3adf -> ../../sda1
lrwxrwxrwx 1 root root 10 2011-11-10 01:06 9fa8485a-dae0-4e50-85be-e5181d37af15 -> ../../sdc1
lrwxrwxrwx 1 root root 10 2011-11-10 01:06 E0C62960C62937E4 -> ../../sde1
lrwxrwxrwx 1 root root 10 2011-11-10 01:06 acb938e8-36ae-4cd1-b1c1-49661d5d1a45 -> ../../sdb1

또는 ....

root@HomeSvr:/# blkid
/dev/ramzswap0: TYPE="swap"
/dev/sdc1: UUID="9fa8485a-dae0-4e50-85be-e5181d37af15" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb1: LABEL="DataCenter" UUID="acb938e8-36ae-4cd1-b1c1-49661d5d1a45" TYPE="ext4"
/dev/sdd1: LABEL="BackUp" UUID="f6804a34-4094-480d-9fa9-186bdabe0e25" TYPE="ext4"
/dev/sda1: UUID="4a1bf1a9-e9d0-472d-9878-3a98692d3adf" TYPE="ext4"
/dev/sda5: UUID="037ff56d-08ba-4abb-a555-7ed9a68bdb91" TYPE="swap"
/dev/sde1: LABEL="Linux4Windows" UUID="E0C62960C62937E4" TYPE="ntfs"



마지막으로 백업에 대해서 이야기 하겠다. 나의 경우는 콜드 백업을 선호한다. 즉, 복사본을 따로 만들어 두는 것을 선호한다.
레이드의 경우, 한계가 많기 때문에 사용하지 않는다. 일단은 나와 같이 저렴한 비용으로 서버를 구축하고자 하면, 메인보드에 내장된 레이드 컨트롤러를 사용하는 것일 일반적인데 2T~3T를 넘어가면 레이드가 깨진다고 한다. 그리고, 정말 중요한 것은 사람이 손으로 삭제한 것은 레이드 따위가 막아줄 수 있는 것이 아니다. 그건 정말 지워진거다. ㅡㅡ^

그래서 나의 경우는 그냥 그때 그때 복사하는 방법을 선호한다. 그것도 중요한 데이터만...
리눅스의 cp 명령은 생각보다 많은 기능들을 제공해준다. 예를 들어 복사 대상파일이 이미 있는 경우 파일 사이즈나 업데이트 시간이 달라야 복사한다거나 중복될 경우 백업본을 자동으로 만들어준다거나 하는 기능이 있다.
그러나 나의 경우는 자동으로 백업본을 만드는 일따위는 안하며, 같은 파일을 다시 복사하는 일만 안하도록 한다. 심플하게!


아래는 백업을 위한 스크립트다. 간단히 설명하면,

1) 서버의 시간을 맞춘다.
2) /dev/sdd1을 /BackupDisk 라는 폴더에 마운트 한다.
3) 원하는 데이터를 복사한다. 복사 옵션에 -Ru를 붙여서, 복사한 파일을 다시 복사하는 일은 없도록 한다.
4) 복사가 끝나면  /dev/sdd1 의 마운트를 해제 한다.
5) NTFS로 포맷된 디스크가 한번더 2~4의 작업을 반복한다.
6) 백업완료 시간을 화면에 출력한다.

mount와 umount를 반복하는 이유는 누군가 루트에서 [rm -rf * ]를 실행하는 천인공노할 일로 부터 보호하기 위해서다.
이런 일이 없을 것 같지만... 사실 빈번하게 일어난다. 난 아직 루트에서는 해본적 없다. ^^;

root@homesvr:~# mkdir /root/MgrScript
root@homesvr:~# vi /root/MgrScript/backup.sh
#/bin/sh

## 일단 시간을 맞춘다.
/usr/bin/rdate -s time.bora.net

mount -t ext4 /dev/sdd1 /BackupDisk
cp -Ru /DataCenter/* /BackupDisk/DataCenter
cp -Ru /home/* /BackupDisk/home
umount /BackupDisk

ntfs-3g /dev/sde1 /NtfsBackup -o locale=ko_KR.UTF-8
cp -Ru /DataCenter/* /NtfsBackup/DataCenter
cp -Ru /home/* /NtfsBackup/home
umount /NtfsBackup 

echo `date -d today` -end backup



그러나, 이 백업 스크립트를 틈나는 대로 돌릴 수는 없는 일이다.
이걸 cron에 등록하여 때마다 알아서 수행하도록 해준다.
난 이것을 매일 새벽 두시에 수행될 수 있도록 했다.

# export EDITOR=vi
# crontab -e
# m h  dom mon dow   command
0 2 * * * /root/MgrScript/backup.sh >> /root/MgrScript/backup.log  <-- 입력

root@homesvr:~# cd /var/spool/cron/crontabs/
root@homesvr:/var/spool/cron/crontabs# cat root <--- 등록된 것을 확인할 수 있다.
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.ITyvFs/crontab installed on Thu Mar  1 22:53:39 2012)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
# m h  dom mon dow   command
0 2 * * * /root/MgrScript/backup.sh >> /root/MgrScript/backup.log
root@homesvr:/var/spool/cron/crontabs# 


끝.