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