Installing ImageMagick in CentOS and RedHat

I am a developer and freelancer. These days I am mostly checking out dev ops and sys admin stuff — installing softwares, scaling applications, Docker, Kubernetes.

Recently I got a gig where I was asked to install an open source software called Mosaico. It was basically an Email Template builder.

I thought it would be quite easy to install it, that too it had Docker in it! But the issue that arose was that my client’s server had RedHat Enterprise Linux OS. And Docker CE is not available for RedHat, only paid Docker EE is available. Of course my client wasn’t ready to pay $75 per month for just deploying a normal app on one server and only once using Docker. So, I had to install it manually.

Best part was, I could see the Dockerfile and do the installation, but the Dockerfile was written with CentOS v7 as base image. And also, I had to show a demo in my server before installing it in the client’s server. I installed the application in my CentOS server (it’s quite similar to Red Hat, Idk much though) and had quite some issues. Especially due to a dependency. Can you guess what the dependency was ? Of course you can if you go back and read the title of this article. It was ImageMagick. You should give it a try once — installing it in your PC. It looks quite easy, but I had quite some issues when it didn’t work while I was testing the Mosaico app in the server. ImageMagick is used for resizing the images uploaded or linked to, in the email template. And the input to ImageMagick was a URL of an image instead of a image file. Surprisingly, the HTTP URLs weren’t working. Lots of errors were thrown. This happened when I installed ImageMagick using yum. Actually, it was a breeze to install ImageMagick using yum. But things weren’t good with it. Initially I thought it was some issue with the code and tried checking out the libraries (which interface with ImageMagick) of the application. The backend was based on NodeJs and Js, and I knew it, so I was able to check some stuff, and I also tried some stuff to make the URLs work based on the documentation of the libraries. But nothing worked. I finally thought it’s some issue with the installation of ImageMagick when the code worked on my PC with same code. I was literally going crazy since I was staring at this whole issue for hours thinking it’s possibly a bug in the code — relating to streams. And yeah, I am not good with streams. Anyways, I finally got to know that I had some issue with ImageMagick installation, which was a big surprise. I checked the versions and build related stuff in my PC and CentOS server and found some small differences. So I could say that it’s very possible that these were the things that were bothering me

I tried installing ImageMagick from the source and that didn’t work out well too. Then I tried to install using the RPMs provided in the site and that lead to some dependency errors. Crazy RPMs. I browsed and tried things for hours, to get rid of the dependency errors, and then I finally crawled through ImageMagick forum links which popped in some of my search results and then got rid of the dependency errors and finally got it to work. And then I showed my demo and next day, I was asked to install in their server. I thought it was gonna be a piece of cake. But. No.

ImageMagick was a big issue again. I spent hours. This time, installing using RPMs didn’t work. I had different dependency errors. Wasn’t able to get rid of them. I was breaking my head. And I also tried installing from source using two versions. I finally tried this thing, where I used an extra flag “ — enable-shared” for the ./configure command and this was when I saw that for “http” there are some “coders” available and when I checked out about build configurations and it said using the above flag will enable some shared libraries thing for different libraries — jpeg, png and for coders too. Something of that sort. And I thought I should give it a try and it finally worked out. And I tested the app and finished the Fiverr gig for my client.

That was one of my wild adventures in installing an application. Never thought I would have to do so much. But looks like ImageMagick is one heck of a software. Image processing and stuff. And it supports a lot of formats! I got to see some more flags to pass to the configure command for getting optional support for some formats. I guess I will try it in the future if I have some need for it! :)

Also, you could check a list of some open source softwares that I have seen and used some of them too.

https://docs.google.com/spreadsheets/d/15SfDHQ62TutZbz2nr6OfWl4zmOpkl-ul95lrn7rqe0E/

Of course there are SO MANY in GitHub and in other cloud repositories and the Internet. I just happen to see some of them and I made a list. :)