How to manage Apache with Easyapache 4 on the command line?

Before an introduction of the easyapache 4, in easyapache 3 cpanel used to offer the easyapache tool to upgrade Apache or PHP version or to install php modules for your server. The script used  for this purpose was /scripts/easyapache which would bring up an interactive menu to choose latest Apache or PHP version or the php module.

With easyapache 4, we can use yum to install, remove or upgrade all php and the apache modules. It since uses rpm it’s way faster than easyapache 3 rebuild process which used to take 30-45 minutes to compile. In this article, we will learn how to install easyapache 4 profile from the command line? How to install/remove apache/php related RPMs individually using yum? How to update apache -related RPM’s using yum?

  • How to install easyapache 4 profile from the command line?

As we already know profiles are a collection of setting that we can install with one click. We already know how to manage profiles from webhost manager however its even much more easier to manage profiles from the command line since profiles are manged with text editor e.g.  vi and store in /etc/cpanel/ea4/profiles. These profiles are useful when you are migrating server to another server or want identical setting across all your servers. We can use /usr/local/bin/ea_install_profile to provision an entire profile. To do so all we need to do is to specify profile file path. Let’s take an example. We have following default cPanel profiles available in our server.

[root@server cpanel]# ls
allphp.json allphp-opcache.json default.json mpm_itk.json nophp.json worker.json
[root@server cpanel]#

Suppose we would like to provision default profile. Here we go.

#/usr/local/bin/ea_install_profile --install /etc/cpanel/ea4/profiles/cpanel/default.json

Sample Output

Loading profile …
The system is resolving package dependencies and conflicts. This may take some time …
 … done!
Installing …
info [ea_install_profile] ---> Package ea-php56-php.x86_64 0:5.6.30-1.1.3.cpanel will be erased
info [ea_install_profile] --> Finished Dependency Resolution
info [ea_install_profile] ================================================================================
info [ea_install_profile] Package Arch Version Repository Size
info [ea_install_profile] ================================================================================
info [ea_install_profile] Removing:
info [ea_install_profile] ea-php56-php x86_64 5.6.30-1.1.3.cpanel @EA4 4.4 M
info [ea_install_profile] Transaction Summary
info [ea_install_profile] ================================================================================
info [ea_install_profile] Remove 1 Package(s)
info [ea_install_profile] Installed size: 4.4 M
info [ea_install_profile] Downloading Packages:
info [ea_install_profile] Running rpm_check_debug
info [ea_install_profile] Running Transaction Test
info [ea_install_profile] Transaction Test Succeeded
info [ea_install_profile] Running Transaction
 Erasing : ea-php56-php-5.6.30-1.1.3.cpanel.x86_64 1/1Purging all relevant cached command results
info [ea_install_profile] Removing: /root/.cpanel/datastore/_usr_sbin_httpd_-l
info [ea_install_profile] Removing: /root/.cpanel/datastore/_usr_sbin_httpd_-V
info [ea_install_profile] Removing: /root/.cpanel/datastore/_usr_sbin_httpd_-v
info [ea_install_profile] Rebuilding global cache
info [ea_install_profile] Building global cache for cpanel...Done
info [ea_install_profile] Built /etc/apache2/conf/httpd.conf OK
info [ea_install_profile] Nothing to do under ea4 (this script has been deprecated under ea4).
info [ea_install_profile] Fix mailman RPM directories
info [ea_install_profile] Fix mailing list perms
info [ea_install_profile] Aligning modsec config to Whostmgr
info [ea_install_profile] - Whostmgr version 11.62.0.15
info [ea_install_profile] - Whostmgr supports conf.d/modsec location
info [ea_install_profile] - No change necessary
info [ea_install_profile] Waiting for “httpd” to restart gracefully …waiting for “httpd” to initialize ………finished.
info [ea_install_profile] Service Status
info [ea_install_profile] httpd restarted successfully.
info [ea_install_profile] Setting /home permissions to 0711......Done
info [ea_install_profile] Setting permissions for........Done
info [ea_install_profile] Service Status
info [ea_install_profile] apache_php_fpm restarted successfully.
info [ea_install_profile]
 Verifying : ea-php56-php-5.6.30-1.1.3.cpanel.x86_64 1/1
info [ea_install_profile] Removed:
info [ea_install_profile] ea-php56-php.x86_64 0:5.6.30-1.1.3.cpanel
info [ea_install_profile] Finished Transaction
info [ea_install_profile] Leaving Shell

If you want to provision same profiles you can copy profiles file to the destination server and provision it there. If you would like to make changes in the file you can edit it using your favourite text editor.

  • How to install/remove/search apache/php related RPMs individually using yum?

The Yellowdog Updater, Modified (yum) is an excellent tool for maintaining rpm based operating systems such as CentOS. it resolves dependency issues automatically so you don’t need to install those dependencies manually.  With easyapache 4, we can use yum to manage PHP & Apache.  Let’s go through various common yum options which will be useful for us to manage php & apache.

  1. yum list

Before we can install or update any packages, we must know whether it’s available. We can use yum list command to list all available packages. As you have noticed all easyapache 4 packages start with ea- hence we can use ea-* expression to list all packages. Lets try.

[root@server ~]# yum list ea-*

Sample Output

[root@server ~]# yum list ea-*
Loaded plugins: fastestmirror, security, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 70.87.220.252
 * base: mirror.n5tech.com
 * extras: centos.host-engine.com
 * updates: mirror.rackspace.com
EA4 | 2.9 kB 00:00 ...
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
Installed Packages
ea-apache24.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-config.noarch 1.0-84.84.1.cpanel @EA4
ea-apache24-config-runtime.noarch 1.0-84.84.1.cpanel @EA4
ea-apache24-mod_bwlimited.x86_64 1.4-46.48.6.cpanel @EA4
ea-apache24-mod_cgi.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_deflate.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_expires.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_headers.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_mpm_prefork.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_proxy.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_proxy_fcgi.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_proxy_http.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_ruid2.x86_64 0.9.8-13.13.10.cpanel @EA4
ea-apache24-mod_security2.x86_64 2.9.0-13.14.6.cpanel @EA4
ea-apache24-mod_ssl.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-mod_unique_id.x86_64 2.4.25-4.4.1.cpanel @EA4
ea-apache24-tools.x86_64 2.4.25-4.4.1.cpanel @EA4

If we want to find available individual package, we can use following command.

[root@server ~]# yum list ea-*ioncube

Sample Output

[root@server ~]# yum list ea-*ioncube
Loaded plugins: fastestmirror, security, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 70.87.220.252
 * base: mirror.n5tech.com
 * extras: centos.pymesolutionsweb.com
 * updates: mirror.rackspace.com
Available Packages
ea-php54-php-ioncube.x86_64 4.7.5-9.9.7.cpanel EA4
ea-php55-php-ioncube.x86_64 4.7.5-9.9.7.cpanel EA4
ea-php56-php-ioncube.x86_64 4.7.5-9.9.7.cpanel EA4
[root@server ~]#

You can see above output shows all available ioncube packages. Now, let’s install ioncube for php 5.4.

[root@server ~]# yum install ea-php54-php-ioncube.x86_64
Loaded plugins: fastestmirror, rhnplugin, security, universal-hooks
Setting up Install Process
Loading mirror speeds from cached hostfile
 * EA4: 70.87.220.252
 * cloudlinux-x86_64-server-6: xmlrpc.cln.cloudlinux.com
Resolving Dependencies
--> Running transaction check
---> Package ea-php54-php-ioncube.x86_64 1:4.7.5-7.el6.cloudlinux will be installed
--> Processing Dependency: ea-php54-php(zend-abi) = 20100525-64 for package: 1:ea-php54-php-ioncube-4.7.5-7.el6.cloudlinux.x86_64
--> Processing Dependency: ea-php54-php(api) = 20100412-64 for package: 1:ea-php54-php-ioncube-4.7.5-7.el6.cloudlinux.x86_64
--> Processing Dependency: ea-php54-runtime for package: 1:ea-php54-php-ioncube-4.7.5-7.el6.cloudlinux.x86_64
--> Running transaction check
---> Package ea-php54-php-common.x86_64 1:5.4.45-28.el6.cloudlinux.2 will be installed
---> Package ea-php54-runtime.x86_64 1:5.4.45-15.el6.cloudlinux will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================
 Package Arch Version Repository Size
==========================================================================
Installing:
 ea-php54-php-ioncube x86_64 1:4.7.5-7.el6.cloudlinux cl-ea4 315 k
Installing for dependencies:
 ea-php54-php-common x86_64 1:5.4.45-28.el6.cloudlinux.2 cl-ea4 388 k
 ea-php54-runtime x86_64 1:5.4.45-15.el6.cloudlinux cl-ea4

Installed:
 ea-php54-php-ioncube.x86_64 1:4.7.5-7.el6.cloudlinux

Dependency Installed:
 ea-php54-php-common.x86_64 1:5.4.45-28.el6.cloudlinux.2 ea-php54-runtime.x86_64 1:5.4.45-15.el6.cloudlinux

Complete!

Similarly, we can search any php package using yum search and then install it using yum install.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge