1 ################################################################
3 ################################################################
5 Bweb works well with 3.0 release or later.
8 2) using lighttpd (quick install)
10 4) initialize your configuration file
11 5) do some sql stuff (for postgresql or mysql 5 users)
12 6) use the -n option on bconsole so that it works with Expect
13 7) get bacula log more useful
15 9) using sudo with autochanger
16 10) using bfileview.pl
18 12) setting mysql read-only account
19 13) get more statistics
20 14) use users and groups with bweb
21 15) setup restoration in bweb
24 ################ INSTALL PERL LIBRARY ##########################
27 - DBI (with mysql or postgresql support DBD::Pg and DBD::mysql)
28 (SQLite is not supported)
37 You can install perl modules with CPAN
41 Or use your distribution
42 apt-get install libgd-graph-perl libhtml-template-perl libexpect-perl \
43 libdbd-mysql-perl libdbd-pg-perl libdbi-perl \
44 libdate-calc-perl libtime-modules-perl
46 Note: the best way to test if you have all the dependencies
47 fullfilled for Perl is to:
52 you might also want to try:
56 To make sure the graphing modules are loaded. However, running it
57 will spray binary graphics data on your terminal. Otherwise, you will
60 That should show you if any of the pre-requisites are missing.
61 On SuSE 10.2, I was able to load all the appropriate modules via rpms,
62 with the exception of Expect and Time::ParseDate, which I loaded manually
65 If you experience problems, always consult the Apache error_log
69 ################# USE LIGHTTPD WITH BWEB #######################
71 In this example, bweb files are in /home/bacula/bweb
72 You should have installed lighttpd.
76 # configure the database
77 bacula:~/bweb$ mysql bacula < script/bweb-mysql.sql
79 bacula:~/bweb$ psql bacula < script/bweb-postgresql.sql
81 # You can start the web server from the bweb directory
82 bacula@localhost:~/bweb$ ./script/starthttp
83 Making configuration template in /home/bacula/bweb/bweb.conf
84 Adjusting bweb.conf path
85 Using bweb on /home/bacula/bweb, use firefox http://localhost:9180
86 2009-07-18 22:23:12: (log.c.75) server started
89 By default, only the loopback interface is binded, you can change that
90 in the bweb/script/httpd.conf file.
92 You will have to configure bweb with your database and bconsole info, it
93 can be done in the web interface.
95 I [Kern] used the following in the Configuration panel. Note: I am
96 using Ubuntu Hardy (8.04):
97 DBI: DBI:mysql:database=bacula;host=roxie
99 Password: (nothing -- I have none)
100 email_media: my@email.com
101 bconsole: /opt/bacula/bin/bconsole -n
104 Click: Main -- you should see the charts
107 ################ FILE COPY (Full Apache methode) ###############
108 # you must get bweb svn files
109 svn checkout https://bacula.svn.sourceforge.net/svnroot/bacula/trunk/gui/bweb bweb
111 # or get them from the released tar files or from the apt or rpms.
114 # Once you have the gui directory loaded, follow the instructions below
115 # or edit the environment variables in the file install_bweb
116 # then execute it. install_web does everything to the next
120 # first, copy the bweb Perl library into your PERL5 INC path
124 install -m 644 -o root -g root bweb/lib/*.pm /usr/share/perl5
128 # copy the bweb perl program to your cgi location
129 mkdir -m 755 /usr/lib/cgi-bin/bweb
130 install -m 755 -o root -g root bweb/cgi/*.pl /usr/lib/cgi-bin/bweb
132 # get a config file, if you want to use an other place edit lib/Bweb.pm
133 mkdir -m 755 /etc/bacula
134 chown root:bacula /etc/bacula
135 echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bacula/bweb.conf
136 chown www-data /etc/bacula/bweb.conf
138 # copy the bweb template file
139 mkdir -p /usr/share/bweb/tpl/en
140 install -m 644 -o root -g root bweb/lang/en/tpl/*.tpl /usr/share/bweb/tpl/en
142 # copy the bweb graphics elements (bweb elements must reside in /bweb)
144 install -m 644 -o root -g root bweb/html/*.{js,png,css,gif,ico,html} /var/www/bweb
148 WARNING : Your www-data (or wwwrun on SuSE) user must be able to execute bconsole and able
149 to read the bconsole.conf file!
150 You can create an bconsole group for that.
152 ################ USE FRENCH/SPANISH VERSION ####################
154 Simply copy lang/fr/tpl/*.tpl files to .../tpl/fr/*.tpl and choose
155 your language in the configuration panel.
158 ################ APACHE CONFIGURATION ##########################
160 It could be a good idea to protect your bweb installation (optional).
162 Put this in your httpd.conf, and add user with htpasswd
164 Alias /bweb /usr/share/bweb/html
165 <Directory /usr/share/bweb/html>
166 Options FollowSymLinks MultiViews
172 ScriptAlias /cgi-bin/bweb /usr/lib/cgi-bin/bweb
173 <Directory /usr/lib/cgi-bin/bweb>
174 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
176 AuthName MyPrivateFile
177 AuthUserFile /etc/apache/htpasswd
182 On SuSE 10.2, the following in /etc/apache2/default-server.conf works.
183 However, it is not secure:
185 Directory "/srv/www/cgi-bin/bweb">
187 Options +ExecCGI -Includes
193 ################ CONFIGURATION #################################
195 Note, this is automatically installed by the install_bweb script.
197 /etc/bacula/bweb.conf looks like : (you can edit it inside bweb)
199 'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
201 'config_file' => '/etc/bacula/bweb.conf',
202 'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
212 'device' => '/dev/changer',
218 'mtxcmd' => '/usr/sbin/mtx',
224 }, 'Bweb::Autochanger' )
227 'template_dir' => '/usr/share/bweb/tpl',
229 'dbi' => 'DBI:mysql:database=bacula',
233 'email_media' => 'eric@localhost'
237 ################ BRESTORE ######################################
239 If you want to use brestore with bweb, you must associate a mime type
240 text/brestore with your brestore.pl, and you must install brestore.
241 See gui/brestore/README for instructions on installing brestore.pl.
243 ################ POSTGRESQL AND MYSQL5 NOTES ####################
245 If you want to use PostgreSQL instead of MySQL, you must add
246 a function to the PostgreSQL Bacula database to get Bweb to work.
248 psql -U bacula bacula < script/bweb-postgresql.sql
250 Tips: PL must be enabled in your cluster, you can do this with postgres user
251 postgres:~$ echo 'CREATE PROCEDURAL LANGUAGE plpgsql;' | psql bacula
254 To get database size with mysql5, edit Bweb.pm and change the DB_SIZE macro
256 # with mysql < 5, you have to play with the ugly SHOW command
257 DB_SIZE => " SELECT 0 ",
258 # works only with mysql 5
259 DB_SIZE => " SELECT sum(DATA_LENGTH) FROM INFORMATION_SCHEMA.TABLES ",
261 ################ BCONSOLE NOTES ################################
263 You must use bconsole without conio/readline support. For that, use
264 the bconsole -n option. This is done automatically with the standard
265 configuration file. In addition, please ensure that the binary
266 bconsole file can be executed by your web server. It is normally
267 located in /usr/bin/bconsole (or some such file), and must have
268 modes 755 or it will not be executable by your web server. The
269 normal Bacula installation usually sets mode 750.
271 ################ BACULA LOG ####################################
273 If you want Bweb to be able to show listings of the Job output,
274 you must add a "catalog = all, !skipped, !saved" to your
275 messages resource in bacula-dir.conf and restart your Bacula
276 server. This is shown below:
281 operator = root@localhost = mount
282 console = all, !skipped, !saved
283 append = "/tmp/bacula/var/bacula/working/log" = all, !skipped
285 catalog = all, !skipped, !saved
289 ################ BWEB LIMITATION ###############################
291 To get bweb working, you must follow these rules
292 - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
293 - AutoChanger name must be same as Device and Location name in bacula
295 ################ SUDO CONFIGURATION ############################
297 If you use sudo, put this on you /etc/sudoers
299 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
300 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
301 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
302 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
304 ################ BFILEVIEW AND BTIME SETUP ###############################
306 Alias /bweb/fv /var/spool/bweb
307 <Directory "/var/spool/bweb">
309 AllowOverride AuthConfig
314 mkdir /var/spool/bweb
315 chmod 700 /var/spool/bweb
316 chown www-data /var/spool/bweb
318 Add (or configure) a writable location to the parameters in bweb.conf
319 'fv_write_path' => '/var/spool/bweb',
321 ###### BFILEVIEW only part
323 You MUST use brestore.pl -b or bresto.pl action=batch to initialize the
324 database, and you CAN use bfileview.pl mode=batch jobid=xxx where=/ to compute
327 At this time, it's a good idea to schedule brestore.pl -b after your
331 Name = "BackupCatalog"
333 # This creates an ASCII copy of the catalog
334 RunBeforeJob = "/opt/bacula/etc/make_catalog_backup.pl MyCatalog"
335 # This deletes the copy of the catalog
336 RunAfterJob = "/opt/bacula/etc/delete_catalog_backup"
337 RunAfterJob = "/usr/lib/cgi-bin/bweb/bresto.pl action=batch"
340 To upgrade from an old installation, you can use :
341 ALTER TABLE brestore_pathvisibility ADD Size int8;
342 ALTER TABLE brestore_pathvisibility ADD Files int4;
344 ################ ACCESSING TO BWEB ############################
346 Now, you are able to launch firefox/mozilla and go on
347 http://your-server/bweb
349 ################ SETTING MYSQL ACCOUNT ########################
351 At this time, Bweb needs a write access to :
356 - Media::RecyclePoolId (it will change soon)
358 If your doesn't use Location feature, you can use ReadOnly access
359 for all tables, or setup something like :
361 GRANT SELECT ON bacula.* TO 'bweb'@'%' IDENTIFIED BY 'password';
362 GRANT INSERT,UPDATE,DELETE ON bacula.Location
363 TO 'bweb'@'%' IDENTIFIED BY 'password';
364 GRANT INSERT,UPDATE,DELETE ON bacula.LocationLog
365 TO 'bweb'@'%' IDENTIFIED BY 'password';
367 ################ GET MORE STATISTICS ###########################
369 You keep Jobs informations across retention into a JobHisto table.
370 You have to setup stat_job_table = JobHisto in bweb configuration.
372 And use Statistics module from Bacula (see documentation and update stats
375 ################ USE USERS AND GROUPS WITH BWEB ##########################
377 It works with postgresql and mysql5 (4 not tested).
378 With mysql, load bweb/script/bweb-mysql.sql into your catalog
379 For postgresql, it will be done with bweb/script/bweb-postgresql.sql (already done)
381 ################ MADE RESTORATION WITH BWEB ####################
383 It will do some basics things on a working bweb/brestore setup.
385 1) Go to http://extjs.com and download their toolkit (use the 2.2 release)
387 2) Install files in /bweb/ext web root
389 root@localhost:~# mv ext-2.2 /usr/share/bweb/html/ext
391 3) Make sure that brestore cache tables are in your catalog (bweb-xxx.sql files)
393 4) Enable bresto.pl cgi.
394 edit the bweb/cgi/bresto.pl script and change $bresto_enable=0; to $bresto_enable=1;
395 on the top of the file.
397 5) Use the last Bweb.pm
398 If you are trying bresto in a working bweb/brestore setup, you must make sure that you use
399 the last Bweb.pm git version.
401 6) Go on http://you-director/bweb/bresto.html
403 ################################################################