Much thanks to how cPanel continuously strives hard to make the lives of its users easier and more convenient, many of the RPMs now come as cPanel & WHM’s third-party dependencies pre-installed into the platforms.
Best of all, you can even customize these RPMs depending on your needs. However, you need to follow a chain of commands, but all it takes is this 7-step program.
After logging in as the root user through SSH, the first thing you should do is to create the .rpmmacros file. You can use any text editor you like to create this file and store it in the /root/ directory.
Make sure you include these in the file:
Some RPMs need rebuilding when you want to customize them. This involves creating directories that may still not exist on your server, including the following:
To create these directories, just execute this command:
It is extremely important you name everything exactly the way listed above, including the capitalization of the directory names.
Now, you can install your source RPM. To do this, just execute the rpm command. In the event you do not know the right cPanel and WHM version for the SRPM you need, you can find it on the cPanel’s httpupdate server.
When running the rpm command, it should look something like this:
Once successfully done with the installation a message similar to this will come up:
Using a text editor, revise the .spec file found in your system’s directory called: /root/rpmbuild/SPECS/. From here, you can make any additions you want for your RPM’s configuration settings.
Now, you have to rebuild the RPM. Do this by executing the rpmbuild command while staying on the modified .spec file. This will create a new local RPM.
To give you an idea, the command should look something like this:
Properly done, the re-written RPM and all its subpackages will make its way to the /root/rpmbuild/RPMS/ directory.
Go to your /root/rpmbuild/RPMS/ directory. From here, execute the rpm command once more, and it will install the newly made, custom-built RPM.
For many cPanel and WHM users, preventing unintentional updates make it to their list of priorities when building and installing custom RPMs. They do so, in order to avoid any potential problem from arising in the future, especially when cPanel rolls out updates or upgrades.
Know though, that this method is only optional, as it only prohibits automatic upgrades to the cPanel & WHM platforms (you can still upgrade, but would have to perform it manually.). The down side to not performing this step, on the other hand, is that future cPanel and WHM updates or upgrades may overwrite the custom-built RPMs.
To perform this last step, just add the custom RPM in the update_local_rpm_versions script, which contains all the local RPMs.