1. download tarball

2.
tar zxvf bacula-1.38.11.tar.gz

cd bacula-1.38.11

bacula server 編譯
./configure –prefix=/usr/local/bacula –with-mysql
make distclean
make
make install

開機啟動安裝
make install-autostart

3. 建立資料庫
cd /usr/local/bacula/etc
./create_mysql_database
./grant_mysql_privileges
./make_mysql_tables

測式設定檔
/usr/local/bacula/sbin/bacula-dir -t -c /usr/local/bacula/etc/bacula-dir.conf
/usr/local/bacula/sbin/bacula-fd -t -c /usr/local/bacula/etc/bacula-fd.conf
/usr/local/bacula/sbin/bacula-sd -t -c /usr/local/bacula/etc/bacula-sd.conf
/usr/local/bacula/sbin/bconsole -t -c /usr/local/bacula/etc/bconsole.conf

啟動 bacula,這個會啟動 dir、sd、fd
/usr/local/bacula/etc/bacula start

4. vi /usr/local/bacula/etc/bacula-sd.conf

Device {
   Name = FileStorage
   Media Type = File      # 以檔案方式存在硬碟目錄上
   Archive Device = /usr/local/bacula/tmp   # 備份後存放位置
   LabelMedia = yes;
   Random Access = Yes;
   AutomaticMount = yes;
   RemovableMedia = no;
   AlwaysOpen = no;
}

Archive Device預設是放於 /tmp,但我想集中放在 /usr/local/bacula,記得,mkdir /usr/local/bacula/tmp

這個 File Daemon基本上不用變動什麼
vi /usr/local/bacula/etc/bacula-fd.conf

FileDaemon {
   Name = cross-fd
   FDport = 9102
   WorkingDirectory = /usr/local/bacula/var/bacula/working
   Pid Directory = /var/run
   Maximum Concurrent Jobs = 20
}

備份 bacula server本機檔案
新增設定
vi /usr/local/bacula/etc/bacula-dir.conf

## [ localhost | lab100 ]
Job {
  Name = "bac-lab100"
  Type = "Backup"
  Level = Incremental # default
  Client = "lab100-fd"
  FileSet = "fileset-lab100"
  Schedule = "WeeklyCycle"
  Storage = "bac-file-lab100"
  Messages = "Standard"
  Pool = "Default"
  Write Bootstrap = "/usr/local/bacula/var/bacula/working/lab100.bsr"
  Priority = 12
}

FileSet {
  Name = "fileset-lab100"
  Include {
               Options {
                             compression=GZIP
                             signature = MD5
               }
               File = /var/www
               File = /etc
  }
}

Storage {
  Name = bac-file-lab100
  Address = lab100
  SDPort = 9103
  Password = "smocpassword"
  Device = FileStorage
  Media Type = File
}
## [ localhost | lab100 ] END

   /usr/local/bacula/etc/bacula restart

5. 從 Console執行 job
/usr/local/bacula/etc/bconsole

(自訂標籤,將備份存在這自訂的名稱,放於路徑/usr/local/bacula/tmp)
*label

   輸入 bac-file-lab100

立即執行一備份工作
*run

      選擇 'bac-lab100' -> yes

      主機上的 bacula資料庫備份預設 Job名稱為 BackupCatalog進行中

備份遠端 Client主機
先在主機上編譯 Client程式
./configure –prefix=/usr/local/bacula –enable-client-only
make distclean
make
make install

開機啟動,只有 File Daemon

make install-autostart-fd

在 Client主機上修改 Director的Name
vi /usr/local/bacula/etc/bacula-fd.conf

Director {
   #Name = lab100-dir
   Name = cross-dir
   Password = "smocpassword"
}

#
# Restricted Director, used by tray-monitor to get the
# status of the file daemon
#
Director {
   #Name = lab100-mon
   Name = cross-dir
   Password = "smocpassword"
   Monitor = yes
}

   /usr/local/bacula/etc/bacula-ctl-fd restart

Bacula Server

vi /usr/local/bacula/etc/bacula-dir.conf

## [ gateway ]
Job {
  Name = "bac-gw"
  Type = "Backup"
  Level = Incremental
  Client = "router-fd"
  FileSet = "fileset-gw"
  Schedule = "WeeklyCycle"
  Storage = "bac-file-gw"
  Messages = "Standard"
  Pool = "Default"
  Write Bootstrap = "/usr/local/bacula/var/bacula/working/gw.bsr"
  Priority = 12
}

FileSet {
  Name = "fileset-gw"
  Include {
               Options {
                             compression=GZIP
                             signature = MD5
               }
               File = /var/www
               File = /etc
               File = /var/named
               File = /usr/local/MIDAS
  }
}

Client {
  Name = "router-fd"
  Address = "192.168.1.1"
  FDPort = "9102"
  Catalog = MyCatalog
  Password = "smocpassword"
  File Retention = 30 days
  Job Retention = 6 months
  AutoPrune = yes
}

Storage {
  Name = bac-file-gw
  Address = lab100
  SDPort = 9103
  Password = "smocpassword"
  Device = FileStorage
  Media Type = File
}
## [ gateway ] END

   /usr/local/bacula/etc/bacula-ctl-dir restart

Building RPM
1. cd bacula-1.38.11/platforms/redhat/

2. vi bacula.spec

#%define fc4 0
# 改為
%define fc4 1

%define mysql4 1

3. rpmbuild -ba bacula.spec

或者直接執行
rpmbuild -ba –define "build_fc4 1" –define "build_mysql4 1" bacula.spec

發現沒檔案,到這邊下載
wget http://nchc.dl.sourceforge.net/sourceforge/bacula/depkgs-25Jun06.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/bacula/bacula-docs-1.38.11-1.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/bacula/bacula-rescue-1.8.6.tar.gz

Related posts 相關文章
備份 VSCode 設定
More...
Linux 救援光碟 SystemRescueCd,支援Windows,也可以遠端備份還原
More...
使用 mondo 線上備份linux centos 系統
More...
linux 的 dd + nc 線上備份主機硬碟
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。