Building Packages

For EasyApache 4!

Like a ninja

Get started building packages for cPanel & WHM’s EasyApache 4!



At cPanel we use Open Build Service (OBS) for numerous things in the EA4 stack, and we recommend using it if you plan to build custom EasyApache 4 RPMs.

Open Build Service is used for numerous things in the EA4 stack, it is usable as both a software code repository and build system. It works via both the cli utility osc and via the Open Build Service website. For most actions you will need to use both the utility and the website.

Getting started with OBS

You’ll need to start with the following:

  1. An account on SuSE’s excellent Open Build Service
  2. The ‘osc’ and ‘build’ packages from the OBS repositories
    • From your distributions package manager
    • ubuntu/debian: sudo apt-get install osc build
    • Other distros, see the OpenSuSE Tools Repository after check your package manager for the ‘osc’ package.
  3. run the osc command and input your account information
    • NOTE: this will create a file at ~/.oscrc with cleartext credentials, treat accordingly.

OpenSuse Tips and Tricks contains a lot of useful information on using OBS and osc.

OBS is structured into User -> Project(s) -> Package(s). For better organization, it’s recommended to create a ‘home:$user:EA4’ subproject as a ‘base of operations’, and then create your specific project and packages inside that subproject. This will look something like

home:Jperkster:EA4:Suhosin ea-php54-php-suhosin

OBS Project Repositories Setup

When setting up OBS repositories, ensure that you are tracking off of the ‘isv:cpanel:EA4’ project, and the ‘CentOS_CentOS-6_standard’ and ‘CentOS_CentOS-7_standard’ builds.

  1. Head to your projects ‘Repositories’ tab
  2. Click ‘Add respositories’
  3. Scroll down and click ‘Expert Mode’ at the bottom
  4. Enter ‘isv:cpanel:EA4’ as the Project.
    • This means that you are wanting to build this package off of the EA4 Production RPMs
  5. Select the CentOS version you are building for
    • If you want to build both 6 and 7, you will need to repeat this process again for the other version
  6. De-select all architectures except for i586 and x86_64
    • Note, cPanel does not build packages for 32bit CentOS 7
  7. Hit ‘Add Repository’

OBS Project Setup

cPanel uses the below SPEC file versioning, which allows OBS to properly set the release, build and commit versions. Ensure your spec file has:

%define release_prefix 1

Release: %{release_prefix}%{?dist}.cpanel

Also ensure that your OBS project -> Project Config has the following setup:

Prefer: sendmail

Prefer: ea-apache24-mod_mpm_event

Prefer: ea-apache24-mod_cgid

Release: %%{?release_prefix}.<CI_CNT>.<B_CNT>

If you are creating a new package as a patched/modified version of an upstream package, it’s often recommended to give the package a new or alternate name, and reference upstream_module in the spec file for clarity.


Basic OBS Usage

The osc utility allows you to interact with source files using an SVN-like interface, make local builds and numerous other things used in lifecycle management. run osc help to see a full list of all the command available.

Some basic common commands are:

  • osc ls isv:cpanel:EA4 - See all packages hosted to cPanel’s EasyApache4 repository
  • osc branch isv:cpanel:EA4 scl-php71 home:$MY_USER:$BRANCH_NAME branch the scl-php71 package into your own branch
  • osc co home:$MY_USER:$BRANCH_NAME Checkout a branch to a local working directory
  • osc add|remove . add all files and track all removals from a directory (useful before a commit)
  • osc ci -m "my commit" commit your changes
  • osc build build a local copy of your package


Patching an RPM is a reletively easy process that involves a few small updates to the SPEC (specification) file and adding the patch file to the repository.

  1. Branch that package you are wanting to patch using osc br isv:cpanel:EA4 some_package home:$MY_USER:$MY_PATCHED and then cd into the directory with the content in it.
  2. Open the .spec file in your editor of choice
  3. Update the following fields:
    • Update the number next to release_prefix by one. This is used to indicate the number of changes to a specific version of software
    • Add a Patch###: line with a unique patch file and number after the other Patch directives
    • example: Patch100: foo.patch
    • in the %prep section, after the other %patch directives add your patch directive
    • example: %patch100 -p1 -b foo
    • Add a new changelog entry in the %changelog section describing your change. See other entries for example format.
  4. Copy the .patch file into the checked out directory and add it to the repository using osc add $filename
  5. Test your change locally using osc build
  6. Commit your changes using osc ci -m "some message"


Create your package branch

It is easiest to start this by branching a package from isv:cpanel:EA4 and immediately removing it as this will set up the build dependencies for you.

See osc help $command for more information on each of these commands (f.ex. osc help mkpac)

osc branch isv:cpanel:EA4 scl-php71 home:$MY_USER:new_package

osc co home:geckmatic:new_package

cd home:geckmatic:new_package

osc delete scl-php71

osc mkpac ea-php-php56-yaml

osc ci -m "delete this package and add the new package"

Add your sources and packages

Now you can change directory into the ea-php56-php-yaml and add your sources and spec file.

For creating new packages we have provided a repository containing template specifications and example implementation on GitHub. Editing the template file from this repo and filling in items between the [% %] tags should result in a building RPM. To see an example of this already completed, look at the differences between the .template file and the .spec file. For basic information on how build RPMs, please see Maximum RPM

  1. Place the .spec file in the package directory (home:$MY_USER:newpackage/ea-php-php56-yaml)
  2. Copy all the sources into the package directory
    • if you just want to build the example given here, just copy the contents of the SOURCES/ from the example directory of your choice into the package directory
  3. run osc addremove . on the package directory
  4. osc build to test your change locally
  5. osc ci -m "First commit" to commit to OBS

View the Project page on Open Build Server to monitor build status or run osc results.

Visit the repository on or run osc getbinaries.


Have you built EA4 packages yet? Want to contribute?

Contributor Apache Modules

Contributor PHP Modules

Interested in getting your packages added here? Email perk[ @ ]


Need Help?

Official cPanel support may not be able to assist with building RPMs or any related issues.

You should be able to get live, but unofficial help at #cpanel on Freenode, depending on the time/day. Look out for Perk, escherlat, or geck

If you have questions on individual packages / code, open an issue on the appropriate GitHub repository.


Jacob Perkins

Matt Dees