ea4

EasyApache 4 Create a Profile

Last modified: September 11, 2024


Overview

This document discusses how to create an EasyApache 4 profile. An EasyApache 4 profile is a JavaScript Object Notation (JSON) file that acts as a template to manage which EasyApache 4 packages the system installs and uninstalls. When you provision a profile, the system will install that profile’s packages and uninstall other packages.

You may only provision one profile at a time. However, to customize your EasyApache 4 profile’s configuration, you can also install and uninstall packages after provisioning it.

Note:

The system strips the ea- prefix from package names when it displays them in WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).

About EasyApache 4 profiles

While EasyApache 4 provides a number of profiles that will suit most needs, you can also create one.

To create a profile, use one of the following methods:

  • Convert your existing configuration to a JSON file.
  • Click Save as profile during the EasyApache 4 configuration process.
  • Download and customize one of the cPanel-provided profiles.
  • Create your own JSON-formatted profile. You may do this directly on the server or upload the file from another location.

Save a new profile

You can save a new profile at any point during the EasyApache 4 configuration process. You can also convert an existing configuration to a new profile.

To save a new profile, perform the following steps:

  1. If you are currently in the configuration process, click Save as profile at any point. After the configuration process, click Convert to profile in the EasyApache 4 interface’s (WHM » Home » Software » EasyApache 4) Currently Installed Packages section to save your current configuration as a new profile.

  2. Enter the name of your profile in the Name text box. The EasyApache 4 interface will display this name.

  3. Enter a descriptive filename for the profile in the Filename text box. Do not include an extension.

    Note:
    You cannot enter a file name of . or .., or a file name that contains the / or NULL character. If you have not created a JSON file and do not have a file name, enter a name that describes the profile instead.

  4. Optionally, enter a description for your profile in the Description text box. The interface will display this description.

  5. Optionally, enter comma-separated tags in the Tags text box.

  6. If you want the profile you are converting to overwrite an existing profile of the same name, select the Overwrite an existing profile checkbox.

  7. Click Save to save a profile during the configuration process, or Convert to save a profile after the configuration process.

Your new profile will save to the /etc/cpanel/ea4/profiles/custom directory.

Note:

You can also use the scripts in the ea-cpanel-tools package, but this does not provide as many options.

Upload a file

Note:

We strongly recommend that you download a current EasyApache 4 profile and modify it to meet your needs. You can download an existing profile by clicking on Download next to your desired profile in WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4). Existing profiles download in JSON format.

To create a profile, add your desired EasyApache 4 configuration in JSON format, then upload the file in the EasyApache 4 interface (WHM » Home » Software » EasyApache 4). This ensures that your profile saves to the proper location and that a file does not already exist with the profile’s file name.

All custom profiles save to the /etc/cpanel/ea4/profiles/custom directory.

Example profile

Your EasyApache 4 profile file must use the JSON file format, and resemble the following example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
   "version":"1.2",
   "name":"SuperHost Profile",
   "tags":[
      "Apache 2.4",
      "PHP 7.0",
      "tomorrow comes knocking",
      "..."
   ],
   "desc":"This profile will allow you to have super high density on your system",
   "pkgs":[
      "ea-mod_xyz",
      "ea-php70",
      "ea-php71",
      "ea-your_frog",
      "..."
   ]
}

Your profile must contain the following keys:

Key Type Description Example
version integer The profile’s version. 1.2
name string The profile name that WHM displays. SuperHost Profile
tags array of strings A list of tags that WHM displays. Apache 2.4, PHP 7.0
desc string A description of the profile that WHM displays. This profile will allow you to have super high density on your system
pkgs array of strings The packages in the profile. ea-php70,ea-php71

Create an EA4 profile directly on the server

To create an EA4 profile directly on the server, connect via SSH as the root user and perform the following steps:

  1. Navigate to the /etc/cpanel/ea4/profiles/custom directory. You must save your custom profiles here.

  2. With a text editor, create a JSON file with your preferred settings.

  3. After you create the JSON file and save your changes, check for proper syntax with the following command, where custom_profile_name.json represents your JSON file:

    json_pp -t null < custom_profile_name.json
    Note:

    The tool accepts the following options:

    • The -f flag passes the file’s input format. For example, json.
    • The -t flag passes the file’s output format. For example, dumper.
    • The -json_opt flag passes format options in which to print information to the JSON:PP module (for example, use pretty to tell the command line to print the JSON file with reader-friendly spacing). For more information, read cpan.org’s JSON::PP command utility documentation.
    If the command does not return output, your JSON file’s syntax is correct.

When you’re done, navigate to WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4) and verify that your profile appears.

Create a default profile for a fresh install

To preconfigure your EasyApache 4 profile before you install cPanel & WHM, create the /etc/cpanel_initial_install_ea4_profile.json file.

The system will install this profile and then copy it to the /etc/cpanel/ea4/profiles/custom/ directory when the system completes the installation.

Warning:

You must create this profile as a valid JSON file and a valid EasyApache 4 profile. If your JSON file contains errors, no data, or the installation fails, the system installs the cPanel Default EasyApache 4 profile.

Additional Documentation