<< Back to man.ChinaUnix.net

next up previous contents index
Next: Critical Items to Implement Up: Bacula User's Guide Previous: Getting Started with Bacula   Contents   Index

Subsections


Installing Bacula

General

In general, you will need the Bacula source release, and if you want to run a Windows client, you will need the Bacula Windows binary release. However, Bacula needs certain third party packages (such as SQLite, MySQL, or PostgreSQL to build properly depending on the options you specify. To simplify your task, we have combined a number of these packages into two depkgs releases (Dependency Packages). This can vastly simplify your life by providing you with all the necessary packages rather than requiring you to find them on the Web, load them, and install them.

Source Release Files

Beginning with Bacula 1.38.0, the source code has been broken into four separate tar files each corresponding to a different module in the Bacula CVS. The released files are:

bacula-1.38.0.tar.gz
This is the primary source code release for Bacula. On each release the version number (1.38.0) will be updated.

bacula-docs-1.38.0.tar.gz
This file contains a copy of the docs directory with the documents prebuild. English html directory, single html file, and pdf file. The French and German translations are in progress, but are not built.

bacula-gui-1.38.0.tar.gz
This file contains the non-core GUI programs. Currently, it contains bacula-web, a PHP program for producing management viewing of your Bacula job status in a browser; and bimagemgr a browser program for burning CDROM images with Bacula Volumes.

bacula-rescue-1.8.1.tar.gz
This is the Bacula Rescue CDROM code. Note, the version number of this package is not tied to the Bacula release version, so it will be different. Using this code, you can burn a CDROM with your system configuration and containing a statically linked version of the File daemon. This can permit you to easily repartition and reformat your hard disks and reload your system with Bacula in the case of a hard disk failure.

winbacula-1.38.0.exe
This file is the 32 bit Windows installer for installing the Windows client (File daemon) on a Windows machine.

Upgrading Bacula

If you are upgrading from one Bacula version to another, you should first carefully read the ReleaseNotes of all versions between your current version and the version to which you are upgrading. If the Bacula catalog database has been upgraded, you will either need to reinitialize your database starting from scratch, or save an ASCII copy of your database, then proceed to upgrade it. This is normally done after Bacula is build and installed by:

cd <installed-scripts-dir> (default /etc/bacula)
./update_bacula_tables

This update script can also be find in the Bacula source src/cats directory.

If there are several database upgrades between your version and the version to which you are upgrading, you will need to apply each database upgrade script. For your convenience, you can find all the old upgrade scripts in the upgradedb directory of the source code. You will need to edit the scripts to correspond to your system configuration. The final upgrade script, if any, can be applied as noted above.

If you are upgrading from one major version to another, you will need to replace all your components at the same time as generally the inter-daemon protocol will change. However, within any particular release (e.g. version 1.32.x) unless there is an oversight or bug, the daemon protocol will not change. If this is confusing, simply read the ReleaseNotes very carefully as they will note if all daemons must be upgraded at the same time.

Finally, please note that in general it is not necessary to do a make uninstall before doing an upgrade. In fact, if you do so, you will most likely delete all your conf files, which could be disastrous. The normal procedure during an upgrade is simply:

./configure (your options)
make
make install

In general none of your existing .conf or .sql files will be overwritten.

For additional information on upgrading, please see the Upgrading Bacula Versions in the Tips chapter of this manual.


Dependency Packages

As discussed above, we have combined a number of third party packages that Bacula might need into the depkgs and depkgs1 releases. You can, of course, get the latest packages from the original authors. The locations of where we obtained the packages are in the README file in each package. However, be aware that the packages in the depkgs files have been tested by us for compatibility with Bacula.

Typically, a dependency package will be named depkgs-ddMMMyy.tar.gz and depkgs1-ddMMyy.tar.gz where dd is the day we release it, MMM is the abbreviated month (e.g. Jan), and yy is the year. An actual example is: depkgs-07Apr02.tar.gz. To install and build this package (if needed), you do the following:

  1. Create a bacula directory, into which you will place both the Bacula source as well as the dependency package.
  2. Detar the depkg into the bacula directory.
  3. cd bacula/depkgs
  4. make

Although the exact composition of the dependency packages may change from time to time, the current makeup is the following:

3rd Party Package depkgs depkgs1 depkgs-win32
SQLite X - -
mtx X - -
readline - X -
pthreads - - X
zlib - - X
wxWidgets - - X

Note, some of these packages are quite large, so that building them can be a bit time consuming. The above instructions will build all the packages contained in the directory. However, when building Bacula, it will take only those pieces that it actually needs.

Alternatively, you can make just the packages that are needed. For example,

cd bacula/depkgs
make sqlite

will configure and build only the SQLite package.

You should build the packages that you will require in depkgs and/or depkgs1 prior to configuring and building Bacula, since Bacula will need them during the build process.

Even if you do not use SQLite, you might find it worthwhile to build mtx because the tapeinfo program that comes with it can often provide you with valuable information about your SCSI tape drive (e.g. compression, min/max block sizes, ...).

The depkgs-win32 package contains the source code for the pthreads, zlib, and wxWidgets libraries used by the native Win32 client program. It will only be needed if you intend to build the Win32 client from source.


Supported Operating Systems

Please see the Supported Operating Systems section of the QuickStart chapter of this manual.


Building Bacula from Source

The basic installation is rather simple.

  1. Install and build any depkgs as noted above.
  2. Configure and install MySQL or PostgreSQL (if desired). Installing and Configuring MySQL Phase I or Installing and Configuring PostgreSQL Phase I. If you are installing from rpms, and are using MySQL, please be sure to install mysql-devel, so that the MySQL header files are available while compiling Bacula. In addition, the MySQL client library mysqlclient requires the gzip compression library libz.a or libz.so. If you are using rpm packages, these libraries are in the libz-devel package. On Debian systems, you will need to load the zlib1g-dev package. If you are not using rpms or debs, you will need to find the appropriate package for your system.

    Note, if you already have a running MySQL or PostgreSQL on your system, you can skip this phase provided that you have built the thread safe libraries. And you have already installed the additional rpms noted above.

  3. As an alternative to MySQL and PostgreSQL, configure and install SQLite, which is part of the depkgs. Installing and Configuring SQLite. SQLite is probably not suited to a fair size production environment because it tends to be slow compared to MySQL and it has few or poor tools for repairing database damage.

  4. Detar the Bacula source code preferably into the bacula directory discussed above.

  5. cd to the directory containing the source code.

  6. ./configure (with appropriate options as described below)

  7. Check the output of ./configure very carefully, especially the Install binaries and Install config directories. If they are not correct, please rerun ./configure until they are. The output from ./configure is stored in config.out and can be re-displayed at any time without rerunning the ./configure by doing cat config.out.

  8. If after running ./configure once, you decide to change options and re-run it, that is perfectly fine, but before re-running it, you should run:

          make distclean
    

    so that you are sure to start from scratch and not have a mixture of the two options. This is because ./configure caches much of the information. The make distclean is also critical if you move the source directory from one machine to another. If the make distclean fails, just ignore it and continue on.

  9. make
    
       If you get errors while linking in the Storage daemon directory
       (src/stored), it is probably because you have not loaded the static
       libraries on your system.  I noticed this problem on a Solaris system.
       To correct it, make sure that you have not added    --enable-static-tools to the ./configure command.
    
    

    If you skip this step (make) and proceed immediately to the make install you are making two serious errors: 1. your install will fail because Bacula requires a make before a make install. 2. you are depriving yourself of the chance to make sure there are no errors before beginning to write files to your system directories.

  10. make install Please be sure you have done a make before entering this command, and that everything has properly compiled and linked without errors.

  11. If you are new to Bacula, we strongly recommend that you skip the next step and use the default configuration files, then run the example program in the next chapter, then come back and modify your configuration files to suit your particular needs.

  12. Customize the configuration files for each of the three daemons (Directory, File, Storage) and for the Console program. For the details of how to do this, please see Setting Up Bacula Configuration Files in the Configuration chapter of this manual. We recommend that you start by modifying the default configuration files supplied, making the minimum changes necessary. Complete customization can be done after you have Bacula up and running. Please take care when modifying passwords, which were randomly generated, and the Names as the passwords and names must agree between the configuration files for security reasons.

  13. Create the Bacula MySQL database and tables (if using MySQL) Installing and Configuring MySQL Phase II or create the Bacula PostgreSQL database and tables Installing and Configuring PostgreSQL Phase II or alternatively if you are using SQLite Installing and Configuring SQLite Phase II.

  14. Start Bacula (./bacula start) Note. the next chapter shows you how to do this in detail.

  15. Interface with Bacula using the Console program

  16. For the previous two items, please follow the instructions in the Running Bacula chapter of this manual, where you will run a simple backup and do a restore. Do this before you make heavy modifications to the configuration files so that you are sure that Bacula works and are familiar with it. After that changing the conf files will be easier.

  17. If after installing Bacula, you decide to "move it", that is to install it in a different set of directories, proceed as follows:

          make uninstall
          make distclean
          ./configure (your-new-options)
          make
          make install
    

If all goes well, the ./configure will correctly determine which operating system you are running and configure the source code appropriately. Currently, FreeBSD, Linux (RedHat), and Solaris are supported. MacOS X 10.3 is reported to work with the Client only as long as readline support is disabled.

If you install Bacula on more than one system, and they are identical, you can simply transfer the source tree to that other system and do a "make install". However, if there are differences in the libraries or OS versions, or you wish to install on a different OS, you should start from the original compress tar file. If you do transfer the source tree, and you have previously done a ./configure command, you MUST do:

make distclean

prior to doing your new ./configure. This is because the GNU autoconf tools cache the configuration, and if you re-use a configuration for a Linux machine on a Solaris, you can be sure your build will fail. To avoid this, as mentioned above, either start from the tar file, or do a "make distclean".

In general, you will probably want to supply a more complicated configure statement to ensure that the modules you want are built and that everything is placed into the correct directories.

For example, on RedHat, one could use the following:

CFLAGS="-g -Wall" \
  ./configure \
    --sbindir=$HOME/bacula/bin \
    --sysconfdir=$HOME/bacula/bin \
    --with-pid-dir=$HOME/bacula/bin/working \
    --with-subsys-dir=$HOME/bacula/bin/working \
    --with-mysql=$HOME/mysql \
    --with-working-dir=$HOME/bacula/bin/working \
    --with-dump-email=$USER

Note, the advantage of using the above configuration to start is that everything will be put into a single directory, which you can later delete once you have run the examples in the next chapter and learned how Bacula works. In addition, the above can be installed and run as non-root.

For the developer's convenience, I have added a defaultconfig script to the examples directory. This script contains the statements that you would normally use, and each developer/user may modify them to suit his needs. You should find additional useful examples in this directory as well.

The --enable-conio or --enable-readline options are useful because they provide a command line history and editing capability for the Console program. If you have included either option in the build, either the termcap or the ncurses package will be needed to link. On most systems, including RedHat and SuSE, you should include the ncurses package. If Bacula's configure process finds the ncurses libraries, it will use those rather than the termcap library. On some systems, such as SuSE, the termcap library is not in the standard library directory. As a consequence, the option may be disabled or you may get an error message such as:

/usr/lib/gcc-lib/i586-suse-linux/3.3.1/.../ld:
cannot find -ltermcap
collect2: ld returned 1 exit status

while building the Bacula Console. In that case, you will need to set the LDFLAGS environment variable prior to building.

export LDFLAGS="-L/usr/lib/termcap"

The same library requirements apply if you wish to use the readline subroutines for command line editing and history or if you are using a MySQL library that requires encryption. If you need encryption, you can either export the appropriate additional library options as shown above or, alternatively, you can include them directly on the ./configure line as in:

LDFLAGS="-lssl -lcyrpto" \
   ./configure \
      <your-options>

On some systems such as Mandriva, readline tends to gobble up prompts, which makes it totally useless. If this happens to you, use the disable option, or if you are using version 1.33 and above try using --enable-conio to use a built-in readline replacement. You will still need either the termcap or the ncurses library, but it is unlikely that the conio package will gobble up prompts.

readline is no longer supported after version 1.34. The code within Bacula remains, so it should be usable, and if users submit patches for it, I will be happy to apply them. However, due to the fact that each version of readline seems to be incompatible with previous versions, and that there are significant differences between systems, I can no longer afford to support it.


What Database to Use?

Before building Bacula you need to decide if you want to use SQLite, MySQL, or PostgreSQL. If you are not already running MySQL or PostgreSQL, you might want to start by testing with SQLite. This will greatly simplify the setup for you because SQLite is compiled into Bacula an requires no administration. It performs well and is suitable for small to medium sized installations (maximum 10-20 machines). However, we should note that a number of users have had unexplained database corruption with SQLite. For that reason, we recommend that you install either MySQL or PostgreSQL for production work.

If you wish to use MySQL as the Bacula catalog, please see the Installing and Configuring MySQL chapter of this manual. You will need to install MySQL prior to continuing with the configuration of Bacula. MySQL is a high quality database that is very efficient and is suitable for any sized installation. It is slightly more complicated than SQLite to setup and administer because it has a number of sophisticated features such as userids and passwords. It runs as a separate process, is truly professional and can manage a database of any size.

If you wish to use PostgreSQL as the Bacula catalog, please see the Installing and Configuring PostgreSQL chapter of this manual. You will need to install PostgreSQL prior to continuing with the configuration of Bacula. PostgreSQL is very similar to MySQL, though it tends to be slightly more SQL92 compliant and has many more advanced features such as transactions, stored procedures, and the such. It requires a certain knowledge to install and maintain.

If you wish to use SQLite as the Bacula catalog, please see Installing and Configuring SQLite chapter of this manual.

Quick Start

There are a number of options and important considerations given below that you can skip for the moment if you have not had any problems building Bacula with a simplified configuration as shown above.

If the ./configure process is unable to find specific libraries (e.g. libintl, you should ensure that the appropriate package is installed on your system. Alternatively, if the package is installed in a non-standard location (as far as Bacula is concerned), then there is generally an option listed below (or listed with "./configure --help" that will permit you to specify the directory that should be searched. In other cases, there are options that will permit you to disable to feature (e.g. --disable-nls).

If you want to dive right into it, we recommend you skip to the next chapter, and run the example program. It will teach you a lot about Bacula and as an example can be installed into a single directory (for easy removal) and run as non-root. If you have any problems or when you want to do a real installation, come back to this chapter and read the details presented below.


Configure Options

The following command line options are available for configure to customize your installation.

--sysbindir=<binary-path>
Defines where the Bacula binary (executable) files will be placed during a make install command.

--sysconfdir=<config-path>
Defines where the Bacula configuration files should be placed during a make install command.

--mandir=<path>
Note, as of Bacula version 1.39.14, the meaning of any path specified is now changed to mean the top level man directory. Previously the mandir specified the full path to where you wanted the man files installed. The man files will be installed in gzip'ed format under mandir/man1 and mandir/man8 as appropriate. For the install to succeed you must have gzip installed on your system.

By default, Bacula will install the Unix man pages in /usr/share/man/man1 and /usr/share/man/man8. If you wish the man page to be installed in a different location, use this option to specify the path. Note, the main HTML and PDF Bacula documents are in a separate tar file that is not part of the source distribution.

--datadir=<path>
If you translate Bacula or parts of Bacula into a different language you may specify the location of the po files using the --datadir option. You must manually install any po files as Bacula does not (yet) automatically do so.

--enable-smartalloc
This enables the inclusion of the Smartalloc orphaned buffer detection code. This option is highly recommended. Because we never build without this option, you may experience problems if it is not enabled. In this case, simply re-enable the option. We strongly recommend keeping this option enabled as it helps detect memory leaks. This configuration parameter is used while building Bacula

--enable-gnome
If you have GNOME installed on your computer including the gnome development libraries, and you want to use the GNOME GUI Console interface to Bacula, you must specify this option. Doing so will build everything in the src/gnome-console directory.

--enable-wx-console
If you have wxWidgets installed on your computer and you want to use the wxWidgets GUI Console interface to Bacula, you must specify this option. Doing so will build everything in the src/wx-console directory. This could also be useful to users who want a GUI Console and don't want to install Gnome, as wxWidgets can work with GTK+, Motif or even X11 libraries.

--enable-tray-monitor
If you have GTK installed on your computer, you run a graphical environment or a window manager compatible with the FreeDesktop system tray standard (like KDE and GNOME) and you want to use a GUI to monitor Bacula daemons, you must specify this option. Doing so will build everything in the src/tray-monitor directory.

--enable-static-tools
This option causes the linker to link the Storage daemon utility tools (bls, bextract, and bscan) statically. This permits using them without having the shared libraries loaded. If you have problems linking in the src/stored directory, make sure you have not enabled this option, or explicitly disable static linking by adding --disable-static-tools.

--enable-static-fd
This option causes the make process to build a static-bacula-fd in addition to the standard File daemon. This static version will include statically linked libraries and is required for the Bare Metal recovery. This option is largely superseded by using make static-bacula-fd from with in the src/filed directory. Also, the --enable-client-only option described below is useful for just building a client so that all the other parts of the program are not compiled.

When linking a static binary, the linker needs the static versions of all the libraries that are used, so frequently users will experience linking errors when this option is used. The first thing to do is to make sure you have the static glibc library installed on your system. The second thing to do is the make sure you do not specify --openssl or --with-python on your ./configure statement as these options require additional libraries. You may be able to enable those options, but you will need to load additional static libraries.

--enable-static-sd
This option causes the make process to build a static-bacula-sd in addition to the standard Storage daemon. This static version will include statically linked libraries and could be useful during a Bare Metal recovery.

When linking a static binary, the linker needs the static versions of all the libraries that are used, so frequently users will experience linking errors when this option is used. The first thing to do is to make sure you have the static glibc library installed on your system. The second thing to do is the make sure you do not specify --openssl or --with-python on your ./configure statement as these options require additional libraries. You may be able to enable those options, but you will need to load additional static libraries.

--enable-static-dir
This option causes the make process to build a static-bacula-dir in addition to the standard Director. This static version will include statically linked libraries and could be useful during a Bare Metal recovery.

When linking a static binary, the linker needs the static versions of all the libraries that are used, so frequently users will experience linking errors when this option is used. The first thing to do is to make sure you have the static glibc library installed on your system. The second thing to do is the make sure you do not specify --openssl or --with-python on your ./configure statement as these options require additional libraries. You may be able to enable those options, but you will need to load additional static libraries.

--enable-static-cons
This option causes the make process to build a static-console and a static-gnome-console in addition to the standard console. This static version will include statically linked libraries and could be useful during a Bare Metal recovery.

When linking a static binary, the linker needs the static versions of all the libraries that are used, so frequently users will experience linking errors when this option is used. The first thing to do is to make sure you have the static glibc library installed on your system. The second thing to do is the make sure you do not specify --openssl or --with-python on your ./configure statement as these options require additional libraries. You may be able to enable those options, but you will need to load additional static libraries.

--enable-client-only
This option causes the make process to build only the File daemon and the libraries that it needs. None of the other daemons, storage tools, nor the console will be built. Likewise a make install will then only install the File daemon. To cause all daemons to be built, you will need to do a configuration without this option. This option greatly facilitates building a Client on a client only machine.

When linking a static binary, the linker needs the static versions of all the libraries that are used, so frequently users will experience linking errors when this option is used. The first thing to do is to make sure you have the static glibc library installed on your system. The second thing to do is the make sure you do not specify --openssl or --with-python on your ./configure statement as these options require additional libraries. You may be able to enable those options, but you will need to load additional static libraries.

--enable-build-dird
This option causes the make process to build the Director and the Director's tools. By default, this option is on, but you may turn it off by using --disable-build-dird to prevent the Director from being built.

--enable-build-stored
This option causes the make process to build the Storage daemon. By default, this option is on, but you may turn it off by using --disable-build-stored to prevent the Storage daemon from being built.

--enable-largefile
This option (default) causes Bacula to be built with 64 bit file address support if it is available on your system. This permits Bacula to read and write files greater than 2 GBytes in size. You may disable this feature and revert to 32 bit file addresses by using --disable-largefile.

--disable-nls
By default, Bacula uses the GNU Native Language Support (NLS) libraries. On some machines, these libraries may not be present or may not function correctly (especially on non-Linux implementations). In such cases, you may specify --disable-nls to disable use of those libraries. In such a case, Bacula will revert to using English.

--with-sqlite=<sqlite-path>
This enables use of the SQLite version 2.8.x database. The sqlite-path is not normally specified as Bacula looks for the necessary components in a standard location (depkgs/sqlite). See Installing and Configuring SQLite chapter of this manual for more details.

See the note below under the --with-postgresql item.

--with-sqlite3=<sqlite3-path>
This enables use of the SQLite version 3.x database. The sqlite3-path is not normally specified as Bacula looks for the necessary components in a standard location (depkgs/sqlite3). See Installing and Configuring SQLite chapter of this manual for more details.

--with-mysql=<mysql-path>
This enables building of the Catalog services for Bacula. It assumes that MySQL is running on your system, and expects it to be installed in the mysql-path that you specify. Normally, if MySQL is installed in a standard system location, you can simply use --with-mysql with no path specification. If you do use this option, please proceed to installing MySQL in the Installing and Configuring MySQL chapter before proceeding with the configuration.

See the note below under the --with-postgresql item.

--with-postgresql=<path>
This provides an explicit path to the PostgreSQL libraries if Bacula cannot find it by default. Normally to build with PostgreSQL, you would simply use --with-postgresql.

Note, for Bacula to be configured properly, you must specify one of the four database options supported. That is: --with-sqlite, --with-sqlite3, --with-mysql, or --with-postgresql, otherwise the ./configure will fail.

--with-openssl=<path>
This configuration option is necessary if you want to enable TLS (ssl) in Bacula. Normally, the path specification is not necessary since the configuration searches for the OpenSSL libraries in standard system locations. Enabling OpenSSL in Bacula permits secure communications between the daemons. For more information on using TLS, please see the Bacula TLS chapter of this manual.

--with-python=<path>
This option enables Bacula support for Python. If no path is supplied, configure will search the standard library locations for Python 2.2, 2.3, or 2.4. If it cannot find the library, you will need to supply a path to your Python library directory. Please see the Python chapter for the details of using Python scripting.

--with-libintl-prefix=<DIR>
This option may be used to tell Bacula to search DIR/include and DIR/lib for the libintl headers and libraries needed for Native Language Support (NLS).

--enable-conio
Tells Bacula to enable building the small, light weight readline replacement routine. It is generally much easier to configure than readline, although, like readline, it needs either the termcap or ncurses library.

--with-readline=<readline-path>
Tells Bacula where readline is installed. Normally, Bacula will find readline if it is in a standard library. If it is not found and no --with-readline is specified, readline will be disabled. This option affects the Bacula build. Readline provides the Console program with a command line history and editing capability and is no longer supported, so you are on your own if you have problems.

--enable-readline
Tells Bacula to enable readline support. It is normally disabled due to the large number of configuration problems and the fact that the package seems to change in incompatible ways from version to version.

--with-tcp-wrappers=<path>
This specifies that you want TCP wrappers (man hosts_access(5)) compiled in. The path is optional since Bacula will normally find the libraries in the standard locations. This option affects the Bacula build. In specifying your restrictions in the /etc/hosts.allow or /etc/hosts.deny files, do not use the twist option (hosts_options(5)) or the Bacula process will be terminated. Note, when setting up your /etc/hosts.allow or /etc/hosts.deny, you must identify the Bacula daemon in question with the name you give it in your conf file rather than the name of the executable.

For more information on configuring and testing TCP wrappers, please see the Configuring and Testing TCP Wrappers section in the Security Chapter.

On SuSE, the libwrappers libraries needed to link Bacula are contained in the tcpd-devel package. On RedHat the package is named tcp_wrappers.

--with-working-dir=<working-directory-path>
This option is mandatory and specifies a directory into which Bacula may safely place files that will remain between Bacula executions. For example, if the internal database is used, Bacula will keep those files in this directory. This option is only used to modify the daemon configuration files. You may also accomplish the same thing by directly editing them later. The working directory is not automatically created by the install process, so you must ensure that it exists before using Bacula for the first time.

--with-base-port=<port=number>
In order to run, Bacula needs three TCP/IP ports (one for the Bacula Console, one for the Storage daemon, and one for the File daemon). The --with-baseport option will automatically assign three ports beginning at the base port address specified. You may also change the port number in the resulting configuration files. However, you need to take care that the numbers correspond correctly in each of the three daemon configuration files. The default base port is 9101, which assigns ports 9101 through 9103. These ports (9101, 9102, and 9103) have been officially assigned to Bacula by IANA. This option is only used to modify the daemon configuration files. You may also accomplish the same thing by directly editing them later.

--with-dump-email=<email-address>
This option specifies the email address where any core dumps should be set. This option is normally only used by developers.

--with-pid-dir=<PATH>
This specifies where Bacula should place the process id file during execution. The default is: /var/run. This directory is not created by the install process, so you must ensure that it exists before using Bacula the first time.

--with-subsys-dir=<PATH>
This specifies where Bacula should place the subsystem lock file during execution. The default is /var/run/subsys. Please make sure that you do not specify the same directory for this directory and for the sbindir directory. This directory is used only within the autostart scripts. The subsys directory is not created by the Bacula install, so you must be sure to create it before using Bacula.

--with-dir-password=<Password>
This option allows you to specify the password used to access the Directory (normally from the Console program). If it is not specified, configure will automatically create a random password.

--with-fd-password=<Password>
This option allows you to specify the password used to access the File daemon (normally called from the Director). If it is not specified, configure will automatically create a random password.

--with-sd-password=<Password>
This option allows you to specify the password used to access the Directory (normally called from the Director). If it is not specified, configure will automatically create a random password.

--with-dir-user=<User>
This option allows you to specify the Userid used to run the Director. The Director must be started as root, but doesn't need to run as root, and after doing preliminary initializations, it can "drop" to the UserId specified on this option. If you specify this option, you must create the User prior to running make install, because the working directory owner will be set to User.

--with-dir-group=<Group>
This option allows you to specify the GroupId used to run the Director. The Director must be started as root, but doesn't need to run as root, and after doing preliminary initializations, it can "drop" to the GroupId specified on this option. If you specify this option, you must create the Group prior to running make install, because the working directory group will be set to Group.

--with-sd-user=<User>
This option allows you to specify the Userid used to run the Storage daemon. The Storage daemon must be started as root, but doesn't need to run as root, and after doing preliminary initializations, it can "drop" to the UserId specified on this option. If you use this option, you will need to take care that the Storage daemon has access to all the devices (tape drives, ...) that it needs.

--with-sd-group=<Group>
This option allows you to specify the GroupId used to run the Storage daemon. The Storage daemon must be started as root, but doesn't need to run as root, and after doing preliminary initializations, it can "drop" to the GroupId specified on this option.

--with-fd-user=<User>
This option allows you to specify the Userid used to run the File daemon. The File daemon must be started as root, and in most cases, it needs to run as root, so this option is used only in very special cases, after doing preliminary initializations, it can "drop" to the UserId specified on this option.

--with-fd-group=<Group>
This option allows you to specify the GroupId used to run the File daemon. The File daemon must be started as root, and in most cases, it must be run as root, however, after doing preliminary initializations, it can "drop" to the GroupId specified on this option.

Note, many other options are presented when you do a ./configure --help, but they are not implemented.

Recommended Options for most Systems

For most systems, we recommend starting with the following options:

./configure \
  --enable-smartalloc \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working \
  --with-mysql=$HOME/mysql \
  --with-working-dir=$HOME/bacula/working

If you want to install Bacula in an installation directory rather than run it out of the build directory (as developers will do most of the time), you should also include the --sbindir and --sysconfdir options with appropriate paths. Neither are necessary if you do not use "make install" as is the case for most development work. The install process will create the sbindir and sysconfdir if they do not exist, but it will not automatically create the pid-dir, subsys-dir, or working-dir, so you must ensure that they exist before running Bacula for the first time. See below for an example of how Kern does it.

RedHat

Using SQLite:

 
CFLAGS="-g -Wall" ./configure \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --enable-smartalloc \
  --with-sqlite=$HOME/bacula/depkgs/sqlite \
  --with-working-dir=$HOME/bacula/working \
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working \
  --enable-gnome \
  --enable-conio

or

 
CFLAGS="-g -Wall" ./configure \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --enable-smartalloc \
  --with-mysql=$HOME/mysql \
  --with-working-dir=$HOME/bacula/working
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working
  --enable-gnome \
  --enable-conio

or finally, a completely traditional RedHat Linux install:

CFLAGS="-g -Wall" ./configure \
  --prefix=/usr \
  --sbindir=/usr/sbin \
  --sysconfdir=/etc/bacula \
  --with-scriptdir=/etc/bacula \
  --enable-smartalloc \
  --enable-gnome \
  --with-mysql \
  --with-working-dir=/var/bacula \
  --with-pid-dir=/var/run \
  --with-subsys-dir=/var/lock/subsys \
  --enable-conio

Note, Bacula assumes that /var/bacula, /var/run, and /var/loc/subsys exist so it will not automatically create them during the install process.

Note, with gcc (GCC) 4.0.1 20050727 (Red Hat 4.0.1-5) on an AMD64 CPU running 64 bit CentOS4, there is a compiler bug that generates bad code that causes Bacula to segment fault. Typically you will see this in the Storage daemon first. The solution is to compile Bacula ensuring that no optimization is turned on (normally it is -O2).

Solaris

To build Bacula from source, you will need the following installed on your system (they are not by default): libiconv, gcc 3.3.2, stdc++, libgcc (for stdc++ and gcc_s libraries), make 3.8 or later.

You will probably also need to: Add /usr/local/bin to PATH and Add /usr/ccs/bin to PATH for ar.

#!/bin/sh
CFLAGS="-g" ./configure \
  --sbindir=$HOME/bacula/bin \
  --sysconfdir=$HOME/bacula/bin \
  --with-mysql=$HOME/mysql \
  --enable-smartalloc \
  --with-pid-dir=$HOME/bacula/bin/working \
  --with-subsys-dir=$HOME/bacula/bin/working \
  --with-working-dir=$HOME/bacula/working

As mentioned above, the install process will create the sbindir and sysconfdir if they do not exist, but it will not automatically create the pid-dir, subsys-dir, or working-dir, so you must ensure that they exist before running Bacula for the first time.

Note, you may need to install the following packages to build Bacula from source:

SUNWbinutils,
SUNWarc,
SUNWhea,
SUNWGcc,
SUNWGnutls
SUNWGnutls-devel
SUNWGmake
SUNWgccruntime
SUNWlibgcrypt
SUNWzlib
SUNWzlibs
SUNWbinutilsS
SUNWGmakeS
SUNWlibm

export 
PATH=/usr/bin::/usr/ccs/bin:/etc:/usr/openwin/bin:/usr/local/bin:/usr/sfw/bin:/opt/sfw/bin:/usr/ucb:/usr/sbin

FreeBSD

Please see: The FreeBSD Diary for a detailed description on how to make Bacula work on your system. In addition, users of FreeBSD prior to 4.9-STABLE dated Mon Dec 29 15:18:01 2003 UTC who plan to use tape devices, please see the Tape Testing Chapter of this manual for important information on how to configure your tape drive for compatibility with Bacula.

If you are using Bacula with MySQL, you should take care to compile MySQL with FreeBSD native threads rather than LinuxThreads, since Bacula is normally built with FreeBSD native threads rather than LinuxTreads. Mixing the two will probably not work.

Win32

To install the binary Win32 version of the File daemon please see the Win32 Installation Chapter in this document.


Windows Systems with CYGWIN Installed

As of version 1.34, Bacula no longer uses CYGWIN for the Win32 File daemon. However, it is still built under a CYGWIN build environment -- though you can probably do it with VC Studio only. If you wish to build the Win32 File daemon from the source, you will need Microsoft C++ version 7.1. Details for building the Win32 FD are in the README.win32 file of the src/win32 directory.

Note, although most parts of Bacula build on Windows systems, the only part that we have tested and used is the File daemon.

Finally, you should follow the installation instructions in the Win32 Installation section of this document.

Kern's Configure Script

The script that I use for building on my "production" Linux machines is:

#!/bin/sh
# This is Kern's configure script for Bacula
CFLAGS="-g -Wall" \
  ./configure \
    --sbindir=$HOME/bacula/bin \
    --sysconfdir=$HOME/bacula/bin \
    --enable-smartalloc \
    --enable-gnome \
    --with-pid-dir=$HOME/bacula/bin/working \
    --with-subsys-dir=$HOME/bacula/bin/working \
    --with-mysql=$HOME/mysql \
    --with-working-dir=$HOME/bacula/bin/working \
    --with-dump-email=$USER \
    --with-smtp-host=mail.your-site.com \
    --with-baseport=9101
exit 0

Note that I define the base port as 9101, which means that Bacula will use port 9101 for the Director console, port 9102 for the File daemons, and port 9103 for the Storage daemons. These ports should be available on all systems because they have been officially assigned to Bacula by IANA (Internet Assigned Numbers Authority). We strongly recommend that you use only these ports to prevent any conflicts with other programs. This is in fact the default if you do not specify a --with-baseport option.

You may also want to put the following entries in your /etc/services file as it will make viewing the connections made by Bacula easier to recognize (i.e. netstat -a):

bacula-dir      9101/tcp
bacula-fd       9102/tcp
bacula-sd       9103/tcp

Installing Bacula

Before setting up your configuration files, you will want to install Bacula in its final location. Simply enter:

make install

If you have previously installed Bacula, the old binaries will be overwritten, but the old configuration files will remain unchanged, and the "new" configuration files will be appended with a .new. Generally if you have previously installed and run Bacula you will want to discard or ignore the configuration files with the appended .new.

Building a File Daemon or Client

If you run the Director and the Storage daemon on one machine and you wish to back up another machine, you must have a copy of the File daemon for that machine. If the machine and the Operating System are identical, you can simply copy the Bacula File daemon binary file bacula-fd as well as its configuration file bacula-fd.conf then modify the name and password in the conf file to be unique. Be sure to make corresponding additions to the Director's configuration file (bacula-dir.conf).

If the architecture or the O/S level are different, you will need to build a File daemon on the Client machine. To do so, you can use the same ./configure command as you did for your main program, starting either from a fresh copy of the source tree, or using make distclean before the ./configure.

Since the File daemon does not access the Catalog database, you can remove the --with-mysql or --with-sqlite options, then add --enable-client-only. This will compile only the necessary libraries and the client programs and thus avoids the necessity of installing one or another of those database programs to build the File daemon. With the above option, you simply enter make and just the client will be built.

Auto Starting the Daemons

If you wish the daemons to be automatically started and stopped when your system is booted (a good idea), one more step is necessary. First, the ./configure process must recognize your system -- that is it must be a supported platform and not unknown, then you must install the platform dependent files by doing:

(become root)
make install-autostart

Please note, that the auto-start feature is implemented only on systems that we officially support (currently, FreeBSD, RedHat/Fedora Linux, and Solaris), and has only been fully tested on Fedora Linux.

The make install-autostart will cause the appropriate startup scripts to be installed with the necessary symbolic links. On RedHat/Fedora Linux systems, these scripts reside in /etc/rc.d/init.d/bacula-dir /etc/rc.d/init.d/bacula-fd, and /etc/rc.d/init.d/bacula-sd. However the exact location depends on what operating system you are using.

If you only wish to install the File daemon, you may do so with:

make install-autostart-fd

Other Make Notes

To simply build a new executable in any directory, enter:

make

To clean out all the objects and binaries (including the files named 1, 2, or 3, which Kern uses as temporary files), enter:

make clean

To really clean out everything for distribution, enter:

make distclean

note, this cleans out the Makefiles and is normally done from the top level directory to prepare for distribution of the source. To recover from this state, you must redo the ./configure in the top level directory, since all the Makefiles will be deleted.

To add a new file in a subdirectory, edit the Makefile.in in that directory, then simply do a make. In most cases, the make will rebuild the Makefile from the new Makefile.in. In some case, you may need to issue the make a second time. In extreme cases, cd to the top level directory and enter: make Makefiles.

To add dependencies:

make depend

The make depend appends the header file dependencies for each of the object files to Makefile and Makefile.in. This command should be done in each directory where you change the dependencies. Normally, it only needs to be run when you add or delete source or header files. make depend is normally automatically invoked during the configuration process.

To install:

make install

This not normally done if you are developing Bacula, but is used if you are going to run it to backup your system.

After doing a make install the following files will be installed on your system (more or less). The exact files and location (directory) for each file depends on your ./configure command (e.g. gnome-console and gnome-console.conf are not installed if you do not configure GNOME. Also, if you are using SQLite instead of mysql, some of the files will be different).

bacula
bacula-dir
bacula-dir.conf
bacula-fd
bacula-fd.conf
bacula-sd
bacula-sd.conf
bacula-tray-monitor
tray-monitor.conf
bextract
bls
bscan
btape
btraceback
btraceback.gdb
bconsole
bconsole.conf
create_mysql_database
dbcheck
delete_catalog_backup
drop_bacula_tables
drop_mysql_tables
fd
gnome-console
gnome-console.conf
make_bacula_tables
make_catalog_backup
make_mysql_tables
mtx-changer
query.sql
bsmtp
startmysql
stopmysql
wx-console
wx-console.conf

Installing Tray Monitor

The Tray Monitor is already installed if you used the --enable-tray-monitor configure option and ran make install.

As you don't run your graphical environment as root (if you do, you should change that bad habit), don't forget to allow your user to read tray-monitor.conf, and to execute bacula-tray-monitor (this is not a security issue).

Then log into your graphical environment (KDE, Gnome or something else), run bacula-tray-monitor as your user, and see if a cassette icon appears somewhere on the screen, usually on the task bar. If it doesn't, follow the instructions below related to your environment or window manager.

GNOME

System tray, or notification area if you use the GNOME terminology, has been supported in GNOME since version 2.2. To activate it, right-click on one of your panels, open the menu Add to this Panel, then Utility and finally click on Notification Area.

KDE

System tray has been supported in KDE since version 3.1. To activate it, right-click on one of your panels, open the menu Add, then Applet and finally click on System Tray.

Other window managers

Read the documentation to know if the Freedesktop system tray standard is supported by your window manager, and if applicable, how to activate it.

Modifying the Bacula Configuration Files

See the chapter Configuring Bacula in this manual for instructions on how to set Bacula configuration files.


next up previous contents index
Next: Critical Items to Implement Up: Bacula User's Guide Previous: Getting Started with Bacula   Contents   Index
Kern Sibbald 2006-07-30