5 This guide shows how to build OpenAFS RPM packages for Red Hat Enterprise
6 Linux, CentOS, and Fedora, using the contributed RPM spec file provided with
7 the OpenAFS source code.
11 Upgrade your kernel to the most recent version.
13 $ sudo yum update kernel
14 $ sudo reboot # if updated
16 After rebooting (if neeed), install the kernel headers for your current kernel
19 $ sudo yum install "kernel-devel-uname-r == $(uname -r)"
21 Install the `elfutils-devel` package if building on RHEL 8/CentOS 8.
23 $ sudo yum install elfutils-devel # if RHEL/CentOS 8
25 Install the packages required to build the OpenAFS source RPM.
27 $ sudo yum install rpm-build yum-utils make perl libtool bzip2 wget
29 The OpenAFS build dependencies will be installed after the source RPM file is
30 generated in the steps below.
32 # Building OpenAFS RPMs
34 ## Method 1: Building from source code distribution
36 The OpenAFS Release Team provides software releases as source code
37 distributions. A source RPM file can easily be built from a source
38 distribution release with the `makesrpm.pl` script provided in the source tree.
40 Download the source distribution files from [openafs.org][3]. Four files are
41 provided in a release; a source tarball, a documentation tarball, release
42 notes, and a change log.
44 $ VERSION=1.8.6 # for example
45 $ wget https://www.openafs.org/dl/openafs/${VERSION}/openafs-${VERSION}-src.tar.bz2
46 $ wget https://www.openafs.org/dl/openafs/${VERSION}/openafs-${VERSION}-doc.tar.bz2
47 $ wget https://www.openafs.org/dl/openafs/${VERSION}/RELNOTES-${VERSION}
48 $ wget https://www.openafs.org/dl/openafs/${VERSION}/ChangeLog
50 Extract the `makesrpm.pl` script from the source tarball and then run it to
51 generate the source RPM. The resulting source RPM will be placed in the current
54 $ tar xf openafs-${VERSION}-src.tar.bz2 --strip-components=4 '*/makesrpm.pl'
55 $ perl makesrpm.pl openafs-${VERSION}-src.tar.bz2 openafs-${VERSION}-doc.tar.bz2 RELNOTES-${VERSION} ChangeLog
57 Install the OpenAFS build dependencies with `yum-builddep`. This command will
58 retrieve the required packages from the rpm spec file inside the source RPM.
60 $ sudo yum-builddep openafs-${VERSION}-1.src.rpm
62 Finally, run `rpmbuild` to build the binary RPMs. The resulting RPMs will be
63 placed in `$HOME/rpmbuild/RPMS`.
65 $ rpmbuild --rebuild openafs-${VERSION}-1.src.rpm
67 ## Method 2: Building from a git checkout
69 This method can be used to build rpms for OpenAFS from a git checkout of a
70 release tag or the current stable or development branch. A downside to this
71 method is the release notes and change log provided in the OpenAFS source
72 distribution releases are not included in the generated source RPM.
74 When building packages from a git checkout, be sure to always build in a clean
75 directory. In particular be sure the 'packages' directory is absent or empty
76 before building rpms. Also, be sure there are no uncommitted source code
77 changes. This method will only package code which has been committed, any
78 uncommitted changes will not be packaged.
80 The OpenAFS makefile includes the `make srpm` target to build a source RPM from
81 a git checkout of a release or pre-release tag. As of OpenAFS version 1.9.0,
82 the OpenAFS makefile includes the `make rpm` tag.
84 First, install the following packages needed to generate the makefile.
86 $ sudo yum install git make krb5-devel
88 Create a local git clone of the OpenAFS git repository and checkout the tag or
89 branch to be packaged.
91 $ git clone git://git.openafs.org/openafs.git
93 $ git checkout <branch-or-tag> # e.g., openafs-stable-1_8_5, openafs-devel-1_9_x, master
95 Run the `regen.sh` tool to generate the `configure` script, then run
96 `configure` to generate the OpenAFS makefile. Make the `dist` and `srpm`
97 targets to generate the source RPM. The resulting source RPM will be placed in
98 the `./packages` directory. (Note: The `configure` options given in this step
99 are not used to generate the binaries. The actual configure options are defined
100 in the spec file `openafs.spec.in`.)
103 $ ./configure --disable-kernel-module
106 Install the OpenAFS build dependencies with `yum-builddep`. This command will
107 retrieve the required packages from the rpm spec file inside the source RPM.
109 $ sudo yum-builddep ./packages/openafs-*.src.rpm
111 Build the binary RPMs with `rpmbuild`. By default, packages will be placed in
112 `$HOME/rpmbuild/RPMS`. See **rpmbuild options** below for various rpmbuild
115 $ rpmbuild --rebuild packages/openafs-*.src.rpm
117 The `make rpm` target is available as of OpenAFS 1.9.0. This target will build
118 the source distribution, source RPM, and binary RPM files. The rpm files will
119 be placed in the `./packages/rpmbuild/RPMS` directory. If the build
120 dependencies are already installed, the rpm files can be built with a single
121 `make rpm` command after generating the `Makefile`.
124 $ ./configure --disable-kernel-module # generate the Makefile
125 $ make rpm # create the source and binary rpm files
129 The OpenAFS spec file provides several options to select which packages are to
130 be built by `rpmbuild` and to enable certain build-time features in the
131 binaries. These options are specified as `rpmbuild` command line arguments.
133 The `build_userspace` and `build_modules` defines control when the kernel
134 module packages are to be built. Userspace packages includes all of the
135 packages except the kernel module package, including the servers and the
136 OpenAFS client Dynamic Kernel Module System (DKMS) package. By default,
137 both the userspace and kernel modules are built.
139 To build all of the packages except the OpenAFS kernel module:
143 --define "build_userspace 1" \
144 --define "build_modules 0" \
145 ./packages/openafs-*.src.rpm
147 To build only the OpenAFS kernel module for the currently running kernel:
151 --define "build_userspace 0" \
152 --define "build_modules 1" \
153 ./packages/openafs-*.src.rpm
155 Specify the `kernvers` option to build kernel modules for specific kernel
156 versions. Install `kernel-devel` packages for the versions you wish to build.
157 You may need to configure and enable the CentOS Vault "update" repositories for
158 older kernel versions.
160 # Install an older kernel-devel version.
161 $ sudo yum install kernel-devel-uname-r == "3.10.0-957.27.2.el7.x86_64"
163 $ rpm -qa kernel-devel
164 kernel-devel-3.10.0-957.27.2.el7.x86_64
165 kernel-devel-3.10.0-1062.12.1.el7.x86_64
167 $ rpm -i ./packages/openafs-*.src.rpm
171 --define "build_userspace 0" \
172 --define "build_modules 1" \
173 --define "kernvers 3.10.0-957.27.2.el7.x86_64" \
174 ~/rpmbuild/SPECS/openafs.spec
178 --define "build_userspace 0" \
179 --define "build_modules 1" \
180 --define "kernvers 3.10.0-1062.12.1.el7.x86_64" \
181 ~/rpmbuild/SPECS/openafs.spec
183 Additional `rpmbuild` options provided by the OpenAFS spec file are:
185 * `--without authlibs` Disable authlibs package
186 * `--without krb5` Disable krb5 support
187 * `--with bitmap-later` Enable "bitmap later" support
188 * `--with bos-restricted` Enable "bos restricted" mode
189 * `--with supergroups` Enable "supergroups"
190 * `--with kauth` Build the obsolete kaserver and related programs
194 Avoid kernel module build errors by ensuring you have a kernel-devel package
195 installed which matches the running kernel.
198 4.18.0-147.5.1.el8_1.x86_64
199 $ rpm -qP kernel-devel | grep uname
200 kernel-devel-uname-r = 4.18.0-147.5.1.el8_1.x86_64
202 Your build may fail with the error:
204 + /usr/lib/rpm/check-rpaths
206 ERROR 0001: file '/usr/lib64/libafsauthent.so.2.0.0' contains a standard rpath '/usr/lib64' in [/usr/lib64]
208 This check fails because the OpenAFS spec hardcoded the `/usr/lib64` standard
209 paths for some binaries. The Linux dynamic loader automatically loads shared
210 objects from this system default path, so the path specified in the spec file is
213 To disable this `check-rpath` check, set the `QA_RPATHS` environment variable
214 to `0x0001` before running rpmbuild.
216 $ export QA_RPATHS=0x0001
217 $ rpmbuild -bb ~/rpmbuild/SPECS/openafs.spec
219 # Installing OpenAFS RPMs
221 ## Installing client RPMs with the Dynamic Kernel Module System (DKMS)
223 The Dynamic Kernel Module System (DKMS) kernel modules take longer to install,
224 but are automatically rebuilt after the kernel is upgraded on the target
225 system. Unless you are maintaining, or have access to, a yum repository which
226 tracks kernel updates and builds matching OpenAFS kernel modules for each
227 update, you will want to use the DKMS method to install the OpenAFS kernel
230 Add the EPEL yum repository, which provides the DKMS system. Install the
231 Kerberos5 workstation package, which provides the `kinit` program. Install the
232 OpenAFS DKMS and openafs Kerberos5 support packages with `yum`. This will take
233 some time as the kernel-module is built from source. Be sure to install the
234 openafs-client and packages in a single `yum install` invocation.
236 $ cd ~/rpmbuild/RPMS/x86_64
237 $ sudo yum install epel-release
238 $ sudo yum install make
239 $ sudo yum install "kernel-devel-uname-r == $(uname -r)"
242 openafs-1.8.5-1.el8.x86_64.rpm \
243 openafs-docs-1.8.5-1.el8.x86_64.rpm \
244 openafs-krb5-1.8.5-1.el8.x86_64.rpm \
245 openafs-client-1.8.5-1.el8.x86_64.rpm \
246 dkms-openafs-1.8.5-1.el8.x86_64.rpm
248 ## Installing client RPMs with a pre-built kernel module (kmod)
250 Install the kmod which matches your currently running kernel version. Be sure
251 to install the openafs-client and kmod-openafs packages in a single `yum
254 $ cd ~/rpmbuild/RPMS/x86_64
257 openafs-1.8.5-1.el8.x86_64.rpm \
258 openafs-docs-1.8.5-1.el8.x86_64.rpm \
259 openafs-krb5-1.8.5-1.el8.x86_64.rpm \
260 openafs-client-1.8.5-1.el8.x86_64.rpm \
261 kmod-openafs-1.8.5-1.4.18.0_147.5.1.el8_1.x86_64.rpm
263 ## Installing server RPMs
265 Install the server package with:
267 $ cd ~/rpmbuild/RPMS/x86_64
269 openafs-1.8.5-1.el8.x86_64.rpm \
270 openafs-docs-1.8.5-1.el8.x86_64.rpm \
271 openafs-server-1.8.5-1.el8.x86_64.rpm
275 ## Building RPMs with mock
277 [Mock][4] is a tool for building packages in a chroot. The mock chroot
278 isolation makes it makes it easier to build a large number of kernel module
279 versions on a single build host. In addition, mock provides a clean build
280 environment for each build and mock will automatically install the build
281 requirements specified by the openafs.spec file in the temporary mock chroot.
283 Mock also provides the ability to build RPMs for different distributions on one
284 machine. For example, one could build RPMs targeted for CentOS 6, 7, and 8 on
285 single CentOS 8 build host. Although it is possible to build RPMs for other
286 distributions with mock, it not possible to build RPMs for other architectures
287 since mock does not support cross-compiling.
289 Install mock and add yourself to the 'mock' group.
291 $ sudo yum install mock
292 $ sudo usermod -a -G mock $USER
295 To build OpenAFS rpms with mock, first create the OpenAFS source RPM as shown
296 above, then run the mock commands to build the packages using the mock system.
298 $ mock --rebuild ./packages/openafs-*.src.rpm
300 ## Building RPMs with afsutil
302 [afsutil][5] is a python tool to facilitate OpenAFS development. The `afsutil
303 package` command is a front-end tool for building RPMs from a git checkout,
304 with or without mock. When used with mock, `afsutil` will, by default, build
305 kernel modules for every kernel-devel version discovered in the enabled yum
306 repositories within the mock chroot.
308 OpenAFS packages require a copy of the CellServDB client configuration file.
309 `afsutil package` will automatically download the CellServDB version specified
310 in the spec file from grand.central.org. An alternate CellServDB file can be
311 specified by url or local path with the `--csdb` option.
313 RPM packages for `afsutil` are available. This is the preferred installation
314 method on CentOS. Alternatively, `afsutil` may be installed with `pip` or
317 ### Method 1: Installing afsutil with yum
319 $ sudo yum install https://download.sinenomine.net/openafs/repo/sna-openafs-release-latest.noarch.rpm
320 $ sudo yum install afsutil
322 ### Method 2: Installing afsutil with pip
324 $ sudo yum install epel-release # if RHEL/CentOS
325 $ sudo yum install python2-pip # if RHEL/CentOS 8
326 $ sudo yum install python-pip # if RHEL/CentOS 7 or earlier
327 $ pip install --user afsutil
329 ### Method 2: Installing afsutil from source
331 $ git clone https://github.com/openafs-contrib/afsutil
333 $ python configure.py # or, python2 configure.py on RHEL/CentOS 8
336 ### Building RPMs with afsutil
338 To build OpenAFS packages from a git checkout:
340 $ sudo afsutil getdeps # Install build dependencies
341 $ git clone git://git.openafs.org/openafs.git
345 The `afsutil package` command will build packages for the userspace and kernel
346 modules by default. See the `--build` option to build these separately.
348 If you installed `mock` (see above), specify the `--mock` option to build the
349 packages in the mock chroot. Mock will automatically install the build
352 Build the server, client, and kernel module for the local machine with:
354 $ afsutil package --mock --kernel="$(uname -r)"
356 `afsutil package --mock` will query the yum repositories configured for the
357 mock chroot to discover the kernel-devel kernel versions available. You can
358 add local yum repositories to your mock configurations in `/etc/mock/` to
359 provide kernel-devel packages for older kernel versions.
361 To list kernel versions available in the mock chroot:
363 $ afsutil package --mock --list 2>/tmp/error
370 Specify the --kernel option to build a kmod for specific kernel version. This
371 option may be given more than once to build multiple kernel modules.
373 $ afsutil package --mock --build=kmods --kernel=3.10.0-1062.4.3.el7
375 To build all kernel module versions:
377 $ afsutil package --mock --build=kmods
379 If the afsutil package command is interrupted and then restarted, builds for
380 any already completed kmod-openafs RPMs will be skipped. Use the the --clobber
381 option to override this and force all of the RPMs to be rebuilt.
383 See `afsutil package --help` for the available options. Default values for
384 options may be specified in the `.afsutil.cfg` configuration file. See
385 the [afsutil README][5] for more information.
389 * [RPM Packaging Guide][6]
392 [1]: https://github.com/openafs-contrib/afsutil
393 [2]: https://pypi.org/project/afsutil/
394 [3]: https://www.openafs.org/release/
395 [4]: https://github.com/rpm-software-management/mock/wiki
396 [5]: https://github.com/openafs-contrib/afsutil
397 [6]: https://rpm-packaging-guide.github.io/