How to Install Redis Inside an EasyApache 4 Container in cPanel

Posted on by Mohammed Noufal
Reading Time: 5 minutes

In this article, you can understand what EasyApache4 and Redis are, how to set up an EasyApache 4 container in cPanel, and how to install Redis inside an EasyApache 4 container in cPanel.

What is EasyApache 4?

EasyApache 4 (EA4) is a built-in tool with cPanel which helps efficiently manage, configure, and deploy web servers, PHP, and other components using a graphical user interface (GUI). EasyApache 4 is also available through the command line. However, most users prefer using the graphical user interface.

EasyApache 4 allows you to install new Apache and PHP modules/extensions and other server-side applications like the Ruby programming language, NodeJS, Apache Tomcat, etc. 

What is Redis?

Redis (REmote DIctionary Server) is an open-source, in-memory data structure store, NoSQL advanced key-value data store used as a message broker and quick-response database. Redis is most typically used as an application cache because it maintains its data in memory. It is also known as a data structure server because its keys include strings, hashes, lists, sets, sorted sets, bitmaps, and hyperlog logs. Redis stores data in memory compared to on a disc or solid-state drive, and it offers outstanding speed, reliability, performance, and rapid read and write operations.

Setting Up an EasyApache 4 Container in cPanel

EasyApache 4 allows you to run applications in containers. cPanel supports only servers running AlmaLinux OS 8, Rocky Linux 8, or Ubuntu 20.04 for containers. In this article, I’m using AlmaLinnux 8. cPanel containers are managed via Podman. Instead of running as the root user, Podman enables your apps to execute in the user space.

To set up an EasyApache 4 container in cPanel, follow the steps below.

Step 1:

You must first install the podman installation repository package to set up EasyApache 4 containers. 

Once you have installed the Podman installation repository, you can install the ea-podman and ea-tomcat100 packages. These packages set up the system for containers and install cPanel /usr/local/cpanel/scripts/ea-podman script to manage them.

To install the podman installation repository and ea-podman packages on AlmaLinux or Rocky Linux 8, you can run the following commands as the root user.

dnf install -y ea-podman-repo
dnf install -y ea-podman
dnf install -y ea-tomcat100

Here is the output for each command.

[root@noufal-almalinux-cPanel ~]# dnf install -y ea-podman-repo
Last metadata expiration check: 0:03:01 ago on Sat 18 Mar 2023 04:15:59 AM UTC.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                     Architecture                        Version                                          Repository                        Size
=========================================================================================================================================================================
Installing:
 ea-podman-repo                              x86_64                              1.0-5.7.3.cpanel                                 EA4                               11 k
[root@noufal-almalinux-cPanel ~]# dnf install -y ea-podman
Last metadata expiration check: 0:00:01 ago on Sat 18 Mar 2023 04:21:54 AM UTC.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                                  Architecture          Version                                                  Repository                 Size
=========================================================================================================================================================================
Installing:
 ea-podman                                                x86_64                1.0-11.17.2.cpanel                                       EA4                        31 k
[root@noufal-almalinux-cPanel ~]# dnf install -y ea-tomcat100
Last metadata expiration check: 0:00:38 ago on Sat 18 Mar 2023 04:24:25 AM UTC.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                            Architecture                    Version                                           Repository                    Size
=========================================================================================================================================================================
Installing:
 ea-tomcat100                                       x86_64                          10.0.20-1.2.13.cpanel                             EA4                           39 k

If you use Ubuntu, you can use the following commands to install the Podman installation repository and ea-podman packages.

apt install -y ea-podman-repo
apt update
apt install -y ea-podman
apt install -y ea-tomcat100

Step 2:

You must first install the EasyApache 4 package on the command line before using an EA4 container-based package for your containers. Please remember that to use an application in your server's containers, you must first install either a cPanel-provided container-based package or an image from another source, such as Dockerhub. This step is only available after configuring your server's containers.

You can use the following command to set up your application using an EA4 container-based package. The package portion is the container-based EA4 package's name.

/scripts/ea-podman install package

If you use the non-cPanel-provided image to set up your application, use the following command. The application portion is the application’s name, and the image portion is the image obtained from a website such as Dockerhub.

/scripts/ea-podman install application [options] image

Step 3:

Once you install a container package, the server will create the ~/ea-podman.d/application-name directory in the user's home directory. You can find the container's information, files, and other data under the directory.  You can access these directories without logging in to the container instance to add and delete files and make other changes. One of the following commands can help you find the names of your containers.

/usr/local/cpanel/scripts/ea-podman registered
/usr/local/cpanel/scripts/ea-podman running
Note:
These commands should be run as a cPanel user. These containers are meant to allow users to use services and applications that are not shared with other users.

Here is the output.

# /usr/local/cpanel/scripts/ea-podman registered
{
   "ea-redis62.root.01" : {
      "container_name" : "ea-redis62.root.01",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.02" : {
      "container_name" : "ea-redis62.root.02",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.03" : {
      "container_name" : "ea-redis62.root.03",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.04" : {
      "container_name" : "ea-redis62.root.04",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.05" : {
      "container_name" : "ea-redis62.root.05",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.06" : {
      "container_name" : "ea-redis62.root.06",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   }
}

If you are logged into the container’s shell interface, you can also use the following command to run the bash command.

/usr/local/cpanel/scripts/ea-podman bash

Here is the output.

# /usr/local/cpanel/scripts/ea-podman bash ea-redis62.root.06 
root@ea-redis62:/data# 
root@ea-redis62:/data#

To view the available EA4 container-based packages, execute the following command.

/usr/local/cpanel/scripts/ea-podman available

Here is the output.

# /usr/local/cpanel/scripts/ea-podman available
{
   "ea-memcached16" : {
      "installed_locally" : 0,
      "url" : "https://github.com/CpanelInc/ea-memcached16/blob/master/SOURCES/README.md"
   },
   "ea-redis62" : {
      "installed_locally" : 1,
      "url" : "https://github.com/CpanelInc/ea-redis62/blob/master/SOURCES/README.md"
   },
   "ea-tomcat100" : {
      "installed_locally" : 1,
      "url" : "https://github.com/CpanelInc/ea-tomcat100/blob/master/SOURCES/README.md"
   }
}

Install Redis Inside an EasyApache 4 Container in cPanel

You can install Redis within an EasyApache 4 container in cPanel once you've configured EasyApache 4 containers on your server. Installing the ea-redis62 package will add Redis to your system after you have configured containers on it.

You can install Redis to run within a container by following these steps.

Step 1:

SSH into the cPanel user account. You can use the following methods to access the account via SSH:

1. The command prompt.

2. Terminal interface in WHM (Login to WHM > Home > Server Configuration > Terminal).

3. Terminal interface in cPanel (Login to cPanel > Home > Advanced > Terminal).

Step 2:

You can execute the commands below to install Redis. Run the first command as root.

dnf install -y ea-redis62

Here is the output.

[root@noufal-almalinux-cPanel ~]# dnf install -y ea-redis62
Last metadata expiration check: 0:17:31 ago on Sat 18 Mar 2023 04:24:25 AM UTC.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                  Architecture                         Version                                           Repository                         Size
=========================================================================================================================================================================
Installing:
 ea-redis62                               x86_64                               6.2.8-1.1.3.cpanel                                EA4                                40 k

The next command should be run as a cPanel user.

/usr/local/cpanel/scripts/ea-podman install ea-redis62

Here is the output.

# /usr/local/cpanel/scripts/ea-podman install ea-redis62
Adding a ea-redis62 instance for "user" ...
 ... done!
6db51d65fef78f8b33d350588631d2f9946227b1b6cfb04dc2bdfd0ad127e261
Created symlink /root/.config/systemd/user/default.target.wants/container-ea-redis62.root.06.service → /root/.config/systemd/user/container-ea-redis62.root.06.service.

Step 3:

To get the container's name, execute the following command. You can use this name for any future activities.

/usr/local/cpanel/scripts/ea-podman containers

Here is the output.

[root@noufal-almalinux-cPanel ~]# /usr/local/cpanel/scripts/ea-podman containers
{
   "ea-redis62.root.01" : {
      "container_name" : "ea-redis62.root.01",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.02" : {
      "container_name" : "ea-redis62.root.02",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.03" : {
      "container_name" : "ea-redis62.root.03",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.04" : {
      "container_name" : "ea-redis62.root.04",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.05" : {
      "container_name" : "ea-redis62.root.05",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   },
   "ea-redis62.root.06" : {
      "container_name" : "ea-redis62.root.06",
      "image" : "redis:6.2.8",
      "pkg" : "ea-redis62",
      "pkg_version" : "6.2.8-1",
      "user" : "root"
   }
}

Final Thoughts

EasyApache4 is a built-in utility in cPanel that enables you to upgrade and install Apache, PHP, and other web server components. Redis is an open-source (BSD licensed) in-memory data structure store used as a cache, database, streaming engine, and message broker. The information in this article will make it simple for you to install Redis inside an EasyApache 4 container in cPanel.

cPanel is available on Liquid Web’s VPS Hosting, Cloud Dedicated Servers, and Dedicated Servers. Choose from AlmaLinux or CentOS 7. Contact the sales team for details.

Avatar for Mohammed Noufal

About the Author: Mohammed Noufal

Mohammed Noufal is a B.Tech graduate with a decade of experience in server administration and web hosting. He is a father to two daughters and finds fulfillment in their growth. In his free time, he enjoys blogging, sharing experiences, and listening to music. With a strong technical background, family commitment, and creative outlets, he represents a well-rounded life journey.

Latest Articles

How to use kill commands in Linux

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article