Compiling OpenLDAP for EL8 systems
Steps to compile openldap-server for CentOS 8 Stream
The EL8 release did not ship an openldap-server like it did in previous releases. Instead only the client tools and some libraries are included for existing applications. Instead the focus from the upstream provider has been on other LDAP solutions.
This leaves a problem for various sites who have their data in an OpenLDAP system and do not have the time, energy, resources for moving to something else. There are several possible solutions to this:
- Continue to use EL5/EL6 even though it is at end of open maintenance.
- Continue to use EL7 until it is end of open maintenance around 2024-06-30.
- Move to a different distribution which does have working openldap
- Compile replacement tools using the Fedora src.rpm which may be closer to the ‘upstream’.
- Compile replacement tools using the upstream source.
- Compile using the upstream source from https://git.centos.org
- [Added after initial post] You can download them from https://koji.mbox.centos.org/koji/
In this tutorial we will work with number 5. At the end we will cover number 6.
Setting up a build environment.
For simplicity sake, we will assume you have a working but minimally installed Fedora 35 or EL8 system (Alma, Oracle, Rocky, etc) which you can do compiles in. If we are using an EL8 system are going to need to get mock
and git
installed.
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
For Fedora and EL8 systems the following should work the same:
$ sudo dnf install git mock rpm-build
$ sudo usermod -a -G mock $USERNAME
$ newgrp mock
Answer yes to the questions about adding new keys and the packages should be installed to allow for a build to occur. We now need to set up a minimal .rpmmacros
file for the next steps:
# uncomment if you want to build in standard homedirectory
#%_topdir %(echo $HOME)/rpmbuild
# comment if want to use standard home directory
%_topdir %{getenv:PWD}
%_sourcedir %{_topdir}/SOURCES
#%_sourcedir %{_topdir}/SOURCES/%{name}-%{version}
%_specdir %{_topdir}/SPECS
%_srcrpmdir %{_topdir}/SRPMS
%_builddir %{_topdir}/BUILD
%__arch_install_post \
[ "%{buildarch}" = "noarch" ] || QA_CHECK_RPATHS=1 ; \
case "${QA_CHECK_RPATHS:-}" in [1yY]*) /usr/lib/rpm/check-rpaths ;; esac \
/usr/lib/rpm/check-buildroot
Once we have that in place, the following will get an openldap build going:
$ mkdir -vp ~/EL8-sources/ ~/output-packages/
$ cd ~/EL8-sources/
$ git clone https://git.centos.org/rpms/openldap.git
$ git clone https://git.centos.org/centos-git-common.git
$ cd openldap
$ ../centos-git-common/get_sources.sh
$ rpmbuild -bs SPECS/openldap.spec
Now depending on the host OS you are doing this on, you should see a file like SRPMS/openldap-2.4.46-18.fc35.src.rpm
or SRPMS/openldap-2.4.46-18.el8.src.rpm
having been created.
$ mock -r centos-stream+epel-next-8-x86_64 --chain --localrepo \
~/output-packages/ SRPMS/openldap-2.4.46-18.fc35.src.rpm
should then attempt to build the packages and will end up with a fully usable repo in ${HOMEDIR}/output-packages/results/centos-stream+epel-next-8-x86_64
If not, then there are probably some steps or problems I missed in this howto :(. At this point you can determine what to do with installing this -server package on the server needing it.
Downloading direct from CentOS.
This is the ‘feed the fisherman versus teaching how to fish’ part of the document.
If you are using CentOS Stream 8, you can download the build packages from the project koji. I expect similar steps can be done for other rebuilds.
dnf list openldap
to get which package you are looking for.- Open a window to https://koji.mbox.centos.org/koji/
- Type in openldap in the
Search
box. - Click on the build you would have installed. For this example, we will choose https://koji.mbox.centos.org/koji/buildinfo?buildID=18688 and then scroll down to the architecture you are using.
- Right click on the download button for openldap-servers like:https://koji.mbox.centos.org/pkgs/packages/openldap/2.4.46/18.el8/x86_64/openldap-servers-2.4.46-18.el8.x86_64.rpm
- Install this package in the package place you want.
- When dnf breaks because it can’t upgrade the package due to the upstream updating, go follow step 0 again.
No comments:
Post a Comment