The update_local_rpm_versions Script

Last modified: July 13, 2022


Overview

Use the /usr/local/cpanel/scripts/update_local_rpm_versions script to update the /var/cpanel/rpm.versions.d/local.versions file. These updates override the /usr/local/cpanel/etc/rpm.versions file and change how the rpm.versions system manages packages. You must run this script as the root user.

For more information about how files in the /var/cpanel/rpm.versions.d/ directory override the /usr/local/cpanel/etc/rpm.versions file, read our Target Settings documentation.

Note:
  • Because YAML is space-sensitive, misspelled words are common when system administrators edit a file manually. For this reason, we encourage system administrators to use this script to edit the /var/cpanel/rpm.versions.d/local.versions file.
  • Do not use this script to change your server’s MySQL® version.

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/scripts/update_local_rpm_versions [options]

Options

Use the following options with this script:

Options Description Example
--add Use this option to add a package target to the /var/cpanel/rpm.versions.d/local.versions file. --add target_settings.target state
--edit Use this option to edit a package target in the /var/cpanel/rpm.versions.d/local.versions file. --edit target_settings.target state
--del Use this option to remove a package target in the /var/cpanel/rpm.versions.d/local.versions file. --del target_settings.target

Override management of a target

To use the /usr/local/cpanel/scripts/update_local_rpm_versions script to override the rpm.versions system’s management of a package target, perform the following steps:

  1. Run the following command, where target represents the name of the target and state represents installed, uninstalled, or unmanaged:

    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.target state

    For example, to set the pure-ftpd target to the unmanaged state, run the following command:

    /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.pure-ftpd unmanaged

  2. To confirm that the target now uses the desired state, run the following command:

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

    The system displays the current state next to the target name. If, for example, you set the pure-ftpd target to unmanaged, the /var/cpanel/rpm.versions.d/local.versions file will resemble the following example:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    
    file_format:
      version: 2
    install_targets: {}
    
    rpm_groups: {}
    
    rpm_locations: {}
    
    srpm_sub_packages: {}
    
    srpm_versions: {}
    target_settings:
      pure-ftpd: unmanaged
    url_templates: {} 

  3. Run the following command to apply your changes to the rpm.versions system:

    /usr/local/cpanel/scripts/check_cpanel_pkgs --fix
    Important:

    You must run this command to apply the changes to the rpm.versions system.

Note:

To set FTP services to unmanaged, run these commands for both the pure-ftpd and proftpd targets.

Return a target to the cPanel-provided behavior

To return a package target to the default behavior in the /usr/local/cpanel/etc/rpm.versions file, perform the following steps:

  1. Run the following command, where target represents the name of the target:

    /usr/local/cpanel/scripts/update_local_rpm_versions --del target_settings.target
    For example, to return the pure-ftpd target to the cPanel-provided settings, run the following command:
    /usr/local/cpanel/scripts/update_local_rpm_versions --del target_settings.pure-ftpd
    Note:

    When you use this command, you return that target to its default value in the /usr/local/cpanel/etc/rpm.versions file (either installed or uninstalled).

  2. To confirm that the settings in the /var/cpanel/rpm.versions.d/local.versions file no longer override the cPanel-provided defaults for the target, run the following command:

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

    The /var/cpanel/rpm.versions.d/local.versions file will no longer list that target.

  3. Run the following command to apply your changes to the rpm.versions system:

    /usr/local/cpanel/scripts/check_cpanel_pkgs --fix
    Important:

    You must run this command to apply the changes to the rpm.versions system.

Note:

To return FTP services to the managed state, run these commands for both the pure-ftpd and proftpd targets.

Additional Documentation