]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/INSTALL
ebl cleanup last fix
[bacula/bacula] / gui / bweb / INSTALL
1 ################################################################
2 #               INSTALL NOTES                                  #
3 ################################################################
4
5 Bweb works well with 1.39 release.
6
7 1) install perl lib
8 2) copy your files
9 3) intialise your configuration file
10 4) do some sql stuff (for postgresql user)
11 5) get a bconsole that work with Expect
12 6) get bacula log more useful
13 7) bweb limitation
14 8) using sudo with autochanger
15
16 ################ FILE COPY #####################################
17
18  # first, copy bweb perl librarie in your PERL5 INC path
19  install -m 644 -o root -g root  bweb/lib/*.pm /usr/share/perl5
20
21  # copy bweb perl program to you cgi location
22  mkdir -m 755 /usr/lib/cgi-bin/bweb
23  install -m 755 -o root -g root  bweb/cgi/*.pl /usr/lib/cgi-bin/bweb
24
25  # get a config file
26  mkdir -m 750 /etc/bweb
27  chown root:www-data /etc/bweb
28  echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bweb/config
29  chown www-data /etc/bweb/config
30
31  # copy bweb template file
32  mkdir -p /usr/share/bweb/tpl
33  install -m 644 -o root -g root  bweb/tpl/*.tpl /usr/share/bweb/tpl
34
35  # copy bweb graphics elements (bweb elements must reside on /bweb)
36  mkdir /var/www/bweb
37  install -m 644 -o root -g root  bweb/html/*.{js,png,css,gif,ico} /var/www/bweb
38
39  # done !
40
41  WARNING : Your www-data user must be able to execute bconsole and able to read bconsole.conf !
42            You can create an bconsole group for that.
43
44 ################ INSTALL PERL LIBRARY ##########################
45
46  - perl modules
47     - DBI (with mysql or postgresql support DBD::Pg and DBD::mysql)
48     - Gd::Graph
49     - HTML::Template
50     - CGI
51     - Expect
52
53  You can install perl modules with CPAN
54  perl -e shell -MCPAN
55   > install Expect
56
57  Or use your distribution
58  apt-get install libgd-graph-perl libhtml-template-perl libexpect-perl
59  apt-get install libdbd-mysql-perl libdbd-pg-perl libdbi-perl
60
61 ################ APACHE CONFIGURATION ##########################
62
63 It could be a good idea to protect your bweb installation.
64
65 Put this in you httpd.conf, and add user with htpasswd
66
67 <Directory /usr/lib/cgi-bin/bweb>
68         Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
69         AuthType Basic
70         AuthName MyPrivateFile
71         AuthUserFile /etc/apache/htpasswd
72         AllowOverride None
73         Require valid-user
74 </Directory>
75
76
77 ################ CONFIGURATION #################################
78
79 /etc/bweb/config looks like : (you can edit it inside bweb)
80 $VAR1 = bless( {
81   'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
82   'name' => undef,
83   'config_file' => '/etc/bweb/config',
84   'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
85   'ach_list' => {
86      'S1_L80' => bless( {
87          'info' => {
88                      'drive' => 0,
89                      'io' => 0,
90                      'slot' => 0
91                    },
92          'name' => 'S1_L80',
93          'bweb' => undef,
94          'device' => '/dev/changer',
95          'drive' => [],
96          'debug' => 0,
97          'label' => {},
98          'precmd' => 'sudo',
99          'io' => [],
100          'mtxcmd' => '/usr/sbin/mtx',
101          'drive_name' => [
102                            'S1_L80_SDLT0',
103                            'S1_L80_SDLT1'
104                          ],
105          'slot' => []
106        }, 'Bweb::Autochanger' )
107    },
108   'password' => 'xxx',
109   'template_dir' => '/usr/share/bweb/tpl',
110   'dbi' => 'DBI:mysql:database=bacula',
111   'error' => '',
112   'debug' => 0,
113   'user' => 'bacula',
114   'email_media' => 'eric@localhost'
115 }, 'Bweb::Config' );
116
117
118 ################ BRESTORE ######################################
119
120 If you want to use brestore with bweb, you must associate mime type
121 text/brestore with your brestore.pl.
122
123 ################ POSTGRESQL NOTES ##############################
124
125 If you think that Mysql is not a great database (or just a toy), you must add
126 function to the Postgresql bacula database to get Bweb works.
127
128 psql -u bacula bacula < script/bweb-postgresql.sql
129
130 ################ BCONSOLE NOTES ################################
131
132 You must use bconsole without conio/readline support. For that, use
133 bconsole -n option.
134
135 ################ BACULA LOG ####################################
136
137 To use Bweb log engine, you must apply this little patch and have the
138 new Log table in your database.
139
140 After, you can fill your database with :
141 while true; do
142         tail -f /tmp/log.sql | bacula -u bacula bacula
143 done
144
145 cd bacula-src
146 patch -p1 < message.patch
147 --- cvs/src/lib/message.c       2006-07-27 21:06:20.000000000 +0200
148 +++ cvs/src/lib/message.c.director      2006-07-28 13:46:49.171083494 +0200
149 @@ -716,6 +716,18 @@
150                  }
151                  fputs(dt, d->fd);
152                  fputs(msg, d->fd);
153 +               void db_escape_string(char *snew, char *old, int len);
154 +               if (jcr) {
155 +                       char ed1[50];
156 +                       POOL_MEM cmd(PM_MESSAGE);
157 +                       int len = strlen(msg);
158 +                       char *p = (char *)malloc(len * 2 + 1);
159 +                       db_escape_string(p, msg, len);
160 +                       FILE *fp = fopen("/tmp/log.sql", "a");
161 +                       fprintf(fp, "INSERT INTO Log (Time, JobId, LogText) VALUES (NOW(),%s, '%s');\n", edit_int64(jcr->JobId, ed1), p);
162 +                       fclose(fp);
163 +               }
164 +
165                  break;
166               case MD_DIRECTOR:
167                  Dmsg1(850, "DIRECTOR for following msg: %s", msg);
168
169
170 This patch is only for director, this will breaks the rest.
171 you can revert it with patch -p1 -R < message.patch
172
173 ################ BWEB LIMITATION ###############################
174
175 To get bweb working, you must follow these rules
176  - Media, Storage and Pool must have [A-Za-z_0-9\.-]+ (no space)
177  - AutoChanger name must be same as Device and Location name in bacula
178
179 ################ SUDO CONFIGURATION ############################
180
181 If you use sudo, put this on you /etc/sudoers
182
183 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer transfer *
184 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer status
185 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer load *
186 www-data ALL = (root) NOPASSWD: /usr/sbin/mtx -f /dev/changer unload *
187
188
189 Enjoy !