ea4

EasyApache 4 Create a Profile


Last modified: July 11, 2022

Overview

This document discusses how to create an EasyApache 4 profile.

Note:

The system strips the prefix from the package name when it displays 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 may wish to create your own to further customize your server. EasyApache 4 profiles use the JSON file format.

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

  • Convert your existing configuration to a profile.
  • Click Save as profile during the EasyApache 4 configuration process.
  • Download and customize one of the cPanel-provided profiles.
  • Create your own by hand and either upload it or create it directly on the server.

Convert to profile

Note:

This option only exists in cPanel & WHM version 66 or higher.

You can convert an existing configuration into a profile. This allows you to easily configure your profile in the interface and then save it.

To convert your existing configuration into a custom profile, perform the following steps:

  1. Click Convert to profile in the Currently Installed Packages section of WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4).

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

  3. Enter the filename of your 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 NUL character.

  4. Enter a description for your profile, if desired, in the Description text box. The interface will display this description.

  5. Enter any tags that you want to use, separated by commas, in the Tags text box.

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

  7. Click Convert.

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.

Save as profile

Note:

This option only exists in cPanel & WHM version 66 or higher.

You can save a new profile at any point during the EasyApache 4 configuration process. This allows you to easily configure your profile in the interface and then save it.

To save your configuration as a profile, perform the following steps:

  1. Click Save as profile at any point during the EasyApache 4 configuration process.

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

  3. Enter the filename of your 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 NUL character.

  4. Enter a description for your profile, if desired, in the Description text box. The interface will display this description.

  5. Enter any tags that you want to use, separated by commas, in the Tags text box.

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

  7. Click Save.

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

Upload a file

Note:
  • This option only exists in cPanel & WHM version 64 or higher.

  • 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). If you download an existing profile, it will already exist in JSON format.

You can create a profile and then upload it 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 selected 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

Remember:

You can upload a file from the EasyApache 4 interface on a system that runs cPanel & WHM version 64 or higher.

  1. Navigate to the /etc/cpanel/ea4/profiles/custom directory.

    Important:

    You must save your custom profiles in the /etc/cpanel/ea4/profiles/custom/ directory. The system uniquely uses the /etc/cpanel/ea4/profiles/cpanel and /etc/cpanel/ea4/profiles/vendor directories. Files in these directories may work initially if you use them, but may disappear or not function as you might expect.

  2. With a text editor, create a JSON file with your preferred settings. For more information about file format, read the JSON section.

  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:

    /usr/local/cpanel/3rdparty/perl/522/bin/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, pretty).

    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.

  4. 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

You can preconfigure your EasyApache 4 profile before you install cPanel & WHM version 58 or higher on your server.

To preconfigure your profile, 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