What is the correct way to install imagick on RHEL?

Hello Nextcloud developers and users,
 
My question is as follows:
What is the correct way to install Imagick on RHEL?
 
This is what I did:

# Enable the EPEL repository  .
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  
# Enable the Remi repository.
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

# Install the imagick and sodium packages.
sudo dnf install php74-php-pecl-imagick php74-php-sodium

# Restart Apache
sudo systemctl restart httpd

 
After installing the above packages I still get the warning that both packages aren’t installed. What else do I have to do (a restart of the server also didn’t help)?
 
When I look in the PHP modules directory (/usr/lib64/php/modules) both modules are absent.
 
When I run php -m both modules are not loaded.

I found out the following does the trick:

# Enable the EPEL repository  .
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  
# Enable the Remi repository.
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

# Install and enable the PHP REMI 7.4 stream
sudo dnf module install php:remi-7.4

# Install the PHP module imagick
sudo dnf install php-pecl-imagick

Packages like php74-php-pecl-imagick do not work.

No. 3rd party repositories (remi) are a major big “no no” on a production server.

This is the correct way;

dnf config-manager --set-enabled powertools
dnf install php-devel php-pear ImageMagick-devel
pecl install imagick

Then just follow the instruction at the end of the output about adding the extension to the php config and you’re done.

1 Like

@Larry_Boyd, sorry but I never responded to your comment.

Thanks for the alternative way of installing Imagick on RHEL!

I will keep it the way it is (with the remi repository) but it’s good to know that’s possible to install Imagick without any third-party repository!