Friday, February 28, 2020

Building Bacula Backup Software for Solaris 11.4

As we know Networker backup software does not support Solaris as a backup server any longer, so we need to look else where. Ventured over to bacula.org which is an open source version which seems very popular so will give it a go.

  1. Download latest version source from https://www.bacula.org/source-download-center/ (v9.6.2)
  2. Configure will not build cleanly due to reliance on libmysqlclient_r.a (bug 2520
  3. Locations:
    • application location: /opt/bacula962 and a symbolic link to /opt/bacula
    • data and working file location: /var/share/bacula
  4. Setup MySQL database
  5. Download/Install MTX: Media Changer Tools (v1.3.12)
  6. Setup configuration files to start backing up your system...See next blog
  7. Things to do/fix: 
    1. create SMF service
    2. build under solaris-userland, but major problems with bacula configure
$ export PATH=/usr/bin:/usr/sbin:/opt/developerstudio/bin
$ pkg list  mysql-57 gcc/gcc-c++-7
NAME (PUBLISHER)                                  VERSION                    IFO
database/mysql-57                                 5.7.28-11.4.17.0.1.2.0     i--
developer/gcc/gcc-c++-7                           7.3.0-11.4.15.0.1.4.0      i--

# Dirty fix for configure needing libmysqlclient_r.so
$ cd /usr/mysql/5.7/lib; ln -s amd64/libmysqlclient.so  libmysqlclient_r.so

$ PREFIX=/opt/bacula962
DATAROOTDIR=/var/share/bacula
CFLAGS="-g -O2 -Wall -m64" \
LDFLAGS="-m64"  \
./configure \
    --sbindir=${PREFIX}/bin \
    --sysconfdir=${PREFIX}/etc \
    --docdir=${PREFIX}/html \
    --htmldir=${PREFIX}/html \
    --with-working-dir=${DATAROOTDIR}/working \
    --with-pid-dir=/var/run \
    --with-logdir=${DATAROOTDIR}/log \
    --with-archivedir=${DATAROOTDIR}/backup \
    --with-scriptdir=${PREFIX}/scripts \
    --with-plugindir=${PREFIX}/plugins \
    --libdir=${PREFIX}/lib \
    --enable-smartalloc \
    --enable-conio \
 --datadir=${PREFIX} \
 --infodir=${PREFIX}/info \
 --localedir=${PREFIX}/locale \
 --mandir=${PREFIX}/man \
 --docdir=${PREFIX}/doc \
 --enable-largefile \
    --with-mysql=/usr/mysql/5.7 \
    --with-dump-email=backup@dcs.bbk.ac.uk \
    --with-job-email=backup@dcs.bbk.ac.uk \
    --with-smtp-host=smtp.dcs.bbk.ac.uk \
    --with-db-name=baculadb \
    --with-db-user=bacula \
    --with-db-password=MySQLPassword \
    --with-baseport=9101 
....
Configuration on Fri Feb 28 12:31:52 GMT 2020:
   Host:                      i386-pc-solaris2.11 -- solaris 5.11
   Bacula version:            Bacula 9.6.2 (26 February 2020)
   Source code location:      .
   Install binaries:          /opt/bacula962/bin
   Install libraries:         /opt/bacula962/lib
   Install config files:      /opt/bacula962/etc
   Scripts directory:         /opt/bacula962/scripts
   Archive directory:         /var/share/bacula/backup
   Working directory:         /var/share/bacula/working
   PID directory:             /var/run
   Subsys directory:          /var/run/subsys
   Man directory:             /opt/bacula962/man
   Data directory:            /usr/share
   Plugin directory:          /opt/bacula962/plugins
   C Compiler:                gcc 7.3.0
   C++ Compiler:              /usr/bin/g++ 7.3.0
   Compiler flags:            -g -O2 -Wall -m64 -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti
   Linker flags:               -m64
   Libraries:                 -lpthread  -lintl -lresolv -lrt
   Statically Linked Tools:   no
   Statically Linked FD:      no
   Statically Linked SD:      no
   Statically Linked DIR:     no
   Statically Linked CONS:    no
   Database backends:         MySQL
   Database port:              
   Database name:             baculadb
   Database user:             bacula
   Database SSL options:      

   Job Output Email:          backup@dcs.bbk.ac.uk
   Traceback Email:           backup@dcs.bbk.ac.uk
   SMTP Host Address:         smtp.dcs.bbk.ac.uk

   Director Port:             9101
   File daemon Port:          9102
   Storage daemon Port:       9103

   Director User:             
   Director Group:            
   Storage Daemon User:       
   Storage DaemonGroup:       
   File Daemon User:          
   File Daemon Group:         

   Large file support:        yes
   Bacula conio support:      yes -lncurses
   readline support:          no 
   TCP Wrappers support:      no 
   TLS support:               yes
   Encryption support:        yes
   ZLIB support:              yes
   LZO support:               no
   enable-smartalloc:         yes
   enable-lockmgr:            no
   bat support:               no
   client-only:               no
   build-dird:                yes
   build-stored:              yes
   Plugin support:            yes
   AFS support:               no
   ACL support:               yes
   XATTR support:             yes
   systemd support:           no 
   Batch insert enabled:      MySQL   << Very Important

   Plugins:
   - Docker:                  no
  
$ gmake
..
$ sudo gmake install
...

Now you need to Create the MySQL user & database. There are scripts but this may but if your database is remote then they may not work.

mysql> CREATE DATABASE IF NOT EXISTS baculadb;
mysql> CREATE USER bacula IDENTIFIED BY "MySQLPassword";
mysql> GRANT ALL PRIVILEGES ON baculadb@"%" IDENTIFIED BY "MySQLPassword";

$ sh /opt/bacula/scripts/make_mysql_tables -h MySQLServer -u bacula -D baculadb -pMySQLPassword 

Lastly we need to alter ./scripts/mtx-changer since it needs to use gsed and not sed
$ gsed -i 's/ sed / gsed /g' /opt/bacula962/scripts/mtx-changer

Now test your default configuartion 
$ /opt/bacula/bin/bacula-dir -tc /opt/bacula/etc/bacula-dir.conf
$ /opt/bacula/bin/bacula-sd -tc /opt/bacula/etc/bacula-sd.conf
$ /opt/bacula/bin/bacula-fd -tc /opt/bacula/etc/bacula-fd.conf

$ /opt/bacula/bin/bacula start

If all has gone well you now have bacula software running, but worst luck that is the easy part, since now you have to start the configuration. See Next post...

A quick footnote is to download and install the tape software which will handle autochanger etc...

$ gzip -dc mtx-1.3.12.tar.gz | tar txf -
$ cd  mtx-1.3.12
$ ./configure --prefix=/opt/bacula --mandir=/opt/bacula/man
$ gmake
$ gmake install

If you have a tape drive you can give it a test?
$ /opt/bacula/sbin/mtx -f /dev/scsi/changer/c10t500308C38CDAB001d1 inquiry
Product Type: Medium Changer
Vendor ID: 'QUANTUM '
Product ID: 'Scalar i40-i80  '
Revision: '190G'
Attached Changer API: No




No comments: