How To Install Bacula Server on Debian 8

localhost IP 192.168.81.131

/etc/hosts

[email protected]:~# vim /etc/hosts
192.168.81.131  server
192.168.81.128  client

vim /etc/apt/sources.list

[In China ] 
[email protected]:~# 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 


[email protected]:~# apt-get install mysql-server
【Enter】
[email protected]:~# apt-get install bacula-server bacula-client
【yes】
[email protected]:~# chmod 755 /etc/bacula/scripts/delete_catalog_backup
[email protected]:~# mkdir -p /bacula/backup /bacula/restore
[email protected]:~# chown -R bacula:bacula /bacula/
[email protected]:~# chmod -R 700 /bacula/

[Director Configuration]

[email protected]:~# cp /etc/bacula/bacula-dir.conf /etc/bacula/bacula-dir.conf.bak
[email protected]:~# vim /etc/bacula/bacula-dir.conf
[email protected]:~# sed -i ‘s/BackupClient1/BackupLocalFiles/g‘ /etc/bacula/bacula-dir.conf
[email protected]:~# sed -i ‘s/RestoreFiles/RestoreLocalFiles/g‘ /etc/bacula/bacula-dir.conf
[email protected]:~# sed -i ‘[email protected] = /nonexistant/path/to/file/archive/dir/[email protected] = /bacula/restore/@g‘ /etc/bacula/bacula-dir.conf
[email protected]:~# grep Where /etc/bacula/bacula-dir.conf
 Where = /bacula/restore/

[email protected]:~# 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]
[email protected]:~# bacula-dir -tc /etc/bacula/bacula-dir.conf
[email protected]:~# echo $?

[Configure Storage Daemon]

[email protected]:~# cp /etc/bacula/bacula-sd.conf /etc/bacula/bacula-sd.conf.bak
[email protected]:~# 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;
}
 
[email protected]:~# bacula-sd -tc /etc/bacula/bacula-sd.conf
[email protected]:~# echo $?

[Restart bacula Director and Storage Daemon ]

[email protected]:~# service bacula-director restart
[email protected]:~# echo $?
0
[email protected]:~# service bacula-sd restart
[email protected]:~# echo $?
0

[test backup job]

 

[email protected]:~# 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]

[email protected]:~# du -sh /bacula/restore/
903M	/bacula/restore/

[email protected]:~# 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
[email protected]:~#


[Delete Restore Files]

[email protected]:~# sudo -u root bash -c "rm -rf /bacula/restore/*"



[Now you can use basic Bacula setup that can backup and restore ]





时间: 2025-01-04 14:42:30

How To Install Bacula Server on Debian 8的相关文章

Install Oracle 11gR2 on Debian wheezy(转)

Install Oracle 11gR2 on Debian wheezy 出处:http://gaiustech.wordpress.com/2013/06/26/howto-install-oracle-on-debian-wheezy/ Oracle 11gR2 on Debian still isn’t an officially supported configuration (10g XE was for a while), but it is perfectly do-able w

Install genghis server in Windows

Today, I want to install a Genghis server on my windows server, and I thought it would be easy. (Indeed, it is easy), but a little bit tricky. 1. Download Genghis from http://genghisapp.com/. 2. Install Apache server with PHP, I want to make it easy,

Sharepoint 2013 出现The tool was unable to install Application Server Role, Web Server (IIS) Role

在Windows Server 2012 R2环境下运行Sharepoint 2013前置运行软件发现会出现The tool was unable to install Application Server Role, Web Server (IIS) Role.这是因为R2版本操作系统中C:\Windows\System32下的ServerManagerCmd.exe不存在,但是它有一个ServerManager.exe这样的文件. 解决方案:将ServerManager.exe复制一份并重新

Install Rancher server

1.pre-requirement: sudo nmtui # sudo hostnamectl set-hostname <hostname> $ sudo hostnamectl set-hostname rancher01 $ sudo systemctl restart systemd-hostnamed sudo yum install openssh -y 2.docker: $ sudo yum install yum-utils -y $ sudo yum-config-man

Install TightVNC Server in RHEL/CentOS and Fedora to Access Remote Desktops

Virtual Networking Computing (VNC) is a Kind of remote sharing system that makes it possible to take control of any other computer connected to internet. Keyboard and mouse clicks can easily transmit from one computer to another. It helps administrat

How to install redis server on CentOS 7 / RHEL 7

How to install redis server on CentOS 7 / RHEL 7 October 4, 2014 by sharad chhetri Leave a Comment In this tutorial we will learn, how to install redis server on CentOS 7 / RHEL 7 . The abbreviation of redis is REmote DIctionary Server. It is one the

Install Windows Server 2016

Get Windows Server 2016 [1] Refer to the description about Windows Server 2016 on Microsoft site below. ? https://www.microsoft.com/en-us/cloud-platform/windows-server-b/ To use Windows Server, buy it.However, it's possible to try to use Evaluation V

How to install OpenBazaar Server in CentOS7

helps from: https://github.com/OpenBazaar/OpenBazaar-Server http://stackoverflow.com/questions/24917657/error-while-installing-scrapy http://stackoverflow.com/questions/8878676/gcc-error-trying-to-exec-cc1-execvp-no-such-file-or-directory-when-compil

How to install Samba server on Ubuntu 12.04

Part 1: Configuring anonymous share with samba server To install the samba package,enter the following command: sudo apt-get install samba samba-common Check the version of installed samba software by using this command: smbd --version Also install t