How to Override the rpm.versions System in cPanel

The rpm.versions file in cPanel serves as an important database for managing installed RPM packages. It stores information about package versions ensuring that the correct packages are installed and updated. However, there might be scenarios where you need to override this file to install specific package versions, resolve conflicts, or test new packages.

In this article, we will explore how to effectively override the rpm.versions system in cPanel along with detailed steps and considerations.

Understanding rpm.versions

The rpm.versions file in cPanel is an important component of the package management system. It essentially acts as a database storing information about the installed RPM packages including their version numbers and other metadata. This file is essential for ensuring that the correct packages are installed and updated. However, there might be scenarios where you need to override the version information in this file perhaps to install a specific version of a package that isn’t available in the default repositories or to address compatibility issues.

Reasons for Overriding rpm.versions

The following are reasons for overriding rpm.versions system in cPanel:

  1. When you need to install a particular version of a package due to compatibility requirements or to test a specific feature.
  2. If you encounter conflicts between packages due to version mismatches, overriding the rpm.versions file can help resolve these issues.
  3. Before deploying a new package to your server you might want to test it in a controlled environment. Overriding rpm.versions can help isolate the testing process.

Override rpm.versions using WHM

Following are the steps described below to change rpm.versions system cPanel:

1. Log in to your WebHost Manager (WHM) interface as the root user.

WHM interface

2. Under the “Package Manager” section, choose the “Custom RPM” option.

3. Browse to the location of the RPM file you want to install and upload it.

4. Once the RPM file is uploaded you will be presented with an option to “Override rpm.versions.” Check this option to proceed. You can also search for the respective package through name:

php install

5. Click the “Install” button to initiate the installation process.

Override rpm.versions using Server

To override.rpm cPanel, you need a Linux VPS server along with cPanel installed. Log in to your server via SSH as the root user.

The /var/cpanel/rpm.versions.d/ directory contains configuration files that define how cPanel handles RPM packages. You can create a custom file here to override the default behavior for specific RPM packages.

rpm.versions file

Create a custom configuration file to override the rpm.versions system. Run the following command to create or edit the file:

nano /var/cpanel/rpm.versions.d/local.versions

In this file, you can specify how RPMs should be managed. Here’s an example of how to override a package by excluding it from updates:

file_format:
  version: 2

targets:
  mypackage: 
    version: 1.0
    install_target: no
local.versions file

To understand the example above file:

  • mypackage: is the name of the RPM you want to manage.
  • version: 1.0: defines the version to be locked.
  • install_target: no prevents the package from being installed.

To exclude an RPM package from automatic updates use the no option for install_target.

After creating or editing your local.versions file verify the configuration using the following command:

/usr/local/cpanel/scripts/check_cpanel_rpms --fix

This script will check your customizations and apply the necessary overrides.

Practical Scenario

Let’s assume you need to install PHP 7.2 on your server but your cPanel repository only offers PHP 7.4 and later. Here’s how you can override rpm.versions to install PHP 7.2:

Obtain the RPM file for PHP 7.2 from a trusted source, such as the official PHP website.

RPM resource

Follow the steps outlined above via WHM to upload the PHP 7.2 RPM file to your cPanel server.

Check the “Override rpm.versions” option during the upload process.

Click the “Install” button to proceed with the installation.

Important Consideration

The following are the important considerations while cPanel rpm.versions modification:

  • Before making any changes to the rpm.versions file, it’s highly recommended to create a backup. This will allow you to revert to the original state if necessary.
  • Overriding rpm.versions can potentially lead to package conflicts or stability issues consider the implications before proceeding.
  • While the WHM interface provides a convenient way to override rpm.versions you can also use command line tools like rpm and yum to manage packages and modify the rpm.versions file directly.

Conclusion

Overriding the rpm.versions system in cPanel is a powerful tool that can be used to customize your server’s package management. However, it’s essential to use this feature with a clear understanding of the potential consequences. By following the steps outlined in this guide and exercising caution, you can effectively leverage rpm.versions to meet your specific server requirements.

When it comes to buying hosting Ultahost is the best place to provide shared hosting plans for bloggers, small-business owners, web designers, and developers. Check out our plans according to your requirements.

FAQ

What is the rpm.versions system in cPanel?
Why would I want to override rpm.versions in cPanel?
How do I override the rpm.versions system in cPanel?
Is it safe to override rpm.versions?
Can I revert changes after overriding rpm.versions?
Will overriding rpm.versions affect my cPanel updates?
Do I need root access to override rpm.versions in cPanel?

Related Post

How to Change your cPanel Password

cPanel is a popular web hosting control panel that offe...

How to Delete Files and Directories on Linux

To delete files and directories in Linux you can use th...

How to modify a cPanel account in WHM

Web Host Manager (WHM) is a powerful tool that allows w...

How To Install Kali Linux – A Step-by-Step

There are many operating systems you could install on a...

How To Create Teamspeak Server On Windows Ser

TeamSpeak is a highly robust voice communication softwa...

How to Fix “Connection reset by peer

The "connection reset by peer" problem is an issue that...

Leave a Comment