Tampilkan postingan dengan label Bacula. Tampilkan semua postingan
Tampilkan postingan dengan label Bacula. Tampilkan semua postingan

Install Bacula Server di Centos 7


Install  Bacula  Server   di   CentOs 7



Tutorial linux Indonesia -- Bacula  merupakan   solusi  backup  yang  opensource   yang  memungkinkan  kita  sebagai    sysadmin,  untuk  melakukan  backup   data  server   kita. 
Install  Bacula  Server   di   Centos 7
Install  Bacula  Server   di   Centos 7



Melakukan   pemulihan  data  atau   restore   data  server  kita, apabile  server  kita  sedang  bermasalah.  



Hal  ini  sangat   fleksibel  dan   sangat   efisien.  Sangat  cocok  untuk melakukan  backup  dalam  banyak  situasi.

Sebuah  sistem   backup  merupakan  komponen   penting  dalam  infrastuktur  server, untuk  menghindari kehilangan  data   penting.

Apabila  server  kita  mengalami  masalah  atau  server  kita   terkena  hacker.  Untuk mengatasi   masalah  server  tersebut.

Ternyata  solusi  terbaik  untuk  server  tersebut  adalah install ulang  server,  data server  yang  sebelum  sudah  berhasil  di  backup  dapat  di  lakukan   restore atau  pemulihan  data  server  tersebut. 

Dalam  tutorial ini,  bagol69  akan  menunjukan  cara  instalasi  Bacula   dan    konfigurasi   Bacula pada  centos 7.

Sekarang    kita  install  paket-paket  yang  mendukung  untuk  bacula. 

[root@bagol69 ~]# yum install bacula-director-mysql bacula-console bacula-client bacula-storage-mysql mysql-server mysql-devel -y 

Aktifkan   servis database  kita.  Untuk  saat  ini  bagol69  menggunakan  database  mysql.


[root@bagol69 ~]# services  mysqld start
[root@bagol69 ~]#chkconfig mysqld on 
Buat  password    untuk  akses   database  mysql.

[root@bagol69 ~]# mysqladmin -u root password bagol69 

Silahkan  anda   import  database bacula ke  database  server  anda.


[root@bagol69 ~]# /usr/libexec/bacula/grant_mysql_privileges  -u root -p
[root@bagol69 ~]# /usr/libexec/bacula/create_mysql_database -u root -p
[root@bagol69 ~]# /usr/libexec/bacula/make_mysql_tables -u root -p
[root@bagol69 ~]# /usr/libexec/bacula/grant_bacula_privileges -u root –p
[root@bagol69 ~]# /usr/libexec/bacula/grant_mysql_privileges -u root –p 
Sekarang  update password  untuk  user bacula  di  server  database  anda.


[root@bagol69 ~]# mysql -u root  -p
Enter password:
mysql> UPDATE mysql.user SET password=PASSWORD
("bagol69") WHERE user='bacula';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye 

Artikel  Terkait 
Install Monitoring Sensu di Centos 7

Install .Net Core 2.0 di Centos 7

Install Elastic Search di Centos 7
Cara Memberikan nama pada Container Docker

Sekarang kita  sudah  masuk  ke  folder  utama  bacula. Ada  beberapa  parameter  yang   di  konfigurasi.

[root@bagol69 ~]# nano  /etc/bacula/bacula-dir.conf 

Anda  berikan   password   untuk   console  bacula.  Yang  saya  berikan   highlight kuning.


Director {                            # define mysel
  Name = bacula-dir
  DIRport = 9101 # where we listen for UA connections
  QueryFile = "/usr/libexec/bacula/query.sql"
  WorkingDirectory = "/var/spool/bacula"
  PidDirectory = "/var/run"
  Maximum Concurrent Jobs = 1
  Password = "bagol69"         # Console password
  Messages = Daemon

Tambahkan  perintah  GZIP, supaya   hasil   backup  data   secara  otomatis   akan  di  gunzip.


# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include {
    Options {
      signature = MD5
    Compression = GZIP 

Anda  berikan   ip  address  dari  server  yang  ingin  lakukan backup  data  dan  berikan  password untuk    file  daemon  tersebut.

  # Client (File Services) to backup
Client {
  Name = bacula-fd
  Address = 10.10.10.1
  FDPort = 9102
  Catalog = MyCatalog
  Password = "bagol69"     # password for FileDaemon
  File Retention = 30 days # 30 days
  Job Retention = 6 months # six months
  AutoPrune = yes          # Prune expired Jobs/Files

Untuk  parameter  ini,  berfungsi  untuk memberikan  format  pada  file  backup.

  # Client (File Services) to backup
Client {
  Name = bacula-fd
  Address = 10.10.10.1
  FDPort = 9102
  Catalog = MyCatalog
  Password = "bagol69"     # password for FileDaemon
  File Retention = 30 days # 30 days
  Job Retention = 6 months # six months
  AutoPrune = yes          # Prune expired Jobs/Files

Anda  berikan   alamat  ip  address  dari  server   storage  (  Bacula –server ). Berikan  password  untuk  server  storage  tersebut.

Storage {
Name = File
# Do not use "localhost" here
Address = 10.10.10.1
SDPort = 9103
Password = "bagol69"
Device = FileStorage
Media Type = File
}

Sekarang  anda  isikan  informasi   database  yang  sudah  anda  buat  sebelumnya  untuk    server  bacula.

# Generic catalog service
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = "dbi:sqlite3"; dbaddress = 127.0.0.1; dbport =
dbname = "bacula"; dbuser = "bacula"; dbpassword = "bagol69"

Pada  file   bconsole.conf   berikan    alamat  ip  address   dari   server  bacula  dan  password   server  bacula  tersebut.

[root@bagol69 ~]# nano  /etc/bacula/bconsole.conf 

Silahkan  anda  ubah  settingan,   tinggal  sesuaikan  saja dengan    kondisi  server.  

Director {
  Name = bacula-dir
  DIRport = 9101
  address = 10.10.10.1
  Password = "bagol69"

Silahkan  anda  masukan   command  yang  saya  berikan  tanda     highlight untuk   melakukan  backup  database.

[root@bagol69 ~]# nano /usr/libexec/bacula/make_catalog_backup.pl
exec("HOME='$wd' mysqldump -f -u$args{db_user} -p$args{db_password} --opt $args{db_name} > '$wd/$args{db_name}.sql'");  
    close(MY);

#    exec("HOME='$wd' mysqldump -f --opt $args{db_name} > '$wd/$args{db_name}.sql'");
    exec("HOME='$wd' mysqldump -f -u$args{db_user} -p$args{db_password} --opt $args{db_name} > '$wd/$args{db_name}.sql'");
    print "Error while executing mysql dump $!\n";
    return 1;

Sekarang  anda   restart  services   bacula  mengunakan  perintah  di  bawah  ini.

[root@bagol69 ~]# /etc/init.d/bacula-dir restart
Shutting down bacula-dir:                                  [  OK  ]
Starting bacula-dir:                                       [  OK  ]
[root@bagol69 ~]# /etc/init.d/bacula-dir start
Starting bacula-dir:                                       [  OK  ]
[root@bagol69 ~]# chkconfig bacula-dir on
[root@bagol69 ~]# 

Sekarang kita  konfigurasi    folder  yang   menyimpan  hasil   backup  dari  server   client. 

Secara  otomatis hasil  backup    akan menyimpan  di    folder /tmp,   jika   server   di  restart  isi  dari  folder  /tmp  akan  hilang.

Oleh  karena  itu  kita  arahkan   hasil  backup  dari  bacula  ke  folder   yang  kita  buat  sendiri. 

[root@bagol69 ~]# nano  /etc/bacula/bacula-sd.conf 

Anda  berikan  password untuk   bacula-sd.

Director {
  Name = bacula-dir
  Password = "bagol69"

Silahkan  anda      setting  untuk  tempat  menyimpan hasil  dari  backup  server  anda. 


Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /mybackup
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;

Sekarang  anda  buat    folder  untuk  menyimpan hasil d ari backup tersebut.   Silahkan  anda  atur permission  dan  hak  akses  folder  tersebut.

[root@bagol69 ~]# mkdir  /mybackup/
[root@bagol69 ~]# chown bacula /mybackup/
[root@bagol69 ~]# ls  -lah  /mybackup/
total 16K
drwxr-xr-x.  2 bacula root 4.0K Jul 28 00:37 . 

Buat  password  untuk    bacula-fd

[root@bagol69 ~]# nano  /etc/bacula/bacula-fd.conf
Director {
  Name = bacula-dir
  Password = "bagol69"

Sekarang  anda  restart   services  bacula-server  menggunakan  command  di  bawah  ini.

[root@bagol69 ~]# service  bacula-dir  start
Starting bacula-dir:                                       [  OK  ]
[root@bagol69 ~]# service  bacula-fd  start
Starting bacula-fd:                                        [  OK  ]
[root@bagol69 ~]# service  bacula-sd  start
Starting bacula-sd:                                        [  OK  ]
[root@bagol69 ~]# chkconfig bacula-dir on
[root@bagol69 ~]# chkconfig bacula-fd  on
[root@bagol69 ~]# chkconfig bacula-sd on
[root@bagol69 ~]# 
  Password = "bagol69
Untuk   memudahkan  management  bacula-server.   Kami  sarankan  untuk   install  webmin untuk  management  server  backup.  

Sekarang  anda  download terlebih dahulu   webmin,  menggunakan  command  di  bawah ini.


[root@bagol69 ~]# wget --no-check-certificate http://sourceforge.net/projects/webadmin/files/webmin/1.660/webmin-1.660-1.noarch.rpm 

Setelah  selesai  download   webmin, anda  dapat  instalasi  webmin  menggunakan  command  di  bawah ini.

[root@bagol69 ~]# rpm -Uvh webmin-1.660-1.noarch.rpm

Anda  Restart  dan   aktifkan    services   webmin.


[root@bagol69 ~]# service webmin  start
[root@bagol69 ~]# chkconfig webmin  on

Secara  default, CentOs  mengaktifkan  firewall  iptables  untuk     mengamanakan  server.

Semua    traffic  dan s emua port  secara  default  akan  di  drop.  Silahkan  anda     stop services  iptables,  supaya  port   webmin  bisa  di  akses. 

[root@bagol69 ~]# service iptables  stop
[root@bagol69 ~]# chkconfig iptables off

Anda  dapat  akses   webmin menggunakan   link   tersebut.
https://alamatipanda:10000

https://namadomainanda:10000

Untuk   login  ke  webmin,  mengunakan  password  dari   server anda.
Install  Bacula  Server   di   Centos 7
Install  Bacula  Server   di   Centos 7

Untuk  mengaktifkan Services   bacula  di  webmin,  silahkan  anda  pergi ke menu  system à Bacula Backup System.
Install  Bacula  Server   di   Centos 7
Install  Bacula  Server   di   Centos 7
             
Sekarang  anda  berikan  informasi  database  untuk  server  bacula.
Install  Bacula  Server   di   Centos 7
Install  Bacula  Server   di   Centos 7

Untuk  melakukan  backup  data  di  sisi  server,   bisa  menggunakan   command    bconsole.


[root@bagol69 ~]# bconsole
Connecting to Director 10.10.10.1:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.
*label
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
The defined Storage resources are:
     1: File
     2: admin
Select Storage resource (1-2): 1 (  pilih  file )
Enter new Volume name: Vol-20180823-2
Defined Pools:
     1: Default
     2: File
     3: Scratch
Select the Pool (1-3): 2 ( pilih file )
Connecting to Storage daemon File at 10.10.10.1:9103 ...
Sending label command for Volume "Vol-20180823-2" Slot 0 ...
3000 OK label. VolBytes=202 DVD=0 Volume="Vol-20180823-2" Device="FileStorage" (                                                                                        /mybackup)
Catalog record for Volume "Vol-20180823-2", Slot 0  successfully created.
Requesting to mount FileStorage ...
3906 File device "FileStorage" (/mybackup) is always mounted.
*run
A job name must be specified.
The defined Job resources are:
     1: BackupClient1
     2: BackupCatalog
     3: RestoreFiles
Select Job resource (1-3): 1 (  pilih  Backupclient1)
Run Backup job
JobName:  BackupClient1
Level:    Full
Client:   bacula-fd
FileSet:  Full Set
Pool:     File (From Job resource)
Storage:  File (From Job resource)
When:     2018-07-28 01:35:05
Priority: 10
OK to run? (yes/mod/no): yes
Job queued. JobId=8
*messages
28-Jul 01:35 bacula-dir JobId 8: Start Backup JobId 8, Job=BackupClient1.2018-07                                                                                        -28_01.35.12_03
28-Jul 01:35 bacula-dir JobId 8: Using Device "FileStorage"
28-Jul 01:35 bacula-sd JobId 8: Volume "BACKUP-20180823" previously written, mov                                                                                        ing to end of data.
28-Jul 01:35 bacula-sd JobId 8: Ready to append to end of Volume "BACKUP-2018082                                                                                        3" size=1652
28-Jul 01:35 bacula-sd JobId 8: Job write elapsed time = 00:00:01, Transfer rate                                                                                         = 71  Bytes/second
28-Jul 01:35 bacula-dir JobId 8: Bacula bacula-dir 5.0.0 (26Jan10): 28-Jul-2018                                                                                         01:35:14
  Build OS:               x86_64-redhat-linux-gnu redhat
  JobId:                  8
  Job:                    BackupClient1.2018-07-28_01.35.12_03
  Backup Level:           Full
  Client:                 "bacula-fd" 5.0.0 (26Jan10) x86_64-redhat-linux-gnu,re                                                                                        dhat,
  FileSet:                "Full Set" 2018-07-28 00:24:14
  Pool:                   "File" (From Job resource)
  Catalog:                "MyCatalog" (From Client resource)
  Storage:                "File" (From Job resource)
  Scheduled time:         28-Jul-2018 01:35:05
  Start time:             28-Jul-2018 01:35:14
  End time:               28-Jul-2018 01:35:14
  Elapsed time:           0 secs
  Priority:               10
  FD Files Written:       1
  SD Files Written:       1
  FD Bytes Written:       0 (0 B)
  SD Bytes Written:       71 (71 B)
  Rate:                   0.0 KB/s
  Software Compression:   None
  VSS:                    no
  Encryption:             no
  Accurate:               no
  Volume name(s):         BACKUP-20180823 ( file  backup)
  Volume Session Id:      3
  Volume Session Time:    1532712947
  Last Volume Bytes:      2,135 (2.135 KB)
  Non-fatal FD errors:    0
  SD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Backup OK

28-Jul 01:35 bacula-dir JobId 8: Begin pruning Jobs older than 48 years 1 month                                                                                         9 days 18 hours 35 mins 14 secs.
28-Jul 01:35 bacula-dir JobId 8: No Jobs found to prune.
28-Jul 01:35 bacula-dir JobId 8: Begin pruning Jobs.
28-Jul 01:35 bacula-dir JobId 8: No Files found to prune.
28-Jul 01:35 bacula-dir JobId 8: End auto prune.

*quit
You have new mail in /var/spool/mail/root
[root@bagol69 ~]#

Nah  sebelum   kita  sudah  berhasil melakuka  backup  menggunakan  bacila   server,  sekarang   kita  akan  mencoba  restore   data  dari  hasil  backup  server. 


[root@bagol69 ~]# bconsole
Connecting to Director 10.10.10.1:9101
1000 OK: bacula-dir Version: 5.0.0 (26 January 2010)
Enter a period to cancel a command.
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

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 ( pilih  5  untuk memilih
Backup  client ya )
Automatically selected Client: bacula-fd
Automatically selected FileSet: Full Set
+-------+-------+----------+----------+---------------------+-----------------+
| JobId | Level | JobFiles | JobBytes | StartTime           | VolumeName      |
+-------+-------+----------+----------+---------------------+-----------------+
|     8 | F     |        1 |        0 | 2018-07-28 01:35:14 | BACKUP-20180823 |
+-------+-------+----------+----------+---------------------+-----------------+
You have selected the following JobId: 8 ( pilih JobID )

Building directory tree for JobId(s) 8 ...
1 files inserted into the tree.

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: /  (  untuk  melihat  isi  file  ya )
$ mark home
1 file marked.
$ lsmark
*home
$ done
Bootstrap records written to /var/spool/bacula/bacula-dir.restore.1.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

    BACKUP-20180823           File                      FileStorage            

Volumes marked with "*" are online.


1 file selected to be restored.

Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/spool/bacula/bacula-dir.restore.1.bsr
Where:           /tmp/bacula-restores
Replace:         always
FileSet:         Full Set
Backup Client:   bacula-fd
Restore Client:  bacula-fd
Storage:         File
When:            2018-07-28 01:39:31
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=9
*messages
28-Jul 01:39 bacula-dir JobId 9: Start Restore Job RestoreFiles.2018-07-28_01.39.44_05
28-Jul 01:39 bacula-dir JobId 9: Using Device "FileStorage"
28-Jul 01:39 bacula-sd JobId 9: Ready to read from volume "BACKUP-20180823" on device "FileStorage" (/mybackup).
28-Jul 01:39 bacula-sd JobId 9: Forward spacing Volume "BACKUP-20180823" to file:block 0:1652.
28-Jul 01:39 bacula-sd JobId 9: End of Volume at file 0 on device "FileStorage" (/mybackup), Volume "BACKUP-20180823"
28-Jul 01:39 bacula-sd JobId 9: End of all volumes.
28-Jul 01:39 bacula-dir JobId 9: Bacula bacula-dir 5.0.0 (26Jan10): 28-Jul-2018 01:39:46
  Build OS:               x86_64-redhat-linux-gnu redhat
  JobId:                  9
  Job:                    RestoreFiles.2018-07-28_01.39.44_05
  Restore Client:         bacula-fd
  Start time:             28-Jul-2018 01:39:46
  End time:               28-Jul-2018 01:39:46
  Files Expected:         1
  Files Restored:         1
  Bytes Restored:         0
  Rate:                   0.0 KB/s
  FD Errors:              0
  FD termination status:  OK
  SD termination status:  OK
  Termination:            Restore OK

28-Jul 01:39 bacula-dir JobId 9: Begin pruning Jobs older than 48 years 1 month 9 days 18 hours 39 mins 46 secs.
28-Jul 01:39 bacula-dir JobId 9: No Jobs found to prune.
28-Jul 01:39 bacula-dir JobId 9: Begin pruning Jobs.
28-Jul 01:39 bacula-dir JobId 9: No Files found to prune.
28-Jul 01:39 bacula-dir JobId 9: End auto prune.

*exit
You have new mail in /var/spool/mail/root
[root@bagol69 ~]# ls  -laR /tmp/bacula-restores/
/tmp/bacula-restores/:
total 12
drwxr-xr-x. 3 root root 4096 Jul 28 01:39 .
drwxrwxrwt. 6 root root 4096 Jul 28 01:39 ..
drwxr-xr-x. 2 root root 4096 Sep 23  2011 home

/tmp/bacula-restores/home:
total 8
drwxr-xr-x. 2 root root 4096 Sep 23  2011 .
drwxr-xr-x. 3 root root 4096 Jul 28 01:39 ..
[root@bagol69 ~]#


Kategori

Kategori