WebPros International, LLC ships many of cPanel & WHM’s third-party dependencies as RPMs. In order to customize these dependencies on your Red-Hat®-based system, you must custom-build the RPM and then reinstall it. For example, use this method to build and install Roundcube customizations.
Note:
RPMs work for Red-Hat systems only. Read our System Requirements for information on the Red-Hat systems we support.
You must log in through SSH as the root user to install an RPM.
Before you begin
Perform the following steps to ensure your system’s readiness to build and install an RPM:
.1Install the rpm-build package.Use the following command to install the rpm-build package on your system:
yum install rpm-build
.2Enable the devel target for cPanel & WHM.Run the update_local_rpm_versions and check_cpanel_pkgs scripts before you install a custom RPM. These scripts ensure that the devel target is enabled and up-to-date. The devel target installs the devel versions of RPMs, which cPanel & WHM uses to compile SRPMs locally.To do this, run the following commands:
Note:To rebuild some cPanel-provided RPMs, you may need to install additional RPMs that cPanel & WHM does not include in default installations. These additional RPMs contain files that the system only needs to rebuild, but not run, the cPanel-provided RPMs.
.3Install additional prerequisites.Before you can build and install a custom-built RPM, you must install all of the RPM’s prerequisites. You can find all of an RPM’s prerequisites, and the required version numbers, in its .spec file.
Lines in the .spec file that begin with BuildRequires: indicate a prerequisite that the RPM requires for the build process.
Lines in the .spec file that begin with Requires: indicate a prerequisite that the RPM requires for installation.For example, BuildRequires: cpanel-mysql >= 8.0.20 indicates that the RPM requires the cpanel-mysql RPM of MySQL® version 8.0.20 or higher.
.4Ensure that you have installed all necessary RPMs.Run the /scripts/sysup script to ensure that you have installed all of the prerequisite RPMs.
If all of these RPMs exist on your server, you will receive the following message: All Needed RPMS are installed.
If you receive an error message, correct those installation problems first to avoid additional errors when you build and install your custom RPM.
Build and install custom RPMs
Perform the following steps to build and install Roundcube customizations in cPanel & WHM version 58 and later:
.1Create the .rpmmacros file.Use your preferred text editor to create the .rpmmacros file in the /root/ directory.Add the following contents to the file:
%_topdir /root/rpmbuild
# enable debug RPM package by commenting this out.
%debug_package %{nil}
.2Create the directories to rebuild the RPM.
If not present on your server, create the following directories:
/root/rpmbuild/BUILD
/root/rpmbuild/SPECS
/root/rpmbuild/SOURCES
/root/rpmbuild/BUILDROOT
/root/rpmbuild/RPMS
/root/rpmbuild/SRPMS
Run the following command to create these directories:
You must use these names for the BUILD, SPECS, SOURCES, BUILDROOT, RPMS, and SRPMS directories. You must capitalize the entire name for each of these directories.
.3Install the source RPM.Use the rpm command to install the source RPM (SRPM).
The .spec file will install to the /root/rpmbuild/SPECS/ directory.
The source tarball, patches, and any additional files for the RPM will install to the /root/rpmbuild/SOURCES/ directory.
Note:You can find the correct SRPM for your version of cPanel & WHM on our httpupdate server. Click your server’s version of cPanel & WHM, and then click the src/ directory to view a list of all available SRPMs for that version.
.4Edit the .spec file.Use your preferred text editor to modify the .spec file in the /root/rpmbuild/SPECS/ directory. Add the desired configuration settings for your RPM.
Note:To change any of the sources that ship with the SRPM, modify the files in the /root/rpmbuild/SOURCES/ directory.The following example section of a .spec file includes the SOAP protocol:
.5Rebuild the RPM.Run the rpmbuild command on the modified .spec file to build the new RPM locally. Your command should resemble the following example:
rpmbuild -bb /root/rpmbuild/SPECS/php.spec
The rpmbuild tool writes the RPM and any subpackages to the /root/rpmbuild/RPMS/ directory
Note:The system may report dependencies issues when you run this command. If so, install these dependencies with yum before you continue.
.6Update your RPM with the force option.Navigate to the /root/rpmbuild/RPMS/ directory and run the rpm command to install your new custom-built RPM.Your command will resemble the following example, where cpanel-php54-5.4.23-4.cp1142.x86_64.rpm represents the RPM that you wish to update:
Warning:This step is optional and may freeze updates to this RPM and prevent future cPanel & WHM upgrades. However, if you do not perform this step, cPanel & WHM may overwrite your custom RPM on its next update or upgrade.
To prevent unintentional updates, add your custom RPM to the list of local RPMs in the /scripts/update_local_rpm_versions script. Your command will resemble the following example:
To verify your custom RPM’s configuration, view the /var/cpanel/rpm.versions.d/local.versions fileThe contents of the local.versions file should resemble the following example: