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