3.5. Using Software Collections over NFS


In some environments, the requirement is often to have a centralized model for how applications and tools are distributed rather than allowing users to install the application or tool version they prefer. In this way, NFS is the common method of mounting centrally managed software.
To use a Software Collection over NFS, you need to define a Software Collection macro nfsmountable. If you define the macro when building a Software Collection, the resulting Software Collection has its state files and configuration files located outside the Software Collection's /opt file system hierarchy. This enables you to mount the /opt file system hierarchy over NFS as read-only.
To build a Software Collection with the nfsmountable macro defined, run the following command:
 rpmbuild -ba software_collection.spec --define 'scl software_collection' --define 'nfsmountable 1' 
where software_collection is the name of the Software Collection. Defining the macro changes the values for the _sysconfdir, _sharedstatedir, and _localstatedir macros. The changed values are detailed in the following table.
Table 3.1. Changed Values for Software Collection Macros
Macro
Original definition
Expanded value for the original definition
Changed definition
Expanded value for the changed definition
_sysconfdir
%{_scl_root}/etc
/opt/provider/%{scl}/root/etc
%{_root_sysconfdir}%{_scl_prefix}/scls/%{scl}
/etc/opt/provider/scls/%{scl}
_sharedstatedir
%{_scl_root}/var/lib
/opt/provider/%{scl}/root/var/lib
%{_root_localstatedir}%{_scl_prefix}/scls/%{scl}/lib
/var/opt/provider/scls/%{scl}/lib
_localstatedir
%{_scl_root}/var
/opt/provider/%{scl}/root/var
%{_root_localstatedir}%{_scl_prefix}/scls/%{scl}
/var/opt/provider/scls/%{scl}
Note that the expanded values for the changed definitions contain a /scls directory in their paths.

3.5.1. Changed Directory Structure and File Ownership

The nfsmountable macro also has an impact on how the scl_install and scl_files macros create a directory structure and set the file ownership when you run the rpmbuild command.
For example, a directory structure of a Software Collection named software_collection looks as follows:
$ rpmbuild -ba software_collection.spec --define 'scl software_collection' --define 'nfsmountable 1'
...
$ rpm -qlp software_collection-runtime-1-1.el6.x86_64
/etc/opt/provider/scls/software_collection
/etc/opt/provider/scls/software_collection/X11
/etc/opt/provider/scls/software_collection/X11/applnk
/etc/opt/provider/scls/software_collection/X11/fontpath.d
...
/opt/provider/software_collection/root/usr/src
/opt/provider/software_collection/root/usr/src/debug
/opt/provider/software_collection/root/usr/src/kernels
/opt/provider/software_collection/root/usr/tmp
/var/opt/provider/scls/software_collection
/var/opt/provider/scls/software_collection/cache
/var/opt/provider/scls/software_collection/db
/var/opt/provider/scls/software_collection/empty
...
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.