1 ################################################################
3 ################################################################
5 Bweb works well with 2.0 release or later.
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
74 bacula:~/bweb$ sed -i "s:/etc/bacula/bweb.conf:$PWD/bweb.conf:" lib/Bweb.pm
75 bacula:~/bweb$ cat > bweb.conf <<EOF
76 \$VAR1 = { template_dir => '$PWD/lang',
77 fv_write_path => '/tmp/',
81 # configure the database
82 bacula:~/bweb$ mysql bacula < script/bweb-mysql.sql
84 bacula:~/bweb$ psql bacula < script/bweb-postgresql.sql
86 # You can start the web server from the bweb directory
87 bacula@localhost:~/bweb$ ./script/starthttp
88 Using bweb on /home/eric/dev/git/gui/bweb, use firefox http://localhost:9180
89 2009-07-18 22:23:12: (log.c.75) server started
92 By default, only the loopback interface is binded, you can change that
93 in the bweb/script/httpd.conf file.
96 ################ FILE COPY (Full Apache methode) ###############
97 # you must get bweb svn files
98 svn checkout https://bacula.svn.sourceforge.net/svnroot/bacula/trunk/gui/bweb bweb
100 # or get them from the released tar files or from the apt or rpms.
103 # Once you have the gui directory loaded, follow the instructions below
104 # or edit the environment variables in the file install_bweb
105 # then execute it. install_web does everything to the next
109 # first, copy the bweb Perl library into your PERL5 INC path
113 install -m 644 -o root -g root bweb/lib/*.pm /usr/share/perl5
117 # copy the bweb perl program to your cgi location
118 mkdir -m 755 /usr/lib/cgi-bin/bweb
119 install -m 755 -o root -g root bweb/cgi/*.pl /usr/lib/cgi-bin/bweb
121 # get a config file, if you want to use an other place edit lib/Bweb.pm
122 mkdir -m 755 /etc/bacula
123 chown root:bacula /etc/bacula
124 echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bacula/bweb.conf
125 chown www-data /etc/bacula/bweb.conf
127 # copy the bweb template file
128 mkdir -p /usr/share/bweb/tpl/en
129 install -m 644 -o root -g root bweb/lang/en/tpl/*.tpl /usr/share/bweb/tpl/en
131 # copy the bweb graphics elements (bweb elements must reside in /bweb)
133 install -m 644 -o root -g root bweb/html/*.{js,png,css,gif,ico,html} /var/www/bweb
137 WARNING : Your www-data (or wwwrun on SuSE) user must be able to execute bconsole and able
138 to read the bconsole.conf file!
139 You can create an bconsole group for that.
141 ################ USE FRENCH/SPANISH VERSION ####################
143 Simply copy lang/fr/tpl/*.tpl files to .../tpl/fr/*.tpl and choose
144 your language in the configuration panel.
147 ################ APACHE CONFIGURATION ##########################
149 It could be a good idea to protect your bweb installation (optional).
151 Put this in your httpd.conf, and add user with htpasswd
153 Alias /bweb /usr/share/bweb/html
154 <Directory /usr/share/bweb/html>
155 Options FollowSymLinks MultiViews
161 ScriptAlias /cgi-bin/bweb /usr/lib/cgi-bin/bweb
162 <Directory /usr/lib/cgi-bin/bweb>
163 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
165 AuthName MyPrivateFile
166 AuthUserFile /etc/apache/htpasswd
171 On SuSE 10.2, the following in /etc/apache2/default-server.conf works.
172 However, it is not secure:
174 Directory "/srv/www/cgi-bin/bweb">
176 Options +ExecCGI -Includes
182 ################ CONFIGURATION #################################
184 Note, this is automatically installed by the install_bweb script.
186 /etc/bacula/bweb.conf looks like : (you can edit it inside bweb)
188 'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
190 'config_file' => '/etc/bacula/bweb.conf',
191 'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
201 'device' => '/dev/changer',
207 'mtxcmd' => '/usr/sbin/mtx',
213 }, 'Bweb::Autochanger' )
216 'template_dir' => '/usr/share/bweb/tpl',
218 'dbi' => 'DBI:mysql:database=bacula',
222 'email_media' => 'eric@localhost'
226 ################ BRESTORE ######################################
228 If you want to use brestore with bweb, you must associate a mime type
229 text/brestore with your brestore.pl, and you must install brestore.
230 See gui/brestore/README for instructions on installing brestore.pl.
232 ################ POSTGRESQL AND MYSQL5 NOTES ####################
234 If you want to use PostgreSQL instead of MySQL, you must add
235 a function to the PostgreSQL Bacula database to get Bweb to work.
237 psql -U bacula bacula < script/bweb-postgresql.sql
239 Tips: PL must be enabled in your cluster, you can do this with postgres user
240 postgres:~$ echo 'CREATE PROCEDURAL LANGUAGE plpgsql;' | psql bacula
243 To get database size with mysql5, edit Bweb.pm and change the DB_SIZE macro
245 # with mysql < 5, you have to play with the ugly SHOW command
246 DB_SIZE => " SELECT 0 ",
247 # works only with mysql 5
248 # DB_SIZE => " SELECT sum(DATA_LENGTH) FROM INFORMATION_SCHEMA.TABLES ",
250 ################ BCONSOLE NOTES ################################
252 You must use bconsole without conio/readline support. For that, use
253 the bconsole -n option. This is done automatically with the standard
254 configuration file. In addition, please ensure that the binary
255 bconsole file can be executed by your web server. It is normally
256 located in /usr/bin/bconsole (or some such file), and must have
257 modes 755 or it will not be executable by your web server. The
258 normal Bacula installation usually sets mode 750.
260 ################ BACULA LOG ####################################
262 If you want Bweb to be able to show listings of the Job output,
263 you must add a "catalog = all, !skipped, !saved" to your
264 messages resource in bacula-dir.conf and restart your Bacula
265 server. This is shown below:
270 operator = root@localhost = mount
271 console = all, !skipped, !saved
272 append = "/tmp/bacula/var/bacula/working/log" = all, !skipped
274 catalog = all, !skipped, !saved
278 ################ BWEB LIMITATION ###############################
280 To get bweb working, you must follow these rules
281 - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
282 - AutoChanger name must be same as Device and Location name in bacula
284 ################ SUDO CONFIGURATION ############################
286 If you use sudo, put this on you /etc/sudoers
288 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
289 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
290 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
291 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
293 ################ BFILEVIEW AND BTIME SETUP ###############################
295 Alias /bweb/fv /var/spool/bweb
296 <Directory "/var/spool/bweb">
298 AllowOverride AuthConfig
303 mkdir /var/spool/bweb
304 chmod 700 /var/spool/bweb
305 chown www-data /var/spool/bweb
307 Add (or configure) a writable location to the parameters in bweb.conf
308 'fv_write_path' => '/var/spool/bweb',
310 ###### BFILEVIEW only part
312 You have to remove "<!-- Remove this to activate bfileview" and "-->" from
313 tpl/en/display_job_zoom.tpl.
315 You MUST use brestore.pl -b or bresto.pl action=batch to initialize the database, and
316 you CAN use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
318 At this time, it's a good idea to schedule brestore.pl -b after your
322 Name = "BackupCatalog"
324 # This creates an ASCII copy of the catalog
325 RunBeforeJob = "/opt/bacula/etc/make_catalog_backup bacula bacula Pei0ahm9"
326 # This deletes the copy of the catalog
327 RunAfterJob = "/opt/bacula/etc/delete_catalog_backup"
328 RunAfterJob = "/usr/lib/cgi-bin/bweb/bresto.pl action=batch"
331 To upgrade from an old installation, you can use :
332 ALTER TABLE brestore_pathvisibility ADD Size int8;
333 ALTER TABLE brestore_pathvisibility ADD Files int4;
335 ################ ACCESSING TO BWEB ############################
337 Now, you are able to launch firefox/mozilla and go on
338 http://your-server/bweb
340 ################ SETTING MYSQL ACCOUNT ########################
342 At this time, Bweb needs a write access to :
347 - Media::RecyclePoolId (it will change soon)
349 If your doesn't use Location feature, you can use ReadOnly access
350 for all tables, or setup something like :
352 GRANT SELECT ON bacula.* TO 'bweb'@'%' IDENTIFIED BY 'password';
353 GRANT INSERT,UPDATE,DELETE ON bacula.Location
354 TO 'bweb'@'%' IDENTIFIED BY 'password';
355 GRANT INSERT,UPDATE,DELETE ON bacula.LocationLog
356 TO 'bweb'@'%' IDENTIFIED BY 'password';
358 ################ GET MORE STATISTICS ###########################
360 You keep Jobs informations across retention into a JobHisto table.
361 You have to setup stat_job_table = JobHisto in bweb configuration.
363 CREATE TABLE JobHisto (LIKE Job);
365 And run this on crontab when you want :
367 (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM JobHisto) );
369 ################ USE USERS AND GROUPS WITH BWEB ##########################
371 It works with postgresql and mysql5 (4 not tested).
372 With mysql, load bweb/script/bweb-mysql.sql into your catalog
373 For postgresql, it will be done with bweb/script/bweb-postgresql.sql (already done)
375 ################ MADE RESTORATION WITH BWEB ####################
377 It will do some basics things on a working bweb/brestore setup.
379 1) Go to http://extjs.com and download their toolkit (last 2.2 release)
381 2) Install files in /bweb/ext web root
383 root@localhost:~# mv ext-2.2 /usr/share/bweb/html/ext
385 3) Make sure that brestore cache tables are in your catalog (bweb-xxx.sql files)
387 4) Enable bresto.pl cgi.
388 edit the bweb/cgi/bresto.pl script and change $bresto_enable=0; to $bresto_enable=1;
389 on the top of the file.
391 5) Use the last Bweb.pm
392 If you are trying bresto in a working bweb/brestore setup, you must make sure that you use
393 the last Bweb.pm SVN version.
395 6) Go on http://you-director/bweb/bresto.html
397 ################################################################