]> git.sur5r.net Git - bacula/docs/blob - docs/manual/rpm-faq.tex
44383d64965275315e0ca2c3ecbb9c7c86f26074
[bacula/docs] / docs / manual / rpm-faq.tex
1 %%
2 %%
3
4 \chapter{Bacula RPM Packaging FAQ}
5 \label{RpmFaqChapter}
6 \index[general]{FAQ!Bacula\textsuperscript{\textregistered} - RPM Packaging }
7 \index[general]{Bacula\textsuperscript{\textregistered} - RPM Packaging FAQ }
8
9 \begin{enumerate}
10 \item 
11    \ilink{How do I build Bacula for platform xxx?}{faq1}  
12 \item 
13    \ilink{How do I control which database support gets built?}{faq2} 
14
15 \item 
16    \ilink{What other defines are used?}{faq3}  
17 \item 
18    \ilink{I'm getting errors about not having permission when I try to build the
19    packages. Do I need to be root?}{faq4}  
20 \item 
21    \ilink{I'm building my own rpms but on all platforms and compiles I get an
22    unresolved dependency for something called
23    /usr/afsws/bin/pagsh.}{faq5} 
24 \item 
25    \ilink{I'm building my own rpms because you don't publish for my platform.
26     Can I get my packages released to sourceforge for other people to use?}{faq6} 
27 \item 
28    \ilink{Is there an easier way than sorting out all these command line options?}{faq7}
29 \item 
30    \ilink{I just upgraded from 1.36.x to 1.38.x and now my director daemon won't start. It appears to start but dies silently and I get a "connection refused" error when starting the console. What is wrong?}{faq8}  
31 \item 
32    \ilink{There are a lot of rpm packages. Which packages do I need for what?}{faq9}  
33 \end{enumerate}
34
35 \section{Answers}
36 \index[general]{Answers }
37
38 \begin{enumerate}
39 \item 
40    \label{faq1}
41    {\bf How do I build Bacula for platform xxx?}
42    The bacula spec file contains defines to build for several platforms:
43    Red Hat 7.x (rh7), Red Hat 8.0 (rh8), Red Hat 9 (rh9), Fedora Core (fc1,
44    fc3, fc4, fc5, fc6), Whitebox Enterprise Linux 3.0 (wb3), Red Hat Enterprise Linux 
45    (rhel3, rhel4), Mandrake 10.x (mdk), Mandriva 2006.x (mdv) CentOS (centos3, centos4) 
46    and SuSE (su9, su10). The package build is controlled by a mandatory define set at 
47    the beginning of the file.  These defines basically just control the 
48    dependency information that gets coded into the finished rpm package as well 
49    as any special configure options required.  The platform define may be edited 
50    in the spec file directly (by default all defines are set to 0 or "not set").  
51    For example, to build the Red Hat 7.x package find the line in the spec file
52    which reads
53
54 \footnotesize
55 \begin{verbatim}
56         %define rh7 0
57         
58 \end{verbatim}
59 \normalsize
60
61 and edit it to read  
62
63 \footnotesize
64 \begin{verbatim}
65         %define rh7 1
66         
67 \end{verbatim}
68 \normalsize
69
70 Alternately you may pass the define on the command line when calling rpmbuild:
71  
72
73 \footnotesize
74 \begin{verbatim}
75         rpmbuild -ba --define "build_rh7 1" bacula.spec
76         rpmbuild --rebuild --define build_rh7 1" bacula-x.x.x-x.src.rpm
77         
78 \end{verbatim}
79 \normalsize
80
81 \item 
82    \label{faq2}
83    {\bf How do I control which database support gets built?}
84    Another mandatory build define controls which database support is compiled,
85    one of  build\_sqlite, build\_mysql or build\_postgresql. To get the MySQL
86    package and support either  set the  
87
88 \footnotesize
89 \begin{verbatim}
90         %define mysql 0
91         OR
92         %define mysql4 0
93         OR
94         %define mysql5 0
95         
96 \end{verbatim}
97 \normalsize
98
99 to  
100
101 \footnotesize
102 \begin{verbatim}
103         %define mysql 1
104         OR
105         %define mysql4 1
106         OR
107         %define mysql5 1
108         
109 \end{verbatim}
110 \normalsize
111
112 in the spec file directly or pass it to rpmbuild on the command line:  
113
114 \footnotesize
115 \begin{verbatim}
116         rpmbuild -ba --define "build_rh7 1" --define "build_mysql 1" bacula.spec
117         rpmbuild -ba --define "build_rh7 1" --define "build_mysql4 1" bacula.spec
118         rpmbuild -ba --define "build_rh7 1" --define "build_mysql5 1" bacula.spec
119         
120 \end{verbatim}
121 \normalsize
122
123 \item 
124    \label{faq3}
125    {\bf What other defines are used?}
126    Three other building defines of note are the depkgs\_version, docs\_version and
127    \_rescuever identifiers. These  two defines are set with each release and must 
128    match the version of those sources that are being used to build the packages. 
129    You would not ordinarily need to edit these.  See also the Build Options section 
130    below for other build time options that can be passed on the command line.
131 \item 
132    \label{faq4}
133    {\bf I'm getting errors about not having permission when I try  to build the
134    packages. Do I need to be root?}
135    No, you do not need to be root and, in fact, it is better practice to
136    build rpm packages as a non-root user.  Bacula packages are designed to
137    be built by a regular user but you must make a few changes on your
138    system to do this.  If you are building on your own system then the
139    simplest method is to add write permissions for all to the build
140    directory (/usr/src/redhat/, /usr/src/RPM or /usr/src/packages).  
141    To accomplish this, execute the following command as root:
142
143 \footnotesize
144 \begin{verbatim}
145         chmod -R 777 /usr/src/redhat
146         chmod -R 777 /usr/src/RPM
147         chmod -R 777 /usr/src/packages
148         
149 \end{verbatim}
150 \normalsize
151
152 If you are working on a shared system where you can not use the method
153 above then you need to recreate the appropriate above directory tree with all
154 of its subdirectories inside your home directory.  Then create a file named
155
156 {\tt .rpmmacros} 
157
158 in your home directory (or edit  the file if it already exists)
159 and add the following line:  
160
161 \footnotesize
162 \begin{verbatim}
163         %_topdir /home/myuser/redhat
164         
165 \end{verbatim}
166 \normalsize
167
168 Another handy directive for the .rpmmacros file if you wish to suppress the
169 creation of debug rpm packages is:
170
171 \footnotesize
172 \begin{verbatim}
173         %debug_package %{nil}
174         
175 \end{verbatim}
176
177 \normalsize
178
179 \item 
180    \label{faq5}
181    {\bf I'm building my own rpms but on all platforms and compiles I get an
182    unresolved dependency for something called /usr/afsws/bin/pagsh.} This
183    is a shell from the OpenAFS (Andrew File System).  If you are seeing
184    this then you chose to include the docs/examples directory in your
185    package.  One of the example scripts in this directory is a pagsh
186    script.  Rpmbuild, when scanning for dependencies, looks at the shebang
187    line of all packaged scripts in addition to checking shared libraries.
188    To avoid this do not package the examples directory. If you are seeing this 
189    problem you are building a very old bacula package as the examples have been 
190    removed from the doc packaging.
191
192 \item 
193    \label{faq6}
194    {\bf I'm building my own rpms because you don't publish for my platform.
195     Can I get my packages released to sourceforge for other people to use?} Yes, 
196     contributions from users are accepted and appreciated. Please examine the 
197     directory platforms/contrib-rpm in the source code for further information.
198
199 \item 
200    \label{faq7}
201    {\bf Is there an easier way than sorting out all these command line options?} Yes, 
202     there is a gui wizard shell script which you can use to rebuild the src rpm package. 
203    Look in the source archive for platforms/contrib-rpm/rpm\_wizard.sh. This script will 
204    allow you to specify build options using GNOME dialog screens. It requires zenity.
205
206 \item 
207    \label{faq8}
208    {\bf I just upgraded from 1.36.x to 1.38.x and now my director daemon
209 won't start.  It appears to start but dies silently and I get a "connection
210 refused" error when starting the console.  What is wrong?} Beginning with
211 1.38 the rpm packages are configured to run the director and storage
212 daemons as a non-root user.  The file daemon runs as user root and group
213 bacula, the storage daemon as user bacula and group disk, and the director
214 as user bacula and group bacula.  If you are upgrading you will need to
215 change some file permissions for things to work.  Execute the following
216 commands as root:
217
218 \footnotesize
219 \begin{verbatim}
220         chown bacula.bacula /var/bacula/*
221         chown root.bacula /var/bacula/bacula-fd.9102.state
222         chown bacula.disk /var/bacula/bacula-sd.9103.state
223         
224 \end{verbatim}
225 \normalsize
226
227 Further, if you are using File storage volumes rather than tapes those
228 files will also need to have ownership set to user bacula and group bacula.
229
230 \item 
231    \label{faq9}
232    {\bf There are a lot of rpm packages.  Which packages do I need for
233 what?} For a bacula server you need to select the packsge based upon your
234 preferred catalog database: one of bacula-mysql, bacula-postgresql or
235 bacula-sqlite.  If your system does not provide an mtx package you also
236 need bacula-mtx to satisfy that dependancy.  For a client machine you need
237 only install bacula-client.  Optionally, for either server or client
238 machines, you may install a graphical console bacula-bgnome-console and/or
239 bacula-bwxconsole.  One last package, bacula-updatedb is required only when
240 upgrading a server more than one database revision level.
241
242
243
244 \item {\bf Support for RHEL3/4, CentOS 3/4 and x86\_64}
245    The examples below show
246    explicit build support for RHEL4 and CentOS 4. Build support 
247    for x86\_64 has also been added. Test builds have been done on CentOS but 
248    not RHEL4.
249 \end{enumerate}
250
251 \footnotesize
252 \begin{verbatim}
253 Build with one of these 3 commands:
254
255 rpmbuild --rebuild \
256         --define "build_rhel4 1" \
257         --define "build_sqlite 1" \
258         bacula-1.38.3-1.src.rpm
259
260 rpmbuild --rebuild \
261         --define "build_rhel4 1" \
262         --define "build_postgresql 1" \
263         bacula-1.38.3-1.src.rpm
264
265 rpmbuild --rebuild \
266         --define "build_rhel4 1" \
267         --define "build_mysql4 1" \
268         bacula-1.38.3-1.src.rpm
269
270 For CentOS substitute '--define "build_centos4 1"' in place of rhel4.
271
272 For 64 bit support add '--define "build_x86_64 1"'
273 \end{verbatim}
274 \normalsize
275
276 \section{Build Options}
277 \index[general]{Build Options}
278 The spec file currently supports building on the following platforms:
279 \footnotesize
280 \begin{verbatim}
281 Red Hat builds
282 --define "build_rh7 1"
283 --define "build_rh8 1"
284 --define "build_rh9 1"
285
286 Fedora Core build
287 --define "build_fc1 1"
288 --define "build_fc3 1"
289 --define "build_fc4 1"
290 --define "build_fc5 1"
291 --define "build_fc6 1"
292
293 Whitebox Enterprise build
294 --define "build_wb3 1"
295
296 Red Hat Enterprise builds
297 --define "build_rhel3 1"
298 --define "build_rhel4 1"
299
300 CentOS build
301 --define "build_centos3 1"
302 --define "build_centos4 1"
303
304 SuSE build
305 --define "build_su9 1"
306 --define "build_su10 1"
307
308 Mandrake 10.x build
309 --define "build_mdk 1"
310
311 Mandriva build
312 --define "build_mdv 1"
313
314 MySQL support:
315 for mysql 3.23.x support define this
316 --define "build_mysql 1"
317 if using mysql 4.x define this,
318 currently: Mandrake 10.x, Mandriva 2006.0, SuSE 9.x & 10.0, FC4 & RHEL4
319 --define "build_mysql4 1"
320 if using mysql 5.x define this,
321 currently: SuSE 10.1 & FC5
322 --define "build_mysql5 1"
323
324 PostgreSQL support:
325 --define "build_postgresql 1"
326
327 Sqlite support:
328 --define "build_sqlite 1"
329
330 Build the client rpm only in place of one of the above database full builds:
331 --define "build_client_only 1"
332
333 X86-64 support:
334 --define "build_x86_64 1"
335
336 Supress build of bgnome-console:
337 --define "nobuild_bgconsole 1"
338
339 Build the WXWindows console:
340 requires wxGTK >= 2.6
341 --define "build_bwxconsole 1"
342
343 Build python scripting support:
344 --define "build_python 1"
345
346 Modify the Packager tag for third party packages:
347 --define "contrib_packager Your Name <youremail@site.org>"
348
349 \end{verbatim}
350 \normalsize
351
352 \section{RPM Install Problems}
353 \index[general]{RPM Install Problems}
354 In general the RPMs, once properly built should install correctly.
355 However, when attempting to run the daemons, a number of problems
356 can occur:
357 \begin{itemize}
358 \item [Wrong /var/bacula Permissions]
359   By default, the Director and Storage daemon do not run with
360   root permission. If the /var/bacula is owned by root, then it
361   is possible that the Director and the Storage daemon will not
362   be able to access this directory, which is used as the Working
363   Directory. To fix this, the easiest thing to do is:
364 \begin{verbatim}
365   chown bacula:bacula /var/bacula
366 \end{verbatim}
367   Note: as of 1.38.8 /var/bacula is installed root:bacula with
368   permissions 770.
369 \item [The Storage daemon cannot Access the Tape drive]
370   This can happen in some older RPM releases where the Storage
371   daemon ran under userid bacula, group bacula.  There are two
372   ways of fixing this: the best is to modify the /etc/init.d/bacula-sd
373   file so that it starts the Storage daemon with group "disk".
374   The second way to fix the problem is to change the permissions
375   of your tape drive (usually /dev/nst0) so that Bacula can access it.
376   You will probably need to change the permissions of the SCSI control
377   device as well, which is usually /dev/sg0.  The exact names depend
378   on your configuration, please see the Tape Testing chapter for
379   more information on devices.
380 \end{itemize}
381