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:
- An account on SuSE’s excellent Open Build Service
- 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.
- run the
osccommand 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
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.
- Head to your projects ‘Repositories’ tab
- Click ‘Add respositories’
- Scroll down and click ‘Expert Mode’ at the bottom
- Enter ‘isv:cpanel:EA4’ as the Project.
- This means that you are wanting to build this package off of the EA4 Production RPMs
- 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
- De-select all architectures except for i586 and x86_64
- Note, cPanel does not build packages for 32bit CentOS 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
Also ensure that your OBS project -> Project Config has the following setup:
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_NAMEbranch the scl-php71 package into your own branch
osc co home:$MY_USER:$BRANCH_NAMECheckout 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 buildbuild 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.
- Branch that package you are wanting to patch using
osc br isv:cpanel:EA4 some_package home:$MY_USER:$MY_PATCHEDand then cd into the directory with the content in it.
- Open the .spec file in your editor of choice
- Update the following fields:
- Update the number next to
release_prefixby 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
- in the %prep section, after the other %patch directives add your patch directive
%patch100 -p1 -b foo
- Add a new changelog entry in the %changelog section describing your change. See other entries for example format.
- Update the number next to
- Copy the .patch file into the checked out directory and add it to the repository using
osc add $filename
- Test your change locally using
- 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.
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
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
- Place the .spec file in the package directory (
- 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
osc addremove .on the package directory
osc buildto test your change locally
osc ci -m "First commit"to commit to OBS
View the Project page on Open Build Server to monitor build status or run
Visit the repository on download.opensuse.org or run
Have you built EA4 packages yet? Want to contribute?
Contributor Apache Modules
- ea-apache24-mod_wsgi Experimental wsgi package for EasyApache 4.
- ea-apache24-mod_xsendfile mod_xsendfile Apache module for EA4
- ea-apache24-mod_qos mod_qos Apache 2.4 module for EA4. Currently only works on CentOS 6.
Contributor PHP Modules
- ea-php##-php-htscanner-enhanced Experimental htscanner-enhanced packages
Interested in getting your packages added here? Email perk[ @ ]cpanel.net
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.