Debian Codegraph @

manuals/en/utility/rpm-faq.tex

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