ImageMagick and Redmine on Ubuntu 12.04 LTS

Notes from the dungeon: ImageMagick and Redmine 2014-03-23

# abbreviated notes on installing redmine gems with imagemagick on ubuntu 12.04
# some of the following notes came from http://www.underworldproject.org/documentation/LibpngDownload.html
# which is an open source library for subsurface exploration like “magma” (yes, I said “magma”)

sudo su
cd tmp
wget http://sourceforge.net/projects/libpng/files/libpng16/1.6.10/libpng-1.6.10.tar.gz
tar zxvf libpng-1.6.10.tar.gz
cd libpng-1.6.10
./configure --prefix=/usr/local
make
make install

# imagemagik still doesn’t install the gem. Found this on StackOverflow but lost the link:

apt-get install graphicsmagick-libmagick-dev-compat

/rant/ – global variables like PATH are needed. Windows has the registry. In this case for ImageMagick to work with PNGs we need to tell it the home globally defined as PNG_DIR. There are several ways to do this in unix and in Ubuntu/debian. I personally don’t like variables stuck in .bashrc if the variables are really user specific. The .bashrc for your profile is NOT global. And skeleton profile files for unix named user profiles are a one-time thing that you can’t update everyone globally later once their profile is created. GLOBAL_VARS in .profile or .bashrc make (specifically you the network admin) your life convenient. But it’s not all about us. .bashrc variables or custom entries in /etc/hosts suck. Magical profile specific path variables break the python rule of “no magic” which means that in every other way they completely suxor. Let’s be honest – it just tempts you to run applications as root, right? None of us have ever seen that. HmmmmHMMMM? /end-rant/

Better option: profile.d applies to all bash prompts as well as any GUI that gets launched so it is currently my preferred method. (note “preferred methods” for me frequently last either 48 hours or 20 years, one or the other. Educate me if you have a better way.)

In this case we need to specify one variable only. But it will expand so let’s do it the right way. We’ll make a .sh file in /etc/profile.d. In practice I usually put these with my project without execute rights and then sym link them into the /etc/profile.d/ folder with “chmod +x myscript.sh” etc…. But to keep it simple – let’s just make our shell script as follows.

cd /etc/profile.d
sudo touch redmine_globals.sh
chmod 755 redmine_globals.sh
sudo nano redmine_globals.sh
# for bash put this in the script file
export PNG_DIR=/usr/local

# exit. or call it manually with “source /etc/profile.d/redmine_globals.sh”

PROGRESS? Let’s check it.

http:// your-domain-name-for-redmine/admin/info

NOoooooOOOOOoooo… Alas I still get a fail when I refresh the redmine page on the availability of ImageMagick. Major FAIL. I read a bunch more as it still didn’t work. Found this command and it executes properly.

sudo apt-get install libmagickwand-dev

#but did it work? Hmmmm.

bundle install --without test development

# still no

# Then tried this:

sudo apt-get install imagemagick libmagickwand-dev ruby-rmagick

# restarted

root@redmine:/var/data/redmine# touch tmp/restart.txt

SUCCESS!!!!!

Screen Shot 2014-03-23 at 3.12.46 PM