![]()
Installing BaculaGeneralIn 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 readline, SQLite, MySQL 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.Dependency PackagesAs discussed above, we have combined a number of third party packages that Bacula might need into the depkgs and depkgs1 releases. Typically, they 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:
Note, some of these packages are quite large, so that this part 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 sqlitewill 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 worth while 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, ...). Supported Operating SystemsPlease see the Supported Operating Systems section of the QuickStart chapter of this manual.Building Bacula from SourceThe basic installation is rather simple.
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 distcleanprior 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 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. If you have included the readline package in the build, the termcap package will be needed to link. On some systems, such as SuSE, the termcap library is not in the standard directory. As a consequence, you may get an error message such as: /usr/lib/gcc-lib/i586-suse-linux/3.3.1/.../ld: cannot find -ltermcapcollect2: ld returned 1 exit statuswhile 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"Alternatively you may turn off the use of readline using the --disable-readline option to ./configure. What Database to Use?Before building Bacula you need to decide if you want to use SQLite or MySQL. If you are not already running MySQL, we recommend that you start by using SQLite. This will greatly simplify the setup for you.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. If you wish to use SQLite as the Bacula catalog, please see Installing and Configuring SQLite chapter of this manual.Configure OptionsThe following command line options are available for configure to customize your installation.
Recommended Options for most SystemsFor 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. See below for an example of how Kern does it. RedHatUsing 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/workingor 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 Solaris#!/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 FreeBSDPlease see: The FreeBSD Diary for a detailed description on how to make Bacula work on your system. In addition, please see the file platforms/freebsd/pthreads-fix.txt in the main Bacula directory concerning important information concerning compatibility of Bacula and your system.Win32Please note that as of this time (28 April 2003), on certain systems such as WinXP and most likely Win2K, Bacula will restore files with the userid that Bacula is using namely SYSTEM. This means that you may not be able to access those restored files until you change the owner to be your userid.To install the binary Win32 version of the File daemon please see the Win32 Installation Chapter in this document. Windows Systems with CYGWIN InstalledIf you wish to build from the source, and if you have CYGWIN version 1.5.5 and GCC 3.95.3-10 installed, it is possible to build the Win32 version of Bacula on a Windows machine. Please don't try any other versions of CYGWIN or GCC as there were known problems. In addition, Bacula is designed to be installed on a non-CYGWIN system. If you do install it on a system with CYGWIN installed, you must take special care to install Bacula in the main CYGWIN directory (normally c:\cygwin) rather than in the root (c:\), and you must use the CygwinInstall.bat and CygwinUnInstall.bat scripts rather than the standard ones. To date, the Win32 version has only been build on Win98 SR2, WinMe, and WinXP Home systems with the above CYGWIN environment and all the available CYGWIN tools loaded. In addition, the builds were done running under the bash shell. As time permits, we will experiment with other environments. The current CYGWIN environment was loaded using the CYGWIN setup.exe program, downloading ALL the latest binaries and installing them. Note, although most parts of Bacula build on Windows systems, the only part that we have tested and used is the File daemon. We recommend that you run the ./configure command with the following options: ./configure \ --sbindir=/bacula/bin \ --sysconfdir=/bacula/bin \ --with-working-dir=/bacula/working \ --with-pid-dir=/bacula/working \ --with-subsys-dir=/bacula/working \ --enable-smartallocNote, the automatic installation for Win32 is not yet written, so most of these specifications are not really used. After which, you can do a: makeTo create a binary tar release, do the following: cd src/filed/win32 make binary-releaseIt will tell you where it has placed the binary release. All the daemons will be built, but the only one tested to date is the Win32 File daemon. For the other daemons, you are on your own. It is not very probable they will work. Finally, you should follow the installation instructions in the Win32 Installation section of this document, skipping the part that describes unZipping the binary release. Kern's Configure ScriptThe 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-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-baseport=9101 exit 0Note 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 Building a File Daemon or ClientIf 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 DaemonsIf 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-autostartPlease note, that the auto-start feature is implemented only on systems that we officially support (currently, FreeBSD, RedHat Linux, and Solaris), and has only been fully tested on RedHat Linux. The make install-autostart will cause the appropriate startup scripts to be installed with the necessary symbolic links. On RedHat 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 Configuring and Testing TCP Wrappers with BaculaDan Languille has provided the following information on configuring and testing TCP wrappers with Bacula.If you read hosts_options(5), you will see an option called twist. This option replaces the current process by an instance of the specified shell command. Typically, something like this is used: ALL : ALL : severity auth.info : twist /bin/echo "You are not welcome to use %d from %h."The libwrap code tries to avoid twist if it runs in a resident process, but that test will not protect the first hosts_access() call. This will result in the prcess (e.g. bacula-fd, bacula-sd, bacula-dir) being terminated if the first connection to their port results in the twist option being invoked. The potential, and I stree potential, exists for an attacker to prevent the daemons from running. This situation is eliminated if your /etc/hosts.allow file contains an appropriate ruleset. The following example is sufficent: undef-fd : localhost : allow undef-sd : localhost : allow undef-dir : localhost : allow undef-fd : ALL : deny undef-sd : ALL : deny undef-dir : ALL : denyYou must adjust the daemon names to those found in the respective daemon configuration files. In these examples, the Director is undef- dir, the Storage Daemon is undef-sd, and the File Daemon is undef-fd. Adjust to suit your situation. The above example rules assume that the SD, FD, and DIR all reside on the same box. If you have a remote FD client, then the following ruleset on the remote client will suffice: undef-fd : director.example.org : allow undef-fd : ALL : denywhere director.example.org is the host which will be contacting the client (ie. the box on which the Bacula Director daemon runs). The use of "ALL : deny" ensures that the twist option (if present) is not invoked. To properly test your configuration, start the daemon(s), then attempt to connect from an IP address which should be able to connect. You should see something like this: $ telnet undef 9103 Trying 192.168.0.56... Connected to undef.example.org. Escape character is '^]'. Connection closed by foreign host. $This is the correct response. If you see this: $ telnet undef 9103 Trying 192.168.0.56... Connected to undef.example.org. Escape character is '^]'. You are not welcome to use undef-sd from xeon.example.org. Connection closed by foreign host. $then twist has been invoked and your configuration is not correct and you need to add the deny statement. It is important to note that your testing must include restarting the daemons after each connection attempt. You can also tcpdchk(8) and tcpdmatch(8) to validate your /etc/hosts.allow rules. Here is a simple test using tcpdmatch: $ tcpdmatch undef-dir xeon.example.org warning: undef-dir: no such process name in /etc/inetd.conf client: hostname xeon.example.org client: address 192.168.0.18 server: process undef-dir matched: /etc/hosts.allow line 40 option: allow access: grantedIf you are running Bacula as a standalone daemon, the warning above can be safely ignored. Here is an example which indicates that your rules are missing a deny statement and the twist option has been invoked. $ tcpdmatch undef-dir 10.0.0.1 warning: undef-dir: no such process name in /etc/inetd.conf client: address 10.0.0.1 server: process undef-dir matched: /etc/hosts.allow line 91 option: severity auth.info option: twist /bin/echo "You are not welcome to use undef-dir from 10.0.0.1." access: delegated Other Make NotesTo simply build a new executable in any directory, enter:makeTo clean out all the objects and binaries (including the files named 1, 2, or 3, which Kern uses as temporary files), enter: make cleanTo really clean out everything for distribution, enter: make distcleannote, 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 dependThe 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 installThis 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 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 Modifying the Bacula Configuration FilesSee the chapter Configuring Bacula in this manual for instructions on how to set Bacula configuration files.
|