Sunday, March 24, 2013

How to install the latest digiKam version on Ubuntu

In DigiKam installation and configuration (in 4 parts) I suggested it is better to install VMware Player and virtual UbuntuLinux then to use the native digiKam Windows installation. The advantage is clear, you get a stable solution, but as usually there is also a disadvantage, you don’t get the latest version. What you get is the version that was packaged for your Ubuntu version.
You can get the latest features of the latest version if you download source code and compile it. Theoretically that is not a problem, all instructions are available. But there are many dependencies which must be solved for successful compilation and more often than not something goes wrong and you get a bunch of errors you have no idea what they mean unless you are a Linux guru. But even if you are not a Linux guru you can succeed, read on …

Here are instructions how to compile digiKam 2.9.0 (when writing this post that was the latest version) on Ubuntu 12.04 LTS Precise Pangolin (that is the version we installed in digiKaminstallation and configuration – part 1). I tested the steps several times so you should succeed without errors. Same instructions should also be valid for latest Ubuntu 12.10 Quantal Quetzal and for newer Debian distributions. If you followed them and succeeded please comment and write what Linux distribution you have. If you followed them and failed comment too, maybe we can solve it together.

You will need to type several commands in the Terminal (WARNING, be carefull about uppercase and lowercase letters, because Linux distinguishes them; of course you can copy/paste commands from this post). If you do not know how to open the Terminal look here.

But if you have followed these instructions to install digiKam, you must first remove it, because you can’t compile the latest version, if you have a previous one on the system. Use following commands in the Terminal:
sudo apt-get remove digikam 
sudo apt-get autoremove 
sudo apt-get autoclean 

It is also a good idea to first update the system, use commands:
sudo apt-get update 
sudo apt-get upgrade 

Now we are ready to start. If you did not mess around the terminal’s working folder should be your home. You should see the prompt “<username>@ubuntu:~$” (mentally replace <username> with your own username). If it is something else close the terminal and open it again or type the command cd /home/<username>. First change working folder to Downloads:
cd Downloads 

Now download digiKam source with command (all in one line):
wget http://downloads.sourceforge.net/project/digikam/digikam/2.9.0/digikam-2.9.0.tar.bz2 

Wait a minute or two, when download is finished you can check that you have a new file with:
ls –l 

You should see the file digikam-2.9.0.tar.bz2 which must be uncompressed with:
tar jxvf digikam-2.9.0.tar.bz2 

Check again with:
ls –l 

Now you should also see a folder digikam-2.9.0. Next commands:
cd digikam-2.9.0 
mkdir build 
cd build 

With them you created a folder where you will compile digiKam and changed working folder to it. Now install the tools required in following steps. Probably some of them are already installed, but apt-get is clever enough to install only what is missing. Use command:
sudo apt-get install gcc cpp make cmake checkinstall 

The sudo is required to elevate privileges, enter your own password when asked for it. For all other questions just select default answer with Enter key. Next install KDE libraries required for digiKam:
sudo apt-get install kdelibs5 

Unless you waited too long after previous command you will not be asked for password again because sudo remembers it for several minutes. For all other questions select default with Enter key as before. Now get and build dependencies required for compilation:
sudo apt-get build-dep digikam kipi-plugins 

Again you will be asked several questions including (three times) a pop-up window asking to define mySql password, as before choose default answers to everything with Enter key.

Next command (be careful, all apostrophes and dots are required) will check if all dependencies are installed on your machine and prepare the compilation script (all in one line):
cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. 

Scroll up the terminal window and check the results. You should see several lines with results of kipi-plugins and digiKam dependencies tests without any errors. The most important is the line claiming “digiKam can be compiled … YES” which means you have everything required to continue with next command. If you don't get this result check error messages which must be solved first. Usually some required library is missing and hopefully you can understand error message and install it with sudo apt-get install command. Then repeat (you can do it several times without bad effects) the above cmake command to check dependencies again until you succeed without errors. If errors persist you can write a comment and maybe we can solve it together or try to find help of more Linux experienced friend.

All above commands were only preparation for this one, which will compile and build the digiKam program (all in one line):
sudo checkinstall --pkgname=digikam2.9 --install=no make install 

Again you will get several questions which can be answered with Enter key then the compilation will start executing. This is a long process and unless your machine is extremely fast you can expect it to run for at least one hour. Just before it finishes, it will ask some more questions. As before use Enter key to choose default answers. The final result should look similar to:
*************************************************************
Done. The new package has been saved to
/home/mirc/Downloads/digikam-2.9.0/build/digikam2.9_20130311-1_i386.deb
You can install it in your system anytime using: 
     dpkg -i digikam2.9_20130311-1_i386.deb
*************************************************************

Almost finished, only the last step remains, that is to install the program:
sudo dpkg -i --force-overwrite <deb-file>

In above command replace <deb-file> with the name of your deb file, which was displayed when previous command completed (see above, in my case digikam2.9_20130311-1_i386.deb). And that is all, now you can start digiKam from the Dash Home and configure it.

Note: Information at Building Digikam for Dummies on Ubuntu helped me a lot to to succesfully compile digiKam, unfortunatelly they are already outdated.

Update: After I wrote this post I found out, that new digiKam version 3.1 is already available. I will try to compile it too and post instructions as soon as possible.

No comments:

Post a Comment