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