To install ImageMagick on Cpanel Server, in root SSH, run
yum install ImageMagick ImageMagick-devel -y
To install PHP Module, login to WHM as user root.
WHM > Software > Module Installers

Click on Manage link for PHP Pecl.

Select the PHP version from drop down list on which you need ImageMagick PHP module installed.
Search for “imagick”.

Click on install link to install imagick PHP module.
After installation, you can verify imagick module work with command
[root@server ~]# php -m| grep imag
imagick
[root@server ~]#
phpinfo will show

To install with command line, use
/opt/cpanel/ea-php74/root/usr/bin/pecl uninstall imagick
/opt/cpanel/ea-php74/root/usr/bin/pecl install imagick
After installing, restart apache with
systemctl restart httpd
See Cpanel Server