Getting Bacula To Work On Solaris In 10 Minutes

One of the first things you learn is that backups are important and restores are even more important. Either you learn it by reading about it or most likely you learn it the hard way when you lose your data. Unfortunately most people won’t learn from their mistakes but they will continue to keep no or partial backups and continue to lose data regularly. In this article I will show you how to get Bacula up and running in 10 minutes.

There are many good backup solutions out there ranging from expensive commercial solutions to free open-source solutions. One of the better open-source software out there is Bacula. It has a lot of advanced features and it is not too difficult to setup. It also works great on Solaris.

The easiest way to install it on Solaris is to use Blastwave. If you haven’t installed Blastwave on your Solaris server you are missing out. It is very simply to get it installed and I suggest you check here for detailed instructions. It also requires you to have MySQL installed but I’m not covering that process in this article. However, you can easily install mysql from Blastwave as well.

Once you have installed Blastwave installing the Bacula binaries is even easier. Just make sure you have /opt/csw/bin in your PATH.

# pkg-get -i bacula

Before we can start bacula we need to create a MySQL database. Fortunately, the installation provides us with ready scripts for this.

# cd /opt/csw/etc/bacula
# ./create_mysql_database -uroot -p
Password: (type your MySQL root password here)
Creation of bacula database succeeded.
# ./grant_bacula_privileges -uroot -p
Granting MySQL privileges
Enter password: (type your MySQL root password here)
... lots of output ...
Privileges for bacula granted.
# ./make_bacula_tables -uroot -p
Making MySQL tables
Enter password: (type your MySQL root password here)
Creation of Bacula MySQL tables succeeded.

Before you can start bacula you need to modify /opt/csw/etc/bacula/bacula-dir.conf since it is not configured correctly out-of-the-box. You need to add the DB Address directive to the Catalog section.

Catalog {
Name = MyCatalog
dbname = bacula; user = bacula; password = ""
DB address = localhost
}

We are now at the stage that we have the binaries and database ready. Since the Blastwave packages are really great they also provided SMF manifests so it is very easy to enable and disable the service. Lets start Bacula.

# svcadm enable application/cswbacula

If you look in the process list you should see 3 bacula related processes.

# ps -ef | grep bacula
root 3737 1 0 10:52:14 ? 0:00 /opt/csw/sbin/bacula-fd -v -c /opt/csw/etc/bacula/bacula-fd.conf
root 3730 1 0 10:52:14 ? 0:00 /opt/csw/sbin/bacula-sd -v -c /opt/csw/etc/bacula/bacula-sd.conf
root 3745 1 0 10:52:16 ? 0:00 /opt/csw/sbin/bacula-dir -v -c /opt/csw/etc/bacula/bacula-dir.conf

bacula-fd is the file daemon, bacula-sd is the storage daemon and bacula-dir is the director. If you don’t see these three processes you need to check /var/svc/log/application-cswbacula\:default.log for error messages and correct them.

Now we are ready to connect to the director and check the status.

# bconsole
Connecting to Director beast:9101
1000 OK: beast-dir Version: 2.0.2 (28 January 2007)
Enter a period to cancel a command.
*

Bacula comes preconfigured to do backups to a disk volume located in /tmp. Before we can start a backup we need to create a volume.

*label
Automatically selected Storage: File
Enter new Volume name: type the name of the volume e.g volume1

There is also a predefined job to backup /tmp on the local machine (oh yes, recursive backups).

*run
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
A job name must be specified.
The defined Job resources are:
1: Client1
2: BackupCatalog
3: RestoreFiles
Select Job resource (1-3): 1

This will give you a lot of output and soon the backup will be complete. Congratulations! You now have a working Bacula installation.

Now it is time to configure it to do backups of the files you really want to backup. You also most likely don’t want to store your backups in /tmp. Have a look at the Bacula manual for the chapters about configuring the file daemon, the storage daemon and the director. The configuration file is also very well documented and you won’t have any problems figuring out how things work.

For further information about what has changed from a default installation compared to the Blastwave installation have a look at /opt/csw/share/doc/bacula/README.CSW.

[?]
Do you need system administration assistance? If you like what you are reading please consider subscribing to the RSS feed. If you have feedback or if you find the article useful please leave a comment below.

Leave a Reply