标签:how to install bacula server on debian 8
localhost IP 192.168.81.131
/etc/hosts
root@debian:~# vim /etc/hosts 192.168.81.131 server 192.168.81.128 client
vim /etc/apt/sources.list
[In China ] root@debian:~# vim /etc/apt/sources.list deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free sudo apt-get update
Install Mysql bacula
root@debian:~# apt-get install mysql-server 【Enter】 root@debian:~# apt-get install bacula-server bacula-client 【yes】
root@debian:~# chmod 755 /etc/bacula/scripts/delete_catalog_backup root@debian:~# mkdir -p /bacula/backup /bacula/restore root@debian:~# chown -R bacula:bacula /bacula/ root@debian:~# chmod -R 700 /bacula/
[Director Configuration]
root@debian:~# cp /etc/bacula/bacula-dir.conf /etc/bacula/bacula-dir.conf.bak root@debian:~# vim /etc/bacula/bacula-dir.conf root@debian:~# sed -i ‘s/BackupClient1/BackupLocalFiles/g‘ /etc/bacula/bacula-dir.conf root@debian:~# sed -i ‘s/RestoreFiles/RestoreLocalFiles/g‘ /etc/bacula/bacula-dir.conf root@debian:~# sed -i ‘s@Where = /nonexistant/path/to/file/archive/dir/bacula-restores@Where = /bacula/restore/@g‘ /etc/bacula/bacula-dir.conf root@debian:~# grep Where /etc/bacula/bacula-dir.conf Where = /bacula/restore/ root@debian:~# vim /etc/bacula/bacula-dir.conf +94 [like this ] # List of files to be backed up FileSet { Name = "Full Set" Include { Options { signature = MD5 compression = GZIP } File = / } Exclude { File = /var/lib/bacula File = /nonexistant/path/to/file/archive/dir File = /proc File = /bacula File = /tmp File = /.journal File = /.fsck } } [like this ] Storage { Name = File # Do not use "localhost" here Address = server # N.B. Use a fully qualified name here SDPort = 9103 Password = "RRLWLgcaTl59e769jZTECeW3Z83drD9Zo" # do not modfiy Device = FileStorage Media Type = File } [like this ] Pool { Name = File Pool Type = Backup Label Format = Local- Recycle = yes # Bacula can automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 365 days # one year Maximum Volume Bytes = 50G # Limit Volume size to something reasonable Maximum Volumes = 100 # Limit number of Volumes in Pool } [Check Director Configuration] root@debian:~# bacula-dir -tc /etc/bacula/bacula-dir.conf root@debian:~# echo $?
[Configure Storage Daemon]
root@debian:~# cp /etc/bacula/bacula-sd.conf /etc/bacula/bacula-sd.conf.bak root@debian:~# vim /etc/bacula/bacula-sd.conf Storage { # definition of myself Name = debian-sd SDPort = 9103 # Director‘s port WorkingDirectory = "/var/lib/bacula" Pid Directory = "/var/run/bacula" Maximum Concurrent Jobs = 20 SDAddress = server } Device { Name = FileStorage Media Type = File Archive Device = /bacula/backup/ LabelMedia = yes; # lets Bacula label unlabeled media Random Access = Yes; AutomaticMount = yes; # when device opened, read it RemovableMedia = no; AlwaysOpen = no; } root@debian:~# bacula-sd -tc /etc/bacula/bacula-sd.conf root@debian:~# echo $?
[Restart bacula Director and Storage Daemon ]
root@debian:~# service bacula-director restart root@debian:~# echo $? 0 root@debian:~# service bacula-sd restart root@debian:~# echo $? 0
[test backup job]
root@debian:~# bconsole Connecting to Director localhost:9101 1000 OK: debian-dir Version: 5.2.6 (21 February 2012) Enter a period to cancel a command. *label Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" Automatically selected Storage: File Enter new Volume name: MyVolume Defined Pools: 1: Default 2: File 3: Scratch Select the Pool (1-3): 2 Connecting to Storage daemon File at server:9103 ... Sending label command for Volume "MyVolume" Slot 0 ... 3000 OK label. VolBytes=192 DVD=0 Volume="MyVolume" Device="FileStorage" (/bacula/backup/) Catalog record for Volume "MyVolume", Slot 0 successfully created. Requesting to mount FileStorage ... 3906 File device ""FileStorage" (/bacula/backup/)" is always mounted. *run A job name must be specified. The defined Job resources are: 1: BackupLocalFiles 2: BackupCatalog 3: RestoreLocalFiles Select Job resource (1-3): 1 Run Backup job JobName: BackupLocalFiles Level: Incremental Client: debian-fd FileSet: Full Set Pool: File (From Job resource) Storage: File (From Job resource) When: 2015-10-06 15:20:11 Priority: 10 OK to run? (yes/mod/no): yes Job queued. JobId=1 You have messages. *messages 06-10月 15:20 debian-dir JobId 1: No prior Full backup Job record found. 06-10月 15:20 debian-dir JobId 1: No prior or suitable Full backup found in catalog. Doing FULL backup. 06-10月 15:20 debian-dir JobId 1: Start Backup JobId 1, Job=BackupLocalFiles.2015-10-06_15.20.22_03 06-10月 15:20 debian-dir JobId 1: Using Device "FileStorage" 06-10月 15:20 debian-sd JobId 1: Wrote label to prelabeled Volume "MyVolume" on device "FileStorage" (/bacula/backup/) *status director debian-dir Version: 5.2.6 (21 February 2012) x86_64-pc-linux-gnu debian jessie/sid Daemon started 06-10暲015 15:14. Jobs: run=0, running=1 mode=0,0 Heap: heap=405,504 smbytes=73,316 max_bytes=73,713 bufs=263 max_bufs=265 Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Incremental Backup 10 06-10暲015 23:05 BackupLocalFiles MyVolume Full Backup 11 06-10暲015 23:10 BackupCatalog MyVolume ==== Running Jobs: Console connected at 06-10暲015 15:16 JobId Level Name Status ====================================================================== 1 Full BackupLocalFiles.2015-10-06_15.20.22_03 is running ==== No Terminated Jobs. ==== You have messages.
[test Restore job ]
*restore all First you select one or more JobIds that contain files to be restored. You will be presented several methods of specifying the JobIds. Then you will be allowed to select which files from those JobIds are to be restored. To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time 9: Find the JobIds of the most recent backup for a client 10: Find the JobIds for a backup for a client before a specified time 11: Enter a list of directories to restore for found JobIds 12: Select full restore to a specified Job date 13: Cancel Select item: (1-13): 5 Automatically selected Client: debian-fd Automatically selected FileSet: Full Set +-------+-------+----------+-----------+---------------------+------------+ | JobId | Level | JobFiles | JobBytes | StartTime | VolumeName | +-------+-------+----------+-----------+---------------------+------------+ | 1 | F | 37250 | 334203253 | 2015-10-06 15:20:24 | MyVolume | +-------+-------+----------+-----------+---------------------+------------+ You have selected the following JobId: 1 Building directory tree for JobId(s) 1 ... +++++++++++++++++++++++++++++++++++++++++++++ 34,029 files inserted into the tree and marked for extraction. You are now entering file selection mode where you add (mark) and remove (unmark) files to be restored. No files are initially added, unless you used the "all" keyword on the command line. Enter "done" to leave this mode. cwd is: / $ done Bootstrap records written to /var/lib/bacula/debian-dir.restore.1.bsr The job will require the following Volume(s) Storage(s) SD Device(s) =========================================================================== MyVolume File FileStorage Volumes marked with "*" are online. 37,250 files selected to be restored. Run Restore job JobName: RestoreLocalFiles Bootstrap: /var/lib/bacula/debian-dir.restore.1.bsr Where: /bacula/restore/ Replace: always FileSet: Full Set Backup Client: debian-fd Restore Client: debian-fd Storage: File When: 2015-10-06 15:29:58 Catalog: MyCatalog Priority: 10 Plugin Options: *None* yes Job queued. JobId=2 *messages 06-10月 15:21 debian-fd JobId 1: /sys is a different filesystem. Will not descend from / into it. 06-10月 15:21 debian-fd JobId 1: /home is a different filesystem. Will not descend from / into it. 06-10月 15:21 debian-fd JobId 1: /dev is a different filesystem. Will not descend from / into it. 06-10月 15:21 debian-fd JobId 1: /var is a different filesystem. Will not descend from / into it. 06-10月 15:21 debian-fd JobId 1: /run is a different filesystem. Will not descend from / into it. 06-10月 15:21 debian-sd JobId 1: Job write elapsed time = 00:01:17, Transfer rate = 4.400 M Bytes/second 06-10月 15:21 debian-dir JobId 1: Bacula debian-dir 5.2.6 (21Feb12): Build OS: x86_64-pc-linux-gnu debian jessie/sid JobId: 1 Job: BackupLocalFiles.2015-10-06_15.20.22_03 Backup Level: Full (upgraded from Incremental) Client: "debian-fd" 5.2.6 (21Feb12) x86_64-pc-linux-gnu,debian,jessie/sid FileSet: "Full Set" 2015-10-06 15:20:22 Pool: "File" (From Job resource) Catalog: "MyCatalog" (From Client resource) Storage: "File" (From Job resource) Scheduled time: 06-10月-2015 15:20:11 Start time: 06-10月-2015 15:20:24 End time: 06-10月-2015 15:21:41 Elapsed time: 1 min 17 secs Priority: 10 FD Files Written: 37,250 SD Files Written: 37,250 FD Bytes Written: 334,203,253 (334.2 MB) SD Bytes Written: 338,827,928 (338.8 MB) Rate: 4340.3 KB/s Software Compression: 61.2 % VSS: no Encryption: no Accurate: no Volume name(s): MyVolume Volume Session Id: 1 Volume Session Time: 1444115704 Last Volume Bytes: 340,270,968 (340.2 MB) Non-fatal FD errors: 0 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK 06-10月 15:21 debian-dir JobId 1: Begin pruning Jobs older than 6 months . 06-10月 15:21 debian-dir JobId 1: No Jobs found to prune. 06-10月 15:21 debian-dir JobId 1: Begin pruning Files. 06-10月 15:21 debian-dir JobId 1: No Files found to prune. 06-10月 15:21 debian-dir JobId 1: End auto prune. 06-10月 15:30 debian-dir JobId 2: Start Restore Job RestoreLocalFiles.2015-10-06_15.30.08_04 06-10月 15:30 debian-dir JobId 2: Using Device "FileStorage" 06-10月 15:30 debian-sd JobId 2: Ready to read from volume "MyVolume" on device "FileStorage" (/bacula/backup/). 06-10月 15:30 debian-sd JobId 2: Forward spacing Volume "MyVolume" to file:block 0:192. 06-10月 15:30 debian-sd JobId 2: End of Volume at file 0 on device "FileStorage" (/bacula/backup/), Volume "MyVolume" 06-10月 15:30 debian-sd JobId 2: End of all volumes. 06-10月 15:30 debian-dir JobId 2: Bacula debian-dir 5.2.6 (21Feb12): Build OS: x86_64-pc-linux-gnu debian jessie/sid JobId: 2 Job: RestoreLocalFiles.2015-10-06_15.30.08_04 Restore Client: debian-fd Start time: 06-10月-2015 15:30:10 End time: 06-10月-2015 15:30:23 Files Expected: 37,250 Files Restored: 37,250 Bytes Restored: 862,363,459 Rate: 66335.6 KB/s FD Errors: 0 FD termination status: OK SD termination status: OK Termination: Restore OK 06-10月 15:30 debian-dir JobId 2: Begin pruning Jobs older than 6 months . 06-10月 15:30 debian-dir JobId 2: No Jobs found to prune. 06-10月 15:30 debian-dir JobId 2: Begin pruning Files. 06-10月 15:30 debian-dir JobId 2: No Files found to prune. 06-10月 15:30 debian-dir JobId 2: End auto prune. *exit
[Verify Restore]
root@debian:~# du -sh /bacula/restore/ 903M /bacula/restore/ root@debian:~# sudo ls -la /bacula/restore/ drwxr-xr-x 20 root root 4096 10月 6 14:19 . drwx------ 4 bacula bacula 4096 10月 6 14:19 .. drwxr-xr-x 2 root root 4096 10月 6 14:11 bin drwxr-xr-x 3 root root 4096 10月 6 12:50 boot drwxr-xr-x 2 root root 4096 10月 6 13:10 dev drwxr-xr-x 86 root root 4096 10月 6 15:20 etc drwxr-xr-x 2 root root 4096 10月 6 12:50 home lrwxrwxrwx 1 root root 31 10月 6 15:30 initrd.img -> /boot/initrd.img-3.16.0-4-amd64 drwxr-xr-x 14 root root 4096 10月 6 12:48 lib drwxr-xr-x 2 root root 4096 10月 6 12:46 lib64 drwx------ 2 root root 4096 10月 6 12:45 lost+found drwxr-xr-x 3 root root 4096 10月 6 12:46 media drwxr-xr-x 2 root root 4096 10月 6 12:46 mnt drwxr-xr-x 2 root root 4096 10月 6 12:46 opt drwx------ 2 root root 4096 10月 6 15:13 root drwxr-xr-x 2 root root 4096 10月 6 14:11 run drwxr-xr-x 2 root root 4096 10月 6 14:11 sbin drwxr-xr-x 2 root root 4096 10月 6 12:46 srv dr-xr-xr-x 2 root root 4096 10月 6 13:10 sys drwxr-xr-x 10 root root 4096 10月 6 12:46 usr drwxr-xr-x 2 root root 4096 10月 6 12:46 var lrwxrwxrwx 1 root root 27 10月 6 15:30 vmlinuz -> boot/vmlinuz-3.16.0-4-amd64 root@debian:~#
[Delete Restore Files]
root@debian:~# sudo -u root bash -c "rm -rf /bacula/restore/*"
[Now you can use basic Bacula setup that can backup and restore ]
本文出自 “生命不息,折腾不止。” 博客,谢绝转载!
How To Install Bacula Server on Debian 8
标签:how to install bacula server on debian 8
原文地址:http://990487026.blog.51cto.com/10133282/1700385