]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/INSTALL
Update install doc
[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 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
18 ################ FILE COPY #####################################
19  # you must get bweb cvs files
20  cvs -d:pserver:anonymous@bacula.cvs.sourceforge.net:/cvsroot/bacula login 
21  cvs -z3 -d:pserver:anonymous@bacula.cvs.sourceforge.net:/cvsroot/bacula co -P gui
22  cd gui
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 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  That should show you if any of the pre-requisites are missing.
93  On SuSE 10.2, I was able to load all the appropriate modules via rpms,
94   with the exception of Expect and Time::ParseDate, which I loaded manually
95   using perl.
96
97 ################ APACHE CONFIGURATION ##########################
98
99 It could be a good idea to protect your bweb installation (optional).
100
101 Put this in your httpd.conf, and add user with htpasswd
102
103 <Directory /usr/lib/cgi-bin/bweb>
104         Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
105         AuthType Basic
106         AuthName MyPrivateFile
107         AuthUserFile /etc/apache/htpasswd
108         AllowOverride None
109         Require valid-user
110 </Directory>
111
112 On SuSE 10.2, the following in /etc/apache2/default-server.conf works. 
113 However, it is not secure:
114
115 Directory "/srv/www/cgi-bin/bweb">
116  AllowOverride None
117  Options +ExecCGI -Includes
118  Order allow,deny
119  Allow from all
120 </Directory>
121
122
123 ################ CONFIGURATION #################################
124
125 Note, this is automatically installed by the install_bweb script.
126
127 /etc/bacula/bweb.conf looks like : (you can edit it inside bweb)
128 $VAR1 = bless( {
129   'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
130   'name' => undef,
131   'config_file' => '/etc/bacula/bweb.conf',
132   'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
133   'ach_list' => {
134      'S1_L80' => bless( {
135          'info' => {
136                      'drive' => 0,
137                      'io' => 0,
138                      'slot' => 0
139                    },
140          'name' => 'S1_L80',
141          'bweb' => undef,
142          'device' => '/dev/changer',
143          'drive' => [],
144          'debug' => 0,
145          'label' => {},
146          'precmd' => 'sudo',
147          'io' => [],
148          'mtxcmd' => '/usr/sbin/mtx',
149          'drive_name' => [
150                            'S1_L80_SDLT0',
151                            'S1_L80_SDLT1'
152                          ],
153          'slot' => []
154        }, 'Bweb::Autochanger' )
155    },
156   'password' => 'xxx',
157   'template_dir' => '/usr/share/bweb/tpl',
158   'dbi' => 'DBI:mysql:database=bacula',
159   'error' => '',
160   'debug' => 0,
161   'user' => 'bacula',
162   'email_media' => 'eric@localhost'
163 }, 'Bweb::Config' );
164
165
166 ################ BRESTORE ######################################
167
168 If you want to use brestore with bweb, you must associate a mime type
169 text/brestore with your brestore.pl, and you must install brestore.
170 See gui/brestore/README for instructions on installing brestore.pl.
171
172 ################ POSTGRESQL NOTES ##############################
173
174 If you want to use PostgreSQL instead of MySQL, you must add
175 a function to the PostgreSQL Bacula database to get Bweb to work.
176
177 psql -u bacula bacula < script/bweb-postgresql.sql
178
179 ################ BCONSOLE NOTES ################################
180
181 You must use bconsole without conio/readline support. For that, use
182 the bconsole -n option. This is done automatically with the standard
183 configuration file.  In addition, please ensure that the binary
184 bconsole file can be executed by your web server. It is normally
185 located in /usr/bin/bconsole (or some such file), and must have
186 modes 755 or it will not be executable by your web server.  The
187 normal Bacula installation usually sets mode 750.
188
189 ################ BACULA LOG ####################################
190
191 If you want Bweb to be able to show listings of the Job output,
192 you must add a "catalog = all, !skipped, !saved" to your
193 messages resource in bacula-dir.conf and restart your Bacula 
194 server.  This is shown below:
195
196 Messages {
197   Name = Standard
198
199   operator = root@localhost = mount
200   console = all, !skipped, !saved
201   append = "/tmp/bacula/var/bacula/working/log" = all, !skipped
202
203   catalog = all, !skipped, !saved
204 }
205
206
207 ################ BWEB LIMITATION ###############################
208
209 To get bweb working, you must follow these rules
210  - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
211  - AutoChanger name must be same as Device and Location name in bacula
212
213 ################ SUDO CONFIGURATION ############################
214
215 If you use sudo, put this on you /etc/sudoers
216
217 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
218 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
219 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
220 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
221
222 ################ BFILEVIEW SETUP ###############################
223
224 At this time, bfileview works only with PostgreSQL.
225
226 Alias /bweb/fv /var/spool/bweb
227 <Directory "/var/spool/bweb">
228     Options None
229     AllowOverride AuthConfig
230     Order allow,deny
231     Allow from all
232 </Directory>
233
234 mkdir /var/spool/bweb
235 chmod 700 /var/spool/bweb
236 chown www-data /var/spool/bweb
237
238 You have to remove "<!-- Remove this to activate bfileview" and "-->" from
239 tpl/display_job_zoom.tpl.
240
241 You must use brestore.pl -b to initialize the database, and
242 you can use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
243
244 At this time, it's a good idea to schedule brestore.pl -b after your 
245 BackupCatalog job.
246
247 Job {
248   Name = "BackupCatalog"
249   ...
250   # This creates an ASCII copy of the catalog
251   RunBeforeJob = "/opt/bacula/etc/make_catalog_backup bacula bacula Pei0ahm9"
252   # This deletes the copy of the catalog
253   RunAfterJob  = "/opt/bacula/etc/delete_catalog_backup"
254   RunAfterJob  = "/usr/local/bin/brestore.pl -b"
255 }
256
257 To upgrade from an old installation, you can use :
258 ALTER TABLE brestore_pathvisibility ADD Size int8;
259 ALTER TABLE brestore_pathvisibility ADD Files int4;
260
261 ################ ACCESSING TO BWEB ###############################
262
263 Now, you are able to launch firefox/mozilla and go on
264 http://your-server/bweb
265
266 Enjoy !