wget -O /etc/yum.repos.d/bareos.repo http://download.bareos.org/bareos/experimental/nightly/CentOS_6/bareos:master.repo yum install bareos bareos-common bareos-database-postgresql bareos-client bareos-bconsole bareos-storage bareos-filedaemon bareos-director su postgres -c /usr/lib/bareos/scripts/create_bareos_database su postgres -c /usr/lib/bareos/scripts/make_bareos_tables su postgres -c /usr/lib/bareos/scripts/grant_bareos_privileges
Job { Name = "testbackup-client-03-backup" Type = Backup Level = Incremental Client = testbackup-client-03-fd FileSet = "testbackup-client-03-fileset" Schedule = "WeeklyCycle" Storage = File Messages = Standard Pool = testbackup-client-03-pool-Incremental Priority = 10 Write Bootstrap = "/var/lib/bareos/%c.bsr" Full Backup Pool = testbackup-client-03-pool-Full Differential Backup Pool = testbackup-client-03-pool-Differential Incremental Backup Pool = testbackup-client-03-pool-Incremental } Job { Name = "testbackup-client-03-restore" Type = Restore Client = testbackup-client-03-fd FileSet = "testbackup-client-03-fileset" Storage = File Pool = testbackup-client-03-pool-Incremental Messages = Standard Where = / } Job { Name = "testbackup-client-03-backup-mysql" Type = Backup Level = Incremental Client = testbackup-client-03-fd FileSet = "testbackup-client-03-fileset-mysql" Schedule = "WeeklyCycle" Storage = File Messages = Standard Pool = testbackup-client-03-pool-Incremental Priority = 10 Write Bootstrap = "/var/lib/bareos/%c.bsr" Full Backup Pool = testbackup-client-03-pool-Full Differential Backup Pool = testbackup-client-03-pool-Differential Incremental Backup Pool = testbackup-client-03-pool-Incremental } Job { Name = "testbackup-client-03-restore-mysql" Type = Restore Client = testbackup-client-03-fd FileSet = "testbackup-client-03-fileset-mysql" Storage = File Pool = testbackup-client-03-pool-Incremental Messages = Standard Where = / } FileSet { Name = "testbackup-client-03-fileset" Include { Options { compression = GZIP Signature = MD5 # calculate md5 checksum per file } File = "/" File = "/boot" } } FileSet { Name = "testbackup-client-03-fileset-mysql" Include { Plugin = "bpipe:file=/MYSQL/dump.sql:reader=mysqldump -uzabbix -p12345 --single-transaction --add-drop-database -B zabbix:writer=mysql -uzabbix -p12345" Options { Signature = MD5 # calculate md5 checksum per file compression = GZIP } } } Client { Name = testbackup-client-03-fd Address = testbackup-client-03 Password = "Msmn8GRO0CnMyUljLmB9u1wgrbYXoV1rI8MLugI6JJqc " File Retention = 30 days # 30 days Job Retention = 6 months # six months AutoPrune = no # Prune expired Jobs/Files } Pool { Name = testbackup-client-03-pool-Full Pool Type = Backup Recycle = yes # Bareos can automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 365 days Maximum Volume Bytes = 30G Maximum Volumes = 100 Label Format = "testbackup-client-03-pool-Full-" } Pool { Name = testbackup-client-03-pool-Differential Pool Type = Backup Recycle = yes # Bareos can automatically recycle Volumes AutoPrune = yes Volume Retention = 90 days Maximum Volume Bytes = 10G Maximum Volumes = 100 Label Format = "testbackup-client-03-pool-Differential-" } Pool { Name = testbackup-client-03-pool-Incremental Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 30 days Maximum Volume Bytes = 1G Maximum Volumes = 100 Label Format = "testbackup-client-03-pool-Incremental-" }
Plugin = "<plugin>:file=<filepath>:reader=<readprogram>:writer=<writeprogram>"
@/etc/bareos/bareos-dir.d/testbackup-client-03.conf # Director { Name = testbackup-bareos-dir QueryFile = "/usr/lib/bareos/scripts/query.sql" Maximum Concurrent Jobs = 10 Password = "lY/wVlXuC25qk18i15iw10MpOVxLwDLFgOUMtSMpFOC6" Messages = Daemon Auditing = yes Maximum Concurrent Jobs = 20 } Schedule { Name = "WeeklyCycle" Run = Full 1st sat at 21:00 } Storage { Name = File Address = testbackup-bareos Password = "k4dkFWMwJh3zBpnAOpa9+oule1z/OT0GIcE4wZYySgbU" Device = FileStorage Media Type = File } Catalog { Name = MyCatalog dbdriver = "postgresql" dbname = "bareos" dbuser = "bareos" dbpassword = "" } Messages { Name = Standard mailcommand = "/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: %t %e of %c %l\" %r" mailcommand = "/etc/bareos/scripts/bareoszabbix.bash %i" operatorcommand = "/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: Intervention needed for %j\" %r" mail = root@localhost = all, !skipped, !audit operator = root@localhost = mount console = all, !skipped, !saved, !audit append = "/var/log/bareos/bareos.log" = all, !skipped, !audit catalog = all, !audit } Messages { Name = Daemon mailcommand = "/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos daemon message\" %r" mail = root@localhost = all, !skipped, !audit console = all, !skipped, !saved, !audit append = "/var/log/bareos/bareos.log" = all, !skipped, !audit append = "/var/log/bareos/bareos-audit.log" = audit }
Director { Name = testbackup-bareos-dir DIRport = 9101 address = testbackup-bareos Password = "lY/wVlXuC25qk18i15iw10MpOVxLwDLFgOUMtSMpFOC6" }
Storage { Name = testbackup-bareos-sd Maximum Concurrent Jobs = 20 } Director { Name = testbackup-bareos-dir Password = "k4dkFWMwJh3zBpnAOpa9+oule1z/OT0GIcE4wZYySgbU" } Device { Name = FileStorage Media Type = File Archive Device = /backup LabelMedia = yes; Random Access = yes; AutomaticMount = yes; RemovableMedia = no; AlwaysOpen = no; } Messages { Name = Standard director = testbackup-bareos-dir = all }
service bareos-dir start service bareos-sd start service bareos-fd start
yum -y install bareos-filedaemon
Director { Name = testbackup-bareos-dir Password = "Msmn8GRO0CnMyUljLmB9u1wgrbYXoV1rI8MLugI6JJqc" } FileDaemon { Name = testbackup-client-03-fd Maximum Concurrent Jobs = 20 Compatible = no # Bacula , bareos-fd } Messages { Name = Standard director = testbackup-client-03-dir = all, !skipped, !restored }
#bconsole *run testbackup-client-03-backup-mysql *run testbackup-client-03-backup
#bconsole *restore
*restore restorejob=testbackup-client-03-restore-mysql jobid=158
yum -y install bareos-bconsole
Director { Name = testbackup-bareos-dir DIRport = 9101 address = testbackup-bareos Password = "lY/wVlXuC25qk18i15iw10MpOVxLwDLFgOUMtSMpFOC6" }
rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[base] name=CentOS-$releasever - Base baseurl=http://mirror.centos.org/centos/6.6/os/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
rpm --import http://mirror.centos.org/centos/6.6/os/x86_64/RPM-GPG-KEY-CentOS-6
yum -y install nfs-utils genisoimage syslinux rear
mkdir /etc/rear/mappings echo "eth0 10.11.0.153/24" > /etc/rear/mappings/ip_addresses echo "default 10.11.0.1 eth0" > /etc/rear/mappings/route
cp /usr/share/rear/conf/default.conf /etc/rear/local.conf
OS_VENDOR=CentOS OS_VERSION=6.6 BACKUP=BAREOS OUTPUT=ISO BAREOS_CLIENT=$(grep $(hostname -s) /etc/bareos/bareos-fd.conf | awk '/-fd/ {print $3}' ) OUTPUT_URL=nfs://10.11.0.150/backup USE_STATIC_NETWORKING=y
vi /usr/share/rear/restore/BAREOS/default/40_restore_backup.sh
BAREOS_CLIENT=$(grep $(hostname -s) /etc/bareos/bareos-fd.conf | awk '/-fd/ {print $3}' )
BAREOS_CLIENT_1=$(grep "Name =.*-fd" /etc/bareos/bareos-fd.conf | awk '{print $3}' | sed -e 's/-fd//g' )
echo "restore client=$BAREOS_CLIENT where=/mnt/local select all done
echo "restore client=$BAREOS_CLIENT_1-fd restorejob=$BAREOS_CLIENT_1-restore fileset=$BAREOS_CLIENT_1-fileset where=/mnt/local select all done
rear -v -d mkrescue
rear -v recover
Source: https://habr.com/ru/post/260955/
All Articles