EasyApache 4 Profile Backup Using CLI

  Uncategorized

Introduction

EasyApache 4 is used in cPanel/WHM servers to manage Apache, PHP versions, PHP extensions, and related web server packages. Before making any EasyApache 4 changes, upgrades, PHP version modifications, or package updates, it is recommended to take a backup of the current EasyApache 4 profile.

This backup helps us keep a record of the currently installed EasyApache 4 packages and allows us to reuse the same configuration if required later.

Prerequisites

Before taking the EasyApache 4 profile backup, ensure the following:

  1. Root SSH access to the cPanel/WHM server.
  2. EasyApache 4 must be installed and active on the server.
  3. Sufficient permission to execute cPanel system commands.
  4. Basic knowledge of Linux CLI commands.
  5. Enough disk space to store the exported JSON profile file.

Steps to Take EasyApache 4 Backup from CLI

Step 1: Login to the Server

Login to the server using SSH as the root user.

ssh root@server-ip

Step 2: View the Current EasyApache 4 Custom Profile

Run the below command to check if any custom EasyApache 4 profile already exists on the server.

cat /etc/cpanel/ea4/profiles/custom/*.json 2>/dev/null || \
ls /etc/cpanel/ea4/profiles/

This command will display the existing custom profile JSON file if available. If no custom profile is found, it will list the available EasyApache 4 profile directory.

Step 3: Export the Current Installed EasyApache 4 Profile

Run the below command to export the currently installed EasyApache 4 configuration into a JSON backup file.

/usr/local/bin/ea_current_to_profile \
  --output=/tmp/ea4_profile_$(hostname)_$(date +%Y%m%d).json

This will create a backup file in the /tmp directory with the server hostname and current date.

Example output file:

/tmp/ea4_profile_servername_20260622.json

Step 4: Verify the Exported Backup File

After exporting the profile, verify the generated JSON file using the below command.

cat /tmp/ea4_profile_$(hostname)_$(date +%Y%m%d).json

Confirm that the file contains the EasyApache 4 package details in JSON format.

Step 5: Recommended — Copy the Backup to a Permanent Location

Since /tmp is a temporary directory, copy the backup file to a safer location.

mkdir -p /root/ea4-profile-backup

cp /tmp/ea4_profile_$(hostname)_$(date +%Y%m%d).json /root/ea4-profile-backup/

Step 6: Confirm the Backup File

Run the below command to confirm that the backup file is available.

ls -lh /root/ea4-profile-backup/

Verification

To verify the backup, check the following:

  1. The JSON file was created successfully.
  2. The file size is not zero.
  3. The file contains EasyApache 4 package information.
  4. The backup file is stored in a safe location.

Example:

ls -lh /root/ea4-profile-backup/
cat /root/ea4-profile-backup/ea4_profile_$(hostname)_$(date +%Y%m%d).json

Conclusion

The current EasyApache 4 configuration has been successfully exported and backed up using the CLI. This backup can be used as a reference before making any EasyApache 4 changes, PHP version updates, or package modifications. It is recommended to keep a copy of this backup in a safe location or external backup storage for future rollback or audit purposes.

LEAVE A COMMENT