September 21, 2021

Bacula/Webacula howto

Bacula is an open source backup server setup that can back up Windows, Mac and Linux (or BSD) laptops and servers. It can do both full and incremental backups, and does file de-duplication (like BackupPC, not sure about Amanda), so it’s pretty flexible.

Bacula server setup howto with Webacula frontend GUI for management

This setup works on Debian Squeeze, but should work on others with little modification. First, login to your SERVER via ssh and install bacula (this assumes you want to use mysql) director, console, storage director and the file director. here’s what they do:

bacula director this is the server core, which is what you think of when you think of a bacula server, it directs traffic and initiates the backup
bacula SD Storage Director. This is the thing that tells the Director what storage you want to use, and how to access and use it, this runs on your backup server
bacula FD File Director is the client that runs on your remote laptop that allows Bacula to go get your backups and transfer them to the backup server. We install this on the server setup to test

so now you have to install all this on your SERVER:

apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql php5 php5-gd zendframework
  follow prompts to set up root user/password
apt-get install bacula-common-mysql bacula-console bacula-director-mysql bacula-fd bacula-sd mtx mt-st
  follow prompts to install/configure databases
  postfix is needed to email you backup messages, select "Internet site" when prompted and just hit 'OK' for other things

Now configure your Storage Director where you want to put your files:

vi /etc/bacula/bacula-sd.conf
  Archive Device = /change/to/the/directory/you/want/to/put/your/backup/files

Now we install webacula, a web interface for bacula that might make life easier. You can also manage it through bconsole, so decide what works for you. You can download the latest version from here: http://sourceforge.net/projects/webacula/ then scp it to your server.

mkdir /usr/src/bacula
cd /usr/src/bacula
cp /path/to/where/webacula.tar.gz/is ./
tar xfvz webacula.tar.gz
cd webacula.../
mkdir /usr/share/webacula
cp -R ./ /usr/share/webacula/
chmod -R www-data.www-data /usr/share/webacula
chmod www-data.www-data /etc/bacula/bconsole.conf
cd /usr/share/webacula/install
php check_system_requirements.php (they all should read 'OK' for mysql, or you need to install something)
vi /usr/share/webacula/install/db.conf
  db_pwd="whateveryourpasswordis" (change this password to whatever your bacula database password is)
  webacula_root_pwd="whateverpassword" (change this password to what you want
vi /usr/share/webacula/application/config.ini
  db.config.username = usernameyourusing
  db.config.password = yourpasswordyouused
  db.config.dbname = bacula
  bacula.sudo = “” (change line to read like this by deleting /usr/bin/sudo between quotes)
  bacula.bconsole = "/usr/bin/bconsole" (change line to read like this)
cd /usr/share/webacula/install/MySql/
./10_make_tables.sh
./20_acl_make_tables.sh
usermod -aG bacula www-data
vi /usr/share/webacula/html/.htaccess
  #SetEnv APPLICATION_ENV development (uncomment this line)
  SetEnv APPLICATION_ENV production (comment this line out)

Now you have to get apache configured, so do this:

vi /etc/apache2/sites-available/bacula (creates new blank file, put the stuff below in it)
  <VirtualHost server.name.or.ip:80> (change to reflect your actual server name or IP)
        Alias /webacula  /usr/share/webacula/html
        ErrorLog /var/log/apache2/webacula.error.log
        LogFormat "%h %l %u %t \"%r\" %>s %b" common
        DirectoryIndex index.php
        DocumentRoot /usr/share/webacula
        <Directory /usr/share/webacula>
                Options +Indexes FollowSymLinks Multiviews
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
  </VirtualHost>
touch /var/log/apache2/webacula.error.log
/etc/init.d/apache2 restart

Now you should be able to see a login at: http://your.server.hostname.or.ip/webacula