designevo

Logo通過DesignEvo設計製作

2009年4月8日 星期三

Bacula Backup 安裝

Bacula 是一個 Linux 的 Open Source 的備份軟體,並適用於一般企業,可以讓管理者進行網路備份管理,復原和驗証電腦資料。

我們可以從 http://sourceforge.net/projects/bacula 來下載套件,目前我們可以用的最新版本是 2.4.4。

Step 1. 把套件取得解開到工作目錄

#tar -zxvf bacula-2.4.4.tar.gz
# cd bacula-2.4.4

Step 2. 準備進行套件的編譯

由於我是用 mysql 來做DB參數要用 --with-mysql,我用root安裝並要放程式放在 /root/bacula/bin 的目錄下,因此 configure 的參數如下:

#./configure --sbindir=$HOME/bacula/bin --sysconfdir=$HOME/bacula/bin --with-pid-dir=$HOME/bacula/bin/working --with-subsys-dir=$HOME/bacula/bin/working --enable-smartalloc --with-mysql --with-working-dir=$HOME/bacula/bin/working --with-dump-email=name@host.com --with-job-email=name@host.com --with-smtp-host=localhost

結果輸出如下:
checking for acltotext in -lsec... no
checking for pthread_create in -lpthread... yes
configure: creating ./config.status
config.status: creating autoconf/Make.common
config.status: creating Makefile
config.status: creating manpages/Makefile
config.status: creating scripts/startmysql
config.status: creating scripts/stopmysql
config.status: creating scripts/btraceback
config.status: creating scripts/startit
config.status: creating scripts/stopit
config.status: creating scripts/bconsole
config.status: creating scripts/gconsole
config.status: creating scripts/bacula
config.status: creating scripts/bacula-ctl-dir
config.status: creating scripts/bacula-ctl-fd
config.status: creating scripts/bacula-ctl-sd
config.status: creating scripts/devel_bacula
config.status: creating scripts/Makefile
config.status: creating scripts/logrotate
config.status: creating scripts/bacula.desktop.gnome1
config.status: creating scripts/bacula.desktop.gnome2
config.status: creating scripts/bacula.desktop.gnome1.consolehelper
config.status: creating scripts/bacula.desktop.gnome2.consolehelper
config.status: creating scripts/bacula.desktop.gnome1.xsu
config.status: creating scripts/bacula.desktop.gnome2.xsu
config.status: creating scripts/bgnome-console.console_apps
config.status: creating scripts/mtx-changer
config.status: creating scripts/disk-changer
config.status: creating scripts/dvd-handler
config.status: creating scripts/dvd-simulator
config.status: creating scripts/bacula-tray-monitor.desktop
config.status: creating scripts/logwatch/Makefile
config.status: creating scripts/logwatch/logfile.bacula.conf
config.status: creating scripts/wxconsole.console_apps
config.status: creating scripts/wxconsole.desktop.consolehelper
config.status: creating scripts/wxconsole.desktop.xsu
config.status: creating scripts/bat.desktop
config.status: creating scripts/bat.desktop.xsu
config.status: creating scripts/bat.desktop.consolehelper
config.status: creating scripts/bat.console_apps
config.status: creating src/Makefile
config.status: creating src/host.h
config.status: creating src/console/Makefile
config.status: creating src/console/bconsole.conf
config.status: creating src/gnome2-console/Makefile
config.status: creating src/gnome2-console/bgnome-console.conf
config.status: creating src/qt-console/bat.conf
config.status: creating src/qt-console/bat.pro
config.status: creating src/qt-console/install_conf_file
config.status: creating src/wx-console/Makefile
config.status: creating src/wx-console/bwx-console.conf
config.status: creating src/tray-monitor/Makefile
config.status: creating src/tray-monitor/tray-monitor.conf
config.status: creating src/dird/Makefile
config.status: creating src/dird/bacula-dir.conf
config.status: creating src/lib/Makefileconfig.status: creating src/stored/Makefile
config.status: creating src/stored/bacula-sd.conf
config.status: creating src/filed/Makefile
config.status: creating src/filed/bacula-fd.conf
config.status: creating src/cats/Makefile
config.status: creating src/cats/make_catalog_backup
config.status: creating src/cats/delete_catalog_backup
config.status: creating src/cats/create_postgresql_database
config.status: creating src/cats/update_postgresql_tables
config.status: creating src/cats/make_postgresql_tables
config.status: creating src/cats/grant_postgresql_privileges
config.status: creating src/cats/drop_postgresql_tables
config.status: creating src/cats/drop_postgresql_database
config.status: creating src/cats/create_mysql_database
config.status: creating src/cats/update_mysql_tables
config.status: creating src/cats/make_mysql_tables
config.status: creating src/cats/grant_mysql_privileges
config.status: creating src/cats/drop_mysql_tables
config.status: creating src/cats/drop_mysql_database
config.status: creating src/cats/create_sqlite_database
config.status: creating src/cats/update_sqlite_tables
config.status: creating src/cats/make_sqlite_tables
config.status: creating src/cats/grant_sqlite_privileges
config.status: creating src/cats/drop_sqlite_tables
config.status: creating src/cats/drop_sqlite_database
config.status: creating src/cats/create_sqlite3_database
config.status: creating src/cats/update_sqlite3_tables
config.status: creating src/cats/make_sqlite3_tables
config.status: creating src/cats/grant_sqlite3_privileges
config.status: creating src/cats/drop_sqlite3_tables
config.status: creating src/cats/drop_sqlite3_database
config.status: creating src/cats/sqlite
config.status: creating src/cats/mysql
config.status: creating src/cats/create_bdb_database
config.status: creating src/cats/update_bdb_tables
config.status: creating src/cats/make_bdb_tables
config.status: creating src/cats/grant_bdb_privileges
config.status: creating src/cats/drop_bdb_tables
config.status: creating src/cats/drop_bdb_database
config.status: creating src/cats/create_bacula_database
config.status: creating src/cats/update_bacula_tables
config.status: creating src/cats/grant_bacula_privileges
config.status: creating src/cats/make_bacula_tables
config.status: creating src/cats/drop_bacula_tables
config.status: creating src/cats/drop_bacula_database
config.status: creating src/findlib/Makefile
config.status: creating src/tools/Makefile
config.status: creating po/Makefile.in
config.status: creating platforms/Makefile
config.status: creating platforms/redhat/Makefile
config.status: creating platforms/redhat/bacula-fd
config.status: creating platforms/redhat/bacula-sd
config.status: creating platforms/redhat/bacula-dir
config.status: creating platforms/redhat/bacula.spec
config.status: creating src/config.h
config.status: executing default-1 commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing default commands
Doing make of dependencies
==>Entering directory /Download/bacula-2.4.4/src
make[1]: Entering directory `/Download/bacula-2.4.4/src'
make[1]: Nothing to be done for `depend'.
make[1]: Leaving directory `/Download/bacula-2.4.4/src'
==>Entering directory /Download/bacula-2.4.4/scripts
make[1]: Entering directory `/Download/bacula-2.4.4/scripts'
make[1]: `depend' is up to date.
make[1]: Leaving directory `/Download/bacula-2.4.4/scripts'
==>Entering directory /Download/bacula-2.4.4/src/lib
make[1]: Entering directory `/Download/bacula-2.4.4/src/lib'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/lib'
==>Entering directory /Download/bacula-2.4.4/src/findlib
make[1]: Entering directory `/Download/bacula-2.4.4/src/findlib'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/findlib'
==>Entering directory /Download/bacula-2.4.4/src/filed
make[1]: Entering directory `/Download/bacula-2.4.4/src/filed'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/filed'
==>Entering directory /Download/bacula-2.4.4/src/console
make[1]: Entering directory `/Download/bacula-2.4.4/src/console'
conio.c:82:21: error: termcap.h: No such file or directory
make[1]: *** [depend] Error 1
make[1]: Leaving directory `/Download/bacula-2.4.4/src/console'
==>Entering directory /Download/bacula-2.4.4/src/cats
make[1]: Entering directory `/Download/bacula-2.4.4/src/cats'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/cats'
==>Entering directory /Download/bacula-2.4.4/src/dird
make[1]: Entering directory `/Download/bacula-2.4.4/src/dird'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/dird'
==>Entering directory /Download/bacula-2.4.4/src/stored
make[1]: Entering directory `/Download/bacula-2.4.4/src/stored'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/stored'
==>Entering directory /Download/bacula-2.4.4/src/tools
make[1]: Entering directory `/Download/bacula-2.4.4/src/tools'
make[1]: Leaving directory `/Download/bacula-2.4.4/src/tools'
==>Entering directory /Download/bacula-2.4.4/manpages
make[1]: Entering directory `/Download/bacula-2.4.4/manpages'
make[1]: Nothing to be done for `depend'.
make[1]: Leaving directory `/Download/bacula-.4.4/manpages'

Configuration on Wed Apr 8 14:55:29 CST 2009:
Host: i686-pc-linux-gnu -- redhat
Bacula version: 2.4.4 (28 December 2008)
Source code location: .
Install binaries: /root/bacula/bin
Install config files: /root/bacula/bin
Scripts directory: /root/bacula/bin
Archive directory:
Working directory: /root/bacula/bin/working PID directory: /root/bacula/bin/working
Subsys directory: /root/bacula/bin/working
Man directory: ${datarootdir}/man
Data directory: ${prefix}/share
C Compiler: gcc 4.1.2
C++ Compiler: /usr/bin/g++ 4.1.2
Compiler flags: -g -O2 -Wall -fno-strict-aliasing -fno-exceptions -fno-rtti
Linker flags: -O
Libraries: -lpthread
Statically Linked Tools: no
Statically Linked FD: no
Statically Linked SD: no
Statically Linked DIR: no
Statically Linked CONS: no
Database type: MySQL
Database lib: -L/usr/lib/mysql -lmysqlclient_r -lz
Database name: bacula
Database user: bacula
Job Output Email: name@host.com
Traceback Email: name@host.com
SMTP Host Address: localhost
Director Port: 9101
File daemon Port: 9102
Storage daemon Port: 9103
Director User:
Director Group:
Storage Daemon User:
Storage DaemonGroup:
File Daemon User:
File Daemon Group:
SQL binaries Directory /usr/bin
Large file support: yes
Bacula conio support: no
readline support: no
TCP Wrappers support: no
TLS support: no
Encryption support: no
ZLIB support: yes
enable-smartalloc: yes
bat support: no
enable-gnome: no
enable-bwx-console: no
enable-tray-monitor:
client-only: no
build-dird: yes
build-stored: yes
ACL support: no
Python support: no
Batch insert enabled: yes

過程中有錯誤發生!!!
conio.c:82:21: error: termcap.h: No such file or directory
make[1]: *** [depend] Error 1

由於發現需要 termcap.h 的標頭檔案,而該檔案是在libtermcap-devel套件中, 所以我使用centos可以用 yum install libtermcap-devel來取得。
所以我們重新再作一次 ./configure

# make distclean

make[1]: Entering directory `/Download/bacula-2.4.4/src'(cd gnome2-console && make clean)make[2]: Entering directory `/Download/bacula-2.4.4/src/gnome2-console'
make[2]: Leaving directory `/Download/bacula-2.4.4/src/gnome2-console'if test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src'(cd gnome2-console && make clean)make[3]: Entering directory `/Download/bacula-2.4.4/src/gnome2-console'
make[3]: Leaving directory `/Download/bacula-2.4.4/src/gnome2-console'
make[2]: Leaving directory `/Download/bacula-2.4.4/src'
make[1]: Leaving directory `/Download/bacula-2.4.4/src'
make[1]: Entering directory `/Download/bacula-2.4.4/scripts'
make[1]: Leaving directory `/Download/bacula-2.4.4/scripts'
make[1]: Entering directory `/Download/bacula-2.4.4/src/lib'
/bin/rm -f *.a core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3/bin/rm -f rwlock_test md5sum sha1sum/bin/rm -f tagsif test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/lib'/bin/rm -f *.a core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3
/bin/rm -f rwlock_test md5sum sha1sum/bin/rm -f tags
make[2]: Leaving directory `/Download/bacula-2.4.4/src/lib'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/lib'
make[1]: Entering directory `/Download/bacula-2.4.4/src/findlib'
/bin/rm -f find core a.out *.a *.o *.bak *~ *.intpro *.extpro 1 2 3/bin/rm -f tagsif test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/findlib'
/bin/rm -f find core a.out *.a *.o *.bak *~ *.intpro *.extpro 1 2 3/bin/rm -f tags
make[2]: Leaving directory `/Download/bacula-2.4.4/src/findlib'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/findlib'
make[1]: Entering directory `/Download/bacula-2.4.4/src/filed'if test -f win32/Makefile; then \ (cd win32; make clean); \ fiif test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/filed'if test -f win32/Makefile; then \ (cd win32; make clean); \ fi
make[2]: Leaving directory `/Download/bacula-2.4.4/src/filed'(cd .; /bin/rm -f Makefile)if test -f win32/Makefile; then \ (cd win32; make distclean); \ fi
make[1]: Leaving directory `/Download/bacula-2.4.4/src/filed'
make[1]: Entering directory `/Download/bacula-2.4.4/src/console'if test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/console'
make[2]: Leaving directory `/Download/bacula-2.4.4/src/console'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/console'
make[1]: Entering directory `/Download/bacula-2.4.4/src/cats'
/bin/rm -f cats core a.out *.o *.a *.bak *~ *.intpro *.extpro 1 2 3
/bin/rm -f tags
/bin/rm -f create_bacula_database update_bacula_tables make_bacula_tables
/bin/rm -f grant_bacula_privileges drop_bacula_tables drop_bacula_database
/bin/rm -f create_bdb_database update_bdb_tables make_bdb_tables
/bin/rm -f grant_bdb_privileges drop_bdb_tables drop_bdb_database
/bin/rm -f create_mysql_database update_mysql_tables make_mysql_tables
/bin/rm -f grant_mysql_privileges drop_mysql_tables drop_mysql_database
/bin/rm -f create_postgresql_database update_postgresql_tables make_postgresql_tables
/bin/rm -f grant_postgresql_privileges drop_postgresql_tables drop_postgresql_database
/bin/rm -f create_sqlite_database update_sqlite_tables make_sqlite_tables
/bin/rm -f grant_sqlite_privileges drop_sqlite_tables drop_sqlite_database
/bin/rm -f create_sqlite3_database update_sqlite3_tables make_sqlite3_tables
/bin/rm -f grant_sqlite3_privileges drop_sqlite3_tables drop_sqlite3_database
/bin/rm -f mysql sqlite postgresql
/bin/rm -f make_catalog_backup delete_catalog_backupif test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/cats'
/bin/rm -f cats core a.out *.o *.a *.bak *~ *.intpro *.extpro 1 2 3/bin/rm -f tags
/bin/rm -f create_bacula_database update_bacula_tables make_bacula_tables
/bin/rm -f grant_bacula_privileges drop_bacula_tables drop_bacula_database
/bin/rm -f create_bdb_database update_bdb_tables make_bdb_tables
/bin/rm -f grant_bdb_privileges drop_bdb_tables drop_bdb_database
/bin/rm -f create_mysql_database update_mysql_tables make_mysql_tables
/bin/rm -f grant_mysql_privileges drop_mysql_tables drop_mysql_database
/bin/rm -f create_postgresql_database update_postgresql_tables make_postgresql_tables
/bin/rm -f grant_postgresql_privileges drop_postgresql_tables drop_postgresql_database
/bin/rm -f create_sqlite_database update_sqlite_tables make_sqlite_tables
/bin/rm -f grant_sqlite_privileges drop_sqlite_tables drop_sqlite_database
/bin/rm -f create_sqlite3_database update_sqlite3_tables make_sqlite3_tables
/bin/rm -f grant_sqlite3_privileges drop_sqlite3_tables drop_sqlite3_database
/bin/rm -f mysql sqlite postgresql
/bin/rm -f make_catalog_backup delete_catalog_backup
make[2]: Leaving directory `/Download/bacula-2.4.4/src/cats'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/cats'
make[1]: Entering directory `/Download/bacula-2.4.4/src/dird'if test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/dird'
make[2]: Leaving directory `/Download/bacula-2.4.4/src/dird'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/dird'
make[1]: Entering directory `/Download/bacula-2.4.4/src/stored'if test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/stored'
make[2]: Leaving directory `/Download/bacula-2.4.4/src/stored'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/stored'
make[1]: Entering directory `/Download/bacula-2.4.4/src/tools'if test . = .; then make realclean; fi
make[2]: Entering directory `/Download/bacula-2.4.4/src/tools'
make[2]: Leaving directory `/Download/bacula-2.4.4/src/tools'(cd .; /bin/rm -f Makefile)
make[1]: Leaving directory `/Download/bacula-2.4.4/src/tools'
make[1]: Entering directory `/Download/bacula-2.4.4/manpages'/bin/rm -f *~ 1 2 3 *.bak/bin/rm -f Makefile
make[1]: Leaving directory `/Download/bacula-2.4.4/manpages'
==>Entering directory /Download/bacula-2.4.4/platforms
make[1]: Entering directory `/Download/bacula-2.4.4/platforms'
make[2]: Entering directory `/Download/bacula-2.4.4/platforms/redhat'
make[2]: Leaving directory `/Download/bacula-2.4.4/platforms/redhat'
make[1]: Leaving directory `/Download/bacula-2.4.4/platforms'


configure 都沒有錯誤訊息就可以進行 make 的動作。

#make

make 都沒有錯誤就可以進行 make install 來安裝套件

#make install

step 3. 在安裝完後要設定 mysql 的 datebase

在解開的 bacula-2.4.4 的 src/cat 下有一個 mysql 用的資料庫產生指令 make_mysql_tables來建立 database。

#cd src/cat
# ./make_mysql_tables

step 4. 要設定 bacula_sd 的 archive 設備

我們可以將目錄位置設給 bacula 做 archive 的設備.

#mkdir /root/bacula/archive

並在 bacula-sd.conf 設定相關目錄就可以用

Device {
Name = FileStorage
Media Type = File
Archive Device = /root/bacula/archive
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
RemovableMedia = no Always
Open = no
}

正確完成之後我們要再建一個 bacula 專用的帳號,並設定相關權限就算完成 bacula 的安裝。

沒有留言:

資料無價

做資訊的都知道 資料備份 很重要,但當資料因不可抗力或人為失誤弄掉了!  到底會想要花多少錢來救資料? 答案常常是越少越好~  最好是 免費 .... 那誰會要去救 .... 買備份設備就跟買保險一樣,有備無患,但重要的是有沒有買對設備,有備份也要有還原測試驗証,而且最好要一段時...