BuycPanel Blog

BuycPanel Blog

Latest news and updates

How do you Install a Custom-Built RPM

Posted by Allura on 22 05 2019.

A Brief Overview
Since cPanel Inc. often ships the third-party dependencies of cPanel and WHM as RPMs, the RPM has to be custom-built and then reinstalled for the dependencies to be customized on one’s server.This document outlines the process to be followed so do the same.However, firstly, a user must ensure the system’s readiness for an RPM to be custom-built and installed.Note:One must be logged in as the root user through SSH to install an RPM.Checking the System’s Readiness for an RPM Installation
Follow the outlined steps to ensure that the RPM can be installed –Run the ‘yum install rpm-build’ command to install the rpm-build package on the system.
Enable the devel target to ensure that the devel versions of cPanel and WHM are installed, which ensure that SRPMs are compiled locally.Note:Rebuilding certain cPanel provided RPMs may require installation of further ones not included at the default installation stage, containing files…

A Brief Overview

Since cPanel Inc. often ships the third-party dependencies of cPanel and WHM as RPMs, the RPM has to be custom-built and then reinstalled for the dependencies to be customized on one’s server.

This document outlines the process to be followed so do the same.

However, firstly, a user must ensure the system’s readiness for an RPM to be custom-built and installed.

Note:

One must be logged in as the root user through SSH to install an RPM.

Checking the System’s Readiness for an RPM Installation

Follow the outlined steps to ensure that the RPM can be installed –

  • Run the ‘yum install rpm-build’ command to install the rpm-build package on the system.
  • Enable the devel target to ensure that the devel versions of cPanel and WHM are installed, which ensure that SRPMs are compiled locally.

Note:

Rebuilding certain cPanel provided RPMs may require installation of further ones not included at the default installation stage, containing files needed by the system in order to build an RPM.

  • Install additional prerequisites of RPM in question. These can be located in its .spec file.
  • Finally, run the /scripts/sysup script to ensure that all the necessary RPMs have been installed. A message saying ‘All Needed RPMs are Installed’ should then be displayed, indicating the system’s readiness to build and install the given RPM.

 

Installing Custom-Built RPMs

Having ensured that one’s system is ready to undertake the process, a user must simply perform the following steps to install the RPM:

  1. Use a preferred text editor to create the .rpmmacros file in the /root/ directory and add –

%_topdir /root/rpmbuild
and
%debug_package %{nil}

  1. In case the directories to build an RPM are not present on your server, create the following –

/root/rpmbuild/BUILD
/root/rpmbuild/SPECS
/root/rpmbuild/SOURCES
/root/rpmbuild/BUILDROOT
/root/rpmbuild/RPMS
/root/rpmbuild/SRPMS

  1. Install the source RPM using the rpm command. While the .specs file will install to the /root/rpmbuild/SPECS/ directory, any additional files will install to the /root/rpmbuild/SOURCES/ directory.
  2. Then Edit the RPMs .specs file using a text editor, thereby adding the desired configuration settings for the RPM.

Note:

To Edit the sources being shipped with the SRPM, modify the additional files in the SOURCES directory.

  1. Run the rpmbuild command on the particular .specs file to rebuild the given RPM locally.
  2. One that is down, access the  /root/rpmbuild/RPMS/ directory in order to run the rpm command and install the new, custom-built RPM.
  3. Further, to prevent unintentional updates to the installed RPM, one must add it to the list of local RPMs in the /scripts/update_local_rpm_versions script and verify its configuration by viewing the /var/cpanel/rpm.versions.d/local.versions file.

Note:

This final step is an optional one and may prevent upgradation of the RPM.

Concluding Thoughts

The aforementioned step-by-step process , if followed, will then allow a user to rebuild or to simply install a custom-built RPM on his or her server.