An Open Source Backup Option
If you're looking for a good open-source backup solution, this may be your lucky day. For tape backup and even disk-to-disk backup, Bacula is one of the more popular and well-maintained open source applications out there.
In this first of two parts, we'll give an overview of how to get started with Bacula, look at different pieces that make up Bacula and look at setup and configuration basics. This isn't meant to be a comprehensive guide, but should give an overview for those who haven't waded through the copious and excellent online documentation for Bacula.
Basic Bacula Components and Services
The three major services Bacula uses are the storage director (bacula-sd), the file director (bacula-fd) and the director itself (bacula-dir). The storage director facilitates the storage and recovery of data and attributes to physical media. The file director is the client piece, which is installed on the machine to be backed up, and the bacula director is the manager and coordinator of all backup job activities. You'll use the Bacula director (bacula-dir) to configure storage pools, jobs and to automate and schedule backups and the Bacula console (bconsole) to interface with and control it all.
The repository for all this media, file and job data is the Bacula catalog. Yes, it requires a database, and that means you will have to install and maintain either a MySQL, PostgreSQL or SQLite database to use Bacula.
Preliminaries and SQL Installation Phase I
Depending on your operating system, some preliminary steps may be necessary. If your operating system doesn't include mtx (most modern ones do) or you intend to use SQLite, the easiest thing to do is download the depkgs then create a /bacula directory where you will untar the bacula and depkgs source code. Untar depkgs into that directory and run:
make sqlite make mtx
Since MySQL seems to be the most commonly used database with Bacula, we'll zero in on installation of that particular database for now. With MySQL, be sure to get the mysql-devel and libz-devel packages to get the SQL header files Bacula requires, and the gzip compression libraries for mysqlclient. If you're installing MySQL by .rpm, you'll need the following:
mysql-.rpm mysql-server-.rpm mysql-devel-.rpm
If installing from source, untar the files, then from the directory you placed the source code in, you will run:
./configure --enable-thread-safe-client --prefix=mysql-directory
where you replace mysql-directory with the directory where you want to install mysql. Normally for system-wide use this is /usr/local/mysql. Run make and make install and finally, run:
This creates the SQL databases for controlling user access.
Next, download the bacula source (at least bacula itself and the docs), and untar the archives in the /bacula directory you created earlier. Change to that directory and run
using the options described in bacula's documentation. Start with some basics. For instance a pretty generic Red Hat installation might get you started:
CFLAGS="-g -Wall" ./configure --prefix=/usr --sbindir=/usr/sbin --sysconfdir=/etc/bacula --with-scriptdir=/etc/bacula --enable-smartalloc --enable-bat --with-qwt=$HOME/bacula/depkgs/qwt --with-mysql=mysql-directory --with-working-dir=/var/bacula --with-pid-dir=/var/run --enable-conio
Be sure you include the directory where you installed mysql earlier. If you need to later change any of these options, start over by using
./make distclean and re-running
./configure with your desired options. Once you've done that, run
Customize the Bacula configuration files for your needs according to the Bacula manual's instructions. The configuration of these files will largely depend on your backup media/tape devices, target file locations, and your desired backup schedule. Start with some defaults, then customize these after you get Bacula up and running. The file you will eventually spend the most time configuring is bacula-dir.conf, since this one defines and controls jobs, schedules and pools.
After Bacula is ready to run, a useful tip for testing your configuration files is to run start the related service with the -t option:
./bacula-dir -t /etc/bacula/bacula-dir.conf
This will either terminate with no comment if the configuration file is OK, or will print an error message indicating where the error is in your configuration file.
An occasionally troublesome aspect of these configuration files is that the randomly generated passwords must agree between them. If they are changed and do not agree, the director service will not start. Another problematic configuration issue can be configuring tape devices with Bacula. Bacula lists support most modern tape devices. I strongly encourage you to test your tape drive before using it with Bacula.
SQL Installation Phase II
Start mysql and change to the bacula install directory. There, you will see scripts for creating and manipulating the Bacula database. The scripts you will need to run are:
./make_mysql_tables. These scripts will grant privileges for the bacula' user in MySQL and create the bacula database and tables. You may also need to edit /etc/ld.so.conf and run /sbin/ldconfig if your mysql libraries are anywhere other than /usr/lib or /usr/local/lib.
Finally, Run Bacula
Test each configuration file and service by running it with the -t option as mentioned above. Once you've cleared all errors, you are ready to start Bacula:
./bacula/start and interface with the program via bconsole.
Next time, we'll deal with auto-starting the daemons, configuring an autochanger, configuring spooling (and why you should), define what volumes, pools and labels are in Bacula, run-before and after job directives, and the point of the whole shebang, restoring files from Bacula.
Article courtesy of Enterprise Networking Planet