]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/en/utility/rpm-faq.tex
Update for version 5.0.1
[bacula/docs] / docs / manuals / en / utility / 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 \item 
34    \ilink{What happened to the build switches for gnome console, wxconsole and bat?}{faq10}  
35 \end{enumerate}
36
37 \section{Answers}
38 \index[general]{Answers }
39
40 \begin{enumerate}
41 \item 
42    \label{faq1}
43    {\bf How do I build Bacula for platform xxx?}
44    The bacula spec file contains defines to build for several platforms: \\
45    \\
46    Red Hat 7.x (rh7), Red Hat 8.0 (rh8), Red Hat 9 (rh9), \\
47    Fedora Core (fc1, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10), \\
48    Whitebox Enterprise Linux 3.0 (wb3), \\
49    Red Hat Enterprise Linux (rhel3, rhel4, rhel5), \\
50    Mandrake 10.x (mdk), Mandriva 2006.x (mdv), \\ 
51    CentOS (centos3, centos4, centos5) \\ 
52    Scientific Linux (sl3, sl4, sl5) and \\
53    SuSE (su9, su10, su102, su103, su110, su111, su112). \\
54    \\
55    The package build is controlled by a mandatory define set at the beginning of the file.  These defines basically just control the dependency information that gets coded into the finished rpm package as well 
56    as any special configure options required.  The platform define may be edited 
57    in the spec file directly (by default all defines are set to 0 or "not set").  
58    For example, to build the Red Hat 7.x package find the line in the spec file
59    which reads
60
61 \footnotesize
62 \begin{verbatim}
63         %define rh7 0
64         
65 \end{verbatim}
66 \normalsize
67
68 and edit it to read  
69
70 \footnotesize
71 \begin{verbatim}
72         %define rh7 1
73         
74 \end{verbatim}
75 \normalsize
76
77 Alternately you may pass the define on the command line when calling rpmbuild:
78  
79
80 \footnotesize
81 \begin{verbatim}
82         rpmbuild -ba --define "build_rh7 1" bacula.spec
83         rpmbuild --rebuild --define build_rh7 1" bacula-x.x.x-x.src.rpm
84         
85 \end{verbatim}
86 \normalsize
87
88 \item 
89    \label{faq2}
90    {\bf How do I control which database support gets built?}
91    Another mandatory build define controls which database support is compiled,
92    one of  build\_sqlite, build\_mysql or build\_postgresql. To get the MySQL
93    package and support either  set the  
94
95 \footnotesize
96 \begin{verbatim}
97         %define mysql 0
98         
99 \end{verbatim}
100 \normalsize
101
102 to  
103
104 \footnotesize
105 \begin{verbatim}
106         %define mysql 1
107         
108 \end{verbatim}
109 \normalsize
110
111 in the spec file directly or pass it to rpmbuild on the command line:  
112
113 \footnotesize
114 \begin{verbatim}
115         rpmbuild -ba --define "build_rh7 1" --define "build_mysql 1" bacula.spec
116         
117 \end{verbatim}
118 \normalsize
119
120 \item 
121    \label{faq3}
122    {\bf What other defines are used?} \\
123    One other building define of note is the depkgs\_version. This define is set with each release and must 
124    match the version of the source that is being used to build the packages. 
125    You would not ordinarily need to edit this.  See also the Build Options section 
126    below for other build time options that can be passed on the command line.
127 \item 
128    \label{faq4}
129    {\bf I'm getting errors about not having permission when I try  to build the
130    packages. Do I need to be root?} \\
131    No, you do not need to be root and, in fact, it is better practice to
132    build rpm packages as a non-root user.  Bacula packages are designed to
133    be built by a regular user but you must make a few changes on your
134    system to do this.  If you are building on your own system then the
135    simplest method is to add write permissions for all to the build
136    directory (/usr/src/redhat/, /usr/src/RPM or /usr/src/packages).  
137    To accomplish this, execute the following command as root:
138
139 \footnotesize
140 \begin{verbatim}
141         chmod -R 777 /usr/src/redhat
142         chmod -R 777 /usr/src/RPM
143         chmod -R 777 /usr/src/packages
144         
145 \end{verbatim}
146 \normalsize
147
148 If you are working on a shared system where you can not use the method
149 above then you need to recreate the appropriate above directory tree with all
150 of its subdirectories inside your home directory.  Then create a file named
151
152 {\tt .rpmmacros} 
153
154 in your home directory (or edit  the file if it already exists)
155 and add the following line:  
156
157 \footnotesize
158 \begin{verbatim}
159         %_topdir /home/myuser/redhat
160         %_tmppath /tmp
161         
162 \end{verbatim}
163 \normalsize
164
165 It should be noted that Fedora from verion 10 and up is configured to build in
166 the directory ~/rpmbuild.
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.} \\
183    This is a shell from the OpenAFS (Andrew File System).  If you are
184    seeing this then you chose to include the docs/examples directory in
185    your 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
189    this problem you are building a very old bacula package as the examples
190    have been 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?}
196     \\
197     Yes, contributions from users are accepted and appreciated.  Please
198     examine the directory platforms/contrib-rpm in the source code for
199     further information.
200
201 \item 
202    \label{faq7}
203    {\bf Is there an easier way than sorting out all these command line options?}
204    \\
205    Yes, there is a gui wizard shell script which you can use to rebuild the
206    src rpm package.  Look in the source archive for
207    platforms/contrib-rpm/rpm\_wizard.sh.  This script will allow you to
208    specify build options using GNOME dialog screens.  It requires zenity.
209
210 \item 
211    \label{faq8}
212    {\bf I just upgraded from 1.36.x to 1.38.x and now my director daemon
213 won't start.  It appears to start but dies silently and I get a "connection
214 refused" error when starting the console.  What is wrong?} \\
215    Beginning with 1.38 the rpm packages are configured to run the director
216    and storage daemons as a non-root user.  The file daemon runs as user
217    root and group bacula, the storage daemon as user bacula and group disk,
218    and the director as user bacula and group bacula.  If you are upgrading
219    you will need to change some file permissions for things to work.
220    Execute the following commands as root:
221
222 \footnotesize
223 \begin{verbatim}
224         chown bacula.bacula /var/bacula/*
225         chown root.bacula /var/bacula/bacula-fd.9102.state
226         chown bacula.disk /var/bacula/bacula-sd.9103.state
227         
228 \end{verbatim}
229 \normalsize
230
231 Further, if you are using File storage volumes rather than tapes those
232 files will also need to have ownership set to user bacula and group bacula.
233
234 \item 
235    \label{faq9}
236    {\bf There are a lot of rpm packages.  Which packages do I need for
237 what?} \\
238 For a bacula server you need to select the packsge based upon your
239 preferred catalog database: one of bacula-mysql, bacula-postgresql or
240 bacula-sqlite.  If your system does not provide an mtx package you also
241 need bacula-mtx to satisfy that dependancy.  For a client machine you need
242 only install bacula-client.  Optionally, for either server or client
243 machines, you may install a graphical console bacula-gconsole and/or
244 bacula-wxconsole. The Bacula Administration Tool is installed with the 
245 bacula-bat package.  One last package, bacula-updatedb is required only when
246 upgrading a server more than one database revision level.
247
248 \item 
249    \label{faq10}
250 The gnome console and wxconsole software is deprecated in favor of bat. The 
251 bat (bacula administrative tool) is now packaged in it's own source RPM. There 
252 are no command line switches to build it. The SRPM contains the current version 
253 of QT that bat is developed against. Building the RPM will build QT and then build 
254 bat against it. It will not install QT on your system. The resulting bat binary 
255 can then be installed on a system without QT or with a different version of QT as it 
256 will not use the QT shared objects.
257
258
259 \item {\bf Support for RHEL3/4/5, CentOS 3/4/5, Scientific Linux 3/4/5 and x86\_64}
260    \\
261    The examples below show
262    explicit build support for RHEL4 and CentOS 4. Build support 
263    for x86\_64 has also been added. 
264 \end{enumerate}
265
266 \footnotesize
267 \begin{verbatim}
268 Build with one of these 3 commands:
269
270 rpmbuild --rebuild \
271         --define "build_rhel4 1" \
272         --define "build_sqlite 1" \
273         bacula-1.38.3-1.src.rpm
274
275 rpmbuild --rebuild \
276         --define "build_rhel4 1" \
277         --define "build_postgresql 1" \
278         bacula-1.38.3-1.src.rpm
279
280 rpmbuild --rebuild \
281         --define "build_rhel4 1" \
282         --define "build_mysql4 1" \
283         bacula-1.38.3-1.src.rpm
284
285 For CentOS substitute '--define "build_centos4 1"' in place of rhel4. 
286 For Scientific Linux substitute '--define "build_sl4 1"' in place of rhel4.
287
288 For 64 bit support add '--define "build_x86_64 1"'
289 \end{verbatim}
290 \normalsize
291
292 \section{Build Options}
293 \index[general]{Build Options}
294 The spec file currently supports building on the following platforms:
295 \footnotesize
296 \begin{verbatim}
297 Red Hat builds
298 --define "build_rh7 1"
299 --define "build_rh8 1"
300 --define "build_rh9 1"
301
302 Fedora Core build
303 --define "build_fc1 1"
304 --define "build_fc3 1"
305 --define "build_fc4 1"
306 --define "build_fc5 1"
307 --define "build_fc6 1"
308 --define "build_fc7 1"
309 --define "build_fc8 1"
310 --define "build_fc9 1"
311 --define "build_fc10 1"
312
313 Whitebox Enterprise build
314 --define "build_wb3 1"
315
316 Red Hat Enterprise builds
317 --define "build_rhel3 1"
318 --define "build_rhel4 1"
319 --define "build_rhel5 1"
320
321 CentOS build
322 --define "build_centos3 1"
323 --define "build_centos4 1"
324 --define "build_centos5 1"
325
326 Scientific Linux build
327 --define "build_sl3 1"
328 --define "build_sl4 1"
329 --define "build_sl5 1"
330
331 SuSE build
332 --define "build_su9 1"
333 --define "build_su10 1"
334 --define "build_su102 1"
335 --define "build_su103 1"
336 --define "build_su110 1"
337 --define "build_su111 1"
338 --define "build_su112 1"
339
340 Mandrake 10.x build
341 --define "build_mdk 1"
342
343 Mandriva build
344 --define "build_mdv 1"
345
346 MySQL support:
347 --define "build_mysql 1"
348
349 PostgreSQL support:
350 --define "build_postgresql 1"
351
352 Sqlite support:
353 --define "build_sqlite 1"
354
355 Build the client rpm only in place of one of the above database full builds:
356 --define "build_client_only 1"
357
358 X86-64 support:
359 --define "build_x86_64 1"
360
361 Build python scripting support:
362 --define "build_python 1"
363
364 Build tcpwrappers support:
365 --define "build_tcpwrappers 1"
366
367 Modify the Packager tag for third party packages:
368 --define "contrib_packager Your Name <youremail@site.org>"
369
370 Install most files to /opt/bacula directory:
371 --define "single_dir_install 1"
372
373 \end{verbatim}
374 \normalsize
375
376 \section{RPM Install Problems}
377 \index[general]{RPM Install Problems}
378 In general the RPMs, once properly built should install correctly.
379 However, when attempting to run the daemons, a number of problems
380 can occur:
381 \begin{itemize}
382 \item Wrong /var/bacula Permissions \\
383   By default, the Director and Storage daemon do not run with
384   root permission. If the /var/bacula is owned by root, then it
385   is possible that the Director and the Storage daemon will not
386   be able to access this directory, which is used as the Working
387   Directory. To fix this, the easiest thing to do is:
388 \begin{verbatim}
389   chown bacula:bacula /var/bacula
390 \end{verbatim}
391   Note: as of 1.38.8 /var/bacula is installed root:bacula with
392   permissions 770.
393 \item The Storage daemon cannot Access the Tape drive \\
394   This can happen in some older RPM releases where the Storage
395   daemon ran under userid bacula, group bacula.  There are two
396   ways of fixing this: the best is to modify the /etc/init.d/bacula-sd
397   file so that it starts the Storage daemon with group "disk".
398   The second way to fix the problem is to change the permissions
399   of your tape drive (usually /dev/nst0) so that Bacula can access it.
400   You will probably need to change the permissions of the SCSI control
401   device as well, which is usually /dev/sg0.  The exact names depend
402   on your configuration, please see the Tape Testing chapter for
403   more information on devices.
404 \end{itemize}
405