Instalacja Bacula 9.0.8 + zarządzanie

20 lipca 2018

Bacula – system do tworzenia kopii zapasowych typu klient/serwer, udostępniany na licencji otwartego oprogramowania (GPL)

Przykład instalacyjny oparty na systemie Debian 9
apt-get update
wget -qO- http://bacula.us/current | tar -xzvf - -C /usr/src
apt-get install -y build-essential libreadline6-dev zlib1g-dev liblzo2-dev mt-st mtx postfix libacl1-dev libssl-dev libmysql++-dev mysql-server

Konfiguracja Firewall – IPTables :

-A FW-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9101:9103 -j ACCEPT

# Firewalld

firewall-cmd --permanent --zone=public --add-port=9101-9103/tcp
firewall-cmd --reload
setenforce 0
sudo sed -i "s/enforcing/disabled/g" /etc/selinux/config
sudo sed -i "s/enforcing/disabled/g" /etc/sysconfig/selinux
cd /usr/src/bacula*
./configure --with-readline=/usr/include/readline --disable-conio --bindir=/usr/bin --sbindir=/usr/sbin --with-scriptdir=/etc/bacula/scripts --with-working-dir=/var/lib/bacula --with-logdir=/var/log --enable-smartalloc --with-mysql --with-archivedir=/mnt/backup --with-job-email=admin@vm-eproit-bacula --with-hostname=vm-eproit-bacula
make -j8 && make install && make install-autostart

Załóż hasło na root – MySQL :

mysql -u root -p
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('E%pR12345');
UPDATE mysql.user SET plugin = '' WHERE user = 'root' AND host = 'localhost';
FLUSH PRIVILEGES;
CREATE USER 'bacula'@'localhost' IDENTIFIED BY 'E%pR12345';
GRANT ALL PRIVILEGES ON * . * TO 'bacula'@'localhost';
FLUSH PRIVILEGES;

# MySQL:

chmod o+rx /etc/bacula/scripts/*
/etc/bacula/scripts/create_mysql_database -u bacula -p && \
/etc/bacula/scripts/make_mysql_tables -u bacula -p && \
/etc/bacula/scripts/grant_mysql_privileges -u bacula -p
service bacula-fd start && service bacula-sd start && service bacula-dir start

Instalacja Baculum z pakietów

wget -qO - http://bacula.org/downloads/baculum/baculum.pub | apt-key add -

/etc/apt/sources
deb http://bacula.org/downloads/baculum/stable/debian stretch main
deb-src http://bacula.org/downloads/baculum/stable/debian stretch main

apt-get update && apt-get install php-bcmath php7.0-mbstring baculum-api baculum-api-apache2 baculum-common bacula-console baculum-web baculum-web-apache2 

apt-get install sudo
nano /etc/sudoers

Defaults:www-data !requiretty
www-data ALL=NOPASSWD: /usr/sbin/bconsole
www-data ALL=NOPASSWD: /usr/sbin/bdirjson
www-data ALL=NOPASSWD: /usr/sbin/bsdjson
www-data ALL=NOPASSWD: /usr/sbin/bfdjson
www-data ALL=NOPASSWD: /usr/sbin/bbconsjson
chown www-data /etc/bacula/
a2enmod rewrite
a2ensite baculum-web baculum-api
service apache2 restart

Sprawdzamy poprawność ustawień :

/etc/bacula/bconsole.conf 

Konfigurujemy interfejs API :

http://vm-eproit-bacula:9096

http://vm-eproit-bacula:9095

Przechodzimy następnie do :

http://vm-eproit-bacula:9095/web/config/

Login i hasło : admin

Instalacja Bacula – Web

cd /var/www/html

apt-get install curl
apt-get install php-gettext php-gd php-pdo php-cli php-json php-posix
apt-get install php-sqlite3
curl -O http://www.bacula-web.org/files/bacula-web.org/downloads/bacula-web-latest.tgz
mkdir -v /var/www/html/bacula-web
tar -xzf bacula-web-latest.tgz -C /var/www/html/bacula-web
chown -Rv www-data: /var/www/html/bacula-web
chmod -Rv u=rx,g=rx,o=rx /var/www/html/bacula-web
chown -Rv www-data: /var/www/html/bacula-web
chmod -Rv 755 /var/www/html/bacula-web
chmod -v 775 /var/www/html/bacula-web/application/views/cache
chmod -v 775 /var/www/html/bacula-web/application/assets/protected

cd application/config
cp -v config.php.sample config.php
chown -v www-data: config.php

Konfiguracja :

nano config.php

$config['language'] = 'pl_PL';
// MySQL bacula catalog
 $config[0]['label'] = 'Backup Server';
 $config[0]['host'] = 'localhost';
 $config[0]['login'] = 'root';
 $config[0]['password'] = 'Haslo do bazy';
 $config[0]['db_name'] = 'bacula';
 $config[0]['db_type'] = 'mysql';
 $config[0]['db_port'] = '3306';

Logowanie do strony :

Login : admin
Hasło : bacula

Montowanie w Linuksie zasobów udostępnionych w systemie Windows :

apt-get install cifs-utils

– automatyczne mapowanie

Edytujemy plik :

/etc/fstab

//adres_serwera_plikow/nazwa_udzialu/katalog_udostepniony /mnt/backup cifs uid=0,credentials=/home/eproit/.smb,iocharset=utf8,vers=2.1,noperm 0

Tworzymy plik zawierający poświadczenia :

touch /home/eproit/.smb

Definiujemy Storage :

Storage {                            
  Name = vm-eproit-bacula-sd
  SDPort = 9103                  
  WorkingDirectory = "/var/lib/bacula"
  Pid Directory = "/var/run"
  Plugin Directory = "/usr/lib"
  Maximum Concurrent Jobs = 20
} 
Director {
  Name = vm-eproit-bacula-dir
  Password = "123456"
}
Director {
  Name = vm-eproit-bacula-mon
  Password = "123456"
  Monitor = yes
}
Device {
   Name = FileStorage
   Media Type = File
   Archive Device = /mnt/backup
   LabelMedia = yes;                   
   Random Access = Yes;
   AutomaticMount = yes;               
   RemovableMedia = no;
   AlwaysOpen = no;
}
Autochanger {
  Name = FileChgr1
  Device = FileChgr1-Dev1, FileChgr1-Dev2
  Changer Command = ""
  Changer Device = /dev/null
}
Device {
  Name = FileChgr1-Dev1
  Media Type = File1
  Archive Device = /mnt/backup
  LabelMedia = yes;                   
  Random Access = Yes;
  AutomaticMount = yes;               
  RemovableMedia = no;
  AlwaysOpen = no;
  Maximum Concurrent Jobs = 5
}
Messages {
  Name = Standard
  director = vm-eproit-bacula-dir = all
}

Konfiguracja zarządcy :

Edytujemy plik :

bacula-dir.conf
Director {                            # define myself
  Name = vm-eproit-bacula-dir
  DIRport = 9101                
  QueryFile = "/etc/bacula/scripts/query.sql"
  WorkingDirectory = "/var/lib/bacula"
  PidDirectory = "/var/run"
  Maximum Concurrent Jobs = 20
  Password = "123456"        
  Messages = Daemon
}
JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Full
  Client = vm-eproit-bacula-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = Dysk
  Messages = Standard
  Pool = File
  SpoolAttributes = yes
  Priority = 10
  Write Bootstrap = "/var/lib/bacula/%c.bsr"
}
Job {
  Name = "BackupClient1"
  JobDefs = "DefaultJob"
}
Job {
  Name = "BackupCatalog"
  JobDefs = "DefaultJob"
  Level = Full
  FileSet="Catalog"
  Schedule = "WeeklyCycleAfterBackup"
  # This creates an ASCII copy of the catalog
  # Arguments to make_catalog_backup.pl are:
  #  make_catalog_backup.pl <catalog-name>
  RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup.pl MyCatalog"
  # This deletes the copy of the catalog
  RunAfterJob  = "/etc/bacula/scripts/delete_catalog_backup"
  Write Bootstrap = "/var/lib/bacula/%n.bsr"
  Priority = 11                  
}
Job {
  Name = "RestoreFiles"
  Type = Restore
  Client=vm-eproit-bacula-fd
  Storage = Dysk
  FileSet="Full Set"
  Pool = File
  Messages = Standard
  Where = /mnt/bacula/bacula-restores
#  Write Bootstrap = "/var/lib/bacula/%c.bsr"
}
Job {
  Name = "Backup_vm-eproit-win10-fd"
#  JobDefs = "DefaultJob"
  Type = Backup
#  JobDefs = "DefaultJob"
  Level = Full
  FileSet="Backup_vm-eproit-win10-fd"
  Client = vm-eproit-win10-fd
  Storage = Dysk
  Schedule = "7dni"
  Pool = "vm-eproit-win10-fd"
  # This creates an ASCII copy of the catalog
  # Arguments to make_catalog_backup.pl are:
  #  make_catalog_backup.pl <catalog-name>
#  RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup.pl MyCatalog"
  # This deletes the copy of the catalog
#  RunAfterJob  = "/etc/bacula/scripts/delete_catalog_backup"
#  Write Bootstrap = "/var/lib/bacula/%n.bsr"
  Priority = 1                   # run after main backup
  Messages = Standard
}
FileSet {
    Name = "Backup_vm-eproit-win10-fd"
    Include {
        Options {
            Signature = MD5
        }
#        File = "C:/Users/test1"
        File = "C:/Users/test2/Desktop"
    }
}
Client {
  Name = vm-eproit-win10-fd
  Address = 192.168.20.5
  FDPort = 9102
  Catalog = MyCatalog
  Password = "123456"          
  File Retention = 60 days            # 60 days
  Job Retention = 6 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}
Storage {
     Name = Dysk
     Address = "adres_IP_Storage_Bacula"
     SD Port = 9103
     Password = "123456"
     Device = "FileStorage"
     Media Type = File
     Maximum Concurrent Jobs = 1
}
Autochanger {
  Name = File1
# Do not use "localhost" here
  Address = adres_ip_serwera_bacula                # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "123456"
  Device = FileChgr1
  Media Type = File1
  Maximum Concurrent Jobs = 10        # run up to 10 jobs a the same time
  Autochanger = File1                 # point to ourself
}
Catalog {
  Name = MyCatalog
  dbname = "bacula"; dbuser = "bacula"; dbpassword = "E%pR12345"
}
markos
Specjalizuję się w systemach komputerowych Windows oraz Linux. Oprócz wykonywanej pracy w zawodzie, informatyka jest moją pasją.

Dodaj komentarz

avatar
  Subscribe  
Powiadom o