]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/INSTALL
Tentative fix for missing digest signature in bug 807.
[bacula/bacula] / gui / bweb / INSTALL
1 ################################################################
2 #               INSTALL NOTES                                  #
3 ################################################################
4
5 Bweb works well with 1.39 release or later.
6
7 1) install Perl lib
8 2) copy your files
9 3) initialize your configuration file
10 4) do some sql stuff (for postgresql or mysql 5 users)
11 5) use the -n option on bconsole so that it works with Expect
12 6) get bacula log more useful
13 7) bweb limitation
14 8) using sudo with autochanger
15 9) using bfileview.pl
16 10) accessing to bweb
17 11) setting mysql read-only account
18 12) get more statistics
19
20 ################ FILE COPY #####################################
21  # you must get bweb svn files
22  svn checkout https://bacula.svn.sourceforge.net/svnroot/bacula/trunk/gui/bweb bweb
23
24  # or get them from the released tar files or from the apt or rpms.
25
26  #
27  # Once you have the gui directory loaded, follow the instructions below
28  #  or edit the environment variables in the file install_bweb
29  #  then execute it. install_web does everything to the next
30  #  set of #######'s.
31  #
32
33  # first, copy the bweb Perl library into your PERL5 INC path
34  perl Makefile.PL
35  make install
36  # or
37  install -m 644 -o root -g root  bweb/lib/*.pm /usr/share/perl5
38
39  # copy the bweb perl program to your cgi location
40  mkdir -m 755 /usr/lib/cgi-bin/bweb
41  install -m 755 -o root -g root  bweb/cgi/*.pl /usr/lib/cgi-bin/bweb
42
43  # get a config file
44  mkdir -m 755 /etc/bacula
45  chown root:bacula /etc/bacula
46  echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bacula/bweb.conf
47  chown www-data /etc/bacula/bweb.conf
48
49  # copy the bweb template file
50  mkdir -p /usr/share/bweb/tpl
51  install -m 644 -o root -g root  bweb/tpl/*.tpl /usr/share/bweb/tpl
52
53  # copy the bweb graphics elements (bweb elements must reside in /bweb)
54  mkdir /var/www/bweb
55  install -m 644 -o root -g root  bweb/html/*.{js,png,css,gif,ico,html} /var/www/bweb
56
57  # done !
58
59  WARNING : Your www-data (or wwwrun on SuSE) user must be able to execute bconsole and able 
60            to read the bconsole.conf file!
61            You can create an bconsole group for that.
62
63 ################ USE FRENCH VERSION ############################
64
65 Simply use lang/fr/tpl/*.tpl files instead of tpl/*.tpl
66
67 ################ INSTALL PERL LIBRARY ##########################
68
69  - perl modules
70     - DBI (with mysql or postgresql support DBD::Pg and DBD::mysql)
71     - GD::Graph
72     - GD
73     - HTML::Template
74     - CGI
75     - Expect
76     - Time::ParseDate
77
78  You can install perl modules with CPAN
79  perl -e shell -MCPAN
80   > install Expect
81
82  Or use your distribution
83  apt-get install libgd-graph-perl libhtml-template-perl libexpect-perl
84  apt-get install libdbd-mysql-perl libdbd-pg-perl libdbi-perl libtime-modules-perl
85
86  Note: the best way to test if you have all the dependencies
87  fullfilled for Perl is to:
88   
89     cd /var/www/cgi-bin/bweb
90     ./bweb.pl 
91
92  you might also want to try:
93
94     ./bgraph.pl 
95
96  To make sure the graphing modules are loaded.  However, running it
97  will spray binary graphics data on your terminal.  Otherwise, you will
98  get an error.
99
100  That should show you if any of the pre-requisites are missing.
101  On SuSE 10.2, I was able to load all the appropriate modules via rpms,
102   with the exception of Expect and Time::ParseDate, which I loaded manually
103   using perl.
104
105   If you experience problems, always consult the Apache error_log
106   file.
107
108 ################ APACHE CONFIGURATION ##########################
109
110 It could be a good idea to protect your bweb installation (optional).
111
112 Put this in your httpd.conf, and add user with htpasswd
113
114 <Directory /usr/lib/cgi-bin/bweb>
115         Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
116         AuthType Basic
117         AuthName MyPrivateFile
118         AuthUserFile /etc/apache/htpasswd
119         AllowOverride None
120         Require valid-user
121 </Directory>
122
123 On SuSE 10.2, the following in /etc/apache2/default-server.conf works. 
124 However, it is not secure:
125
126 Directory "/srv/www/cgi-bin/bweb">
127  AllowOverride None
128  Options +ExecCGI -Includes
129  Order allow,deny
130  Allow from all
131 </Directory>
132
133
134 ################ CONFIGURATION #################################
135
136 Note, this is automatically installed by the install_bweb script.
137
138 /etc/bacula/bweb.conf looks like : (you can edit it inside bweb)
139 $VAR1 = bless( {
140   'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
141   'name' => undef,
142   'config_file' => '/etc/bacula/bweb.conf',
143   'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
144   'ach_list' => {
145      'S1_L80' => bless( {
146          'info' => {
147                      'drive' => 0,
148                      'io' => 0,
149                      'slot' => 0
150                    },
151          'name' => 'S1_L80',
152          'bweb' => undef,
153          'device' => '/dev/changer',
154          'drive' => [],
155          'debug' => 0,
156          'label' => {},
157          'precmd' => 'sudo',
158          'io' => [],
159          'mtxcmd' => '/usr/sbin/mtx',
160          'drive_name' => [
161                            'S1_L80_SDLT0',
162                            'S1_L80_SDLT1'
163                          ],
164          'slot' => []
165        }, 'Bweb::Autochanger' )
166    },
167   'password' => 'xxx',
168   'template_dir' => '/usr/share/bweb/tpl',
169   'dbi' => 'DBI:mysql:database=bacula',
170   'error' => '',
171   'debug' => 0,
172   'user' => 'bacula',
173   'email_media' => 'eric@localhost'
174 }, 'Bweb::Config' );
175
176
177 ################ BRESTORE ######################################
178
179 If you want to use brestore with bweb, you must associate a mime type
180 text/brestore with your brestore.pl, and you must install brestore.
181 See gui/brestore/README for instructions on installing brestore.pl.
182
183 ################ POSTGRESQL AND MYSQL5 NOTES ####################
184
185 If you want to use PostgreSQL instead of MySQL, you must add
186 a function to the PostgreSQL Bacula database to get Bweb to work.
187
188 psql -U bacula bacula < script/bweb-postgresql.sql
189
190 Tips: PL must be enabled in your cluster, you can do this with postgres user
191 postgres:~$ echo 'CREATE PROCEDURAL LANGUAGE plpgsql;' | psql bacula 
192
193
194 To get database size with mysql5, edit Bweb.pm and change the DB_SIZE macro
195
196  # with mysql < 5, you have to play with the ugly SHOW command
197  DB_SIZE => " SELECT 0 ",
198  # works only with mysql 5
199  # DB_SIZE => " SELECT sum(DATA_LENGTH) FROM INFORMATION_SCHEMA.TABLES ",
200
201 ################ BCONSOLE NOTES ################################
202
203 You must use bconsole without conio/readline support. For that, use
204 the bconsole -n option. This is done automatically with the standard
205 configuration file.  In addition, please ensure that the binary
206 bconsole file can be executed by your web server. It is normally
207 located in /usr/bin/bconsole (or some such file), and must have
208 modes 755 or it will not be executable by your web server.  The
209 normal Bacula installation usually sets mode 750.
210
211 ################ BACULA LOG ####################################
212
213 If you want Bweb to be able to show listings of the Job output,
214 you must add a "catalog = all, !skipped, !saved" to your
215 messages resource in bacula-dir.conf and restart your Bacula 
216 server.  This is shown below:
217
218 Messages {
219   Name = Standard
220
221   operator = root@localhost = mount
222   console = all, !skipped, !saved
223   append = "/tmp/bacula/var/bacula/working/log" = all, !skipped
224
225   catalog = all, !skipped, !saved
226 }
227
228
229 ################ BWEB LIMITATION ###############################
230
231 To get bweb working, you must follow these rules
232  - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
233  - AutoChanger name must be same as Device and Location name in bacula
234
235 ################ SUDO CONFIGURATION ############################
236
237 If you use sudo, put this on you /etc/sudoers
238
239 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
240 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
241 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
242 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
243
244 ################ BFILEVIEW SETUP ###############################
245
246 At this time, bfileview works only with PostgreSQL.
247
248 Alias /bweb/fv /var/spool/bweb
249 <Directory "/var/spool/bweb">
250     Options None
251     AllowOverride AuthConfig
252     Order allow,deny
253     Allow from all
254 </Directory>
255
256 mkdir /var/spool/bweb
257 chmod 700 /var/spool/bweb
258 chown www-data /var/spool/bweb
259
260 You have to remove "<!-- Remove this to activate bfileview" and "-->" from
261 tpl/display_job_zoom.tpl.
262
263 You must use brestore.pl -b to initialize the database, and
264 you can use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
265
266 At this time, it's a good idea to schedule brestore.pl -b after your 
267 BackupCatalog job.
268
269 Job {
270   Name = "BackupCatalog"
271   ...
272   # This creates an ASCII copy of the catalog
273   RunBeforeJob = "/opt/bacula/etc/make_catalog_backup bacula bacula Pei0ahm9"
274   # This deletes the copy of the catalog
275   RunAfterJob  = "/opt/bacula/etc/delete_catalog_backup"
276   RunAfterJob  = "/usr/local/bin/brestore.pl -b"
277 }
278
279 To upgrade from an old installation, you can use :
280 ALTER TABLE brestore_pathvisibility ADD Size int8;
281 ALTER TABLE brestore_pathvisibility ADD Files int4;
282
283 ################ ACCESSING TO BWEB ############################
284
285 Now, you are able to launch firefox/mozilla and go on
286 http://your-server/bweb
287
288 ################ SETTING MYSQL ACCOUNT ########################
289
290 At this time, Bweb needs a write access to :
291 - Location 
292 - LocationLog
293 - Media::LocationId
294 - Media::Comment
295 - Media::RecyclePoolId (it will change soon)
296
297 If your doesn't use Location feature, you can use ReadOnly access
298 for all tables, or setup something like :
299
300 GRANT SELECT ON bacula.* TO 'bweb'@'%'  IDENTIFIED BY 'password';
301 GRANT INSERT,UPDATE,DELETE ON bacula.Location 
302   TO 'bweb'@'%' IDENTIFIED BY 'password';
303 GRANT INSERT,UPDATE,DELETE ON bacula.LocationLog 
304   TO 'bweb'@'%' IDENTIFIED BY 'password';
305 GRANT UPDATE (LocationId,Comment,RecyclePoolId) ON bacula.Media 
306   TO 'bweb'@'%'  IDENTIFIED BY 'password';
307
308 ################ GET MORE STATISTICS ###########################
309
310 You keep Jobs informations across retention into a job_old table.
311 You have to setup stat_job_table = job_old in bweb configuration.
312
313 CREATE TABLE job_old (LIKE Job);
314
315 And run this on crontab when you want :
316 INSERT INTO job_old 
317   (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM job_old) );
318
319 ################################################################
320
321 Enjoy !