Saturday, May 31, 2008

FreeMind manual installation in Ubuntu Hardy 8.04

So you like the mind mapping software FreeMind, but the distribution package for Ubuntu 8.04 is hideously out of date. Your solution awaits... simply by installing FreeMind from source. While this is fairly easy to follow, there is some complexity with getting full desktop integration. I am including the steps I followed, but if you scroll all the way to the bottom, you can find a compiled archive with 0.9.0 beta 17 included with a script to do all the work referenced in the article.

First, you need a few packages (if you are going to use the version of FreeMind I compiled below, you do not need sun-java6-jdk):

sudo aptitude install sun-java6-jre sun-java6-fonts sun-java6-jdk


Now download FreeMind. I recommend the latest beta version, found here. You will also need to download Apache Ant. There is an Ant package in the Hardy repositories, but it is broken, so you will need the binaries directly from Apache. I used 1.7.0, the latest version available at the time of this article.

Unpack Ant and copy it to its destination (execute the following in a terminal wherever you placed the downloaded Ant archive):

tar xf apache-ant-1.7.0-bin.tar.bz2
sudo mkdir /usr/local/ant
sudo mv apache-ant-1.7.0/* /usr/local/ant


Set up Ant's environment variables:

gksu gedit /etc/rc.local

# In gedit, append the following to this file before "exit 0":

export ANT_HOME=/usr/local/ant
export PATH=${PATH}:${ANT_HOME}/bin


Reboot for the above to take effect, or just execute the two export commands within your current terminal. Now you are ready to compile FreeMind. Unpack it and build it with Ant:

tar xf freemind-src-0.9.0_Beta_17.tar.gz
cd freemind
ant


Now copy the built contents of the dist folder into /opt/freemind, and set up the executable:

sudo mkdir /opt/freemind
sudo cp -R ../bin/dist/* /opt/freemind
sudo chmod +x /opt/freemind/freemind.sh
sudo ln -s /opt/freemind/freemind.sh /usr/local/bin/freemind


Congratulations, you can now run FreeMind by simply typing the command: freemind

The harder part was registering the x-freemind MIME type and getting Gnome to open .mm files with a double-click (and having an icon assigned to those files!). For the MIME type, there are two existing conflicting MIME types you will have to get rid of: x-troff-mm and x-matlab. As I have no use for these applications, this is not a problem for me. These are defined in /usr/share/mime/packages/freedesktop.org.xml, and you have to comment out the nodes as follows:

<!--
<mime-type type="text/x-matlab">
<sub-class-of type="text/plain"/>
<comment>MATLAB script/function</comment>
<comment xml:lang="bg">Скрипт/функци� — MATLAB</comment>
<comment xml:lang="ca">script/funció MATLAB</comment>
<comment xml:lang="cs">Skript/funkce MATLAB</comment>
<comment xml:lang="de">MATLAB-Skript/-Funktion</comment>
<comment xml:lang="en_GB">MATLAB script/function</comment>
<comment xml:lang="es">script/función de MATLAB</comment>
<comment xml:lang="eu">MATLAB script/funtzioa</comment>
<comment xml:lang="fi">MATLAB-skripti/funktio</comment>
<comment xml:lang="fr">script/fonction MATLAB</comment>
<comment xml:lang="hu">MATLAB parancsfájl/funkció</comment>
<comment xml:lang="it">Script/Funzione MATLAB</comment>
<comment xml:lang="ja">MATLAB スクリプト/関数</comment>
<comment xml:lang="ko">MATLAB 스�립트/함수</comment>
<comment xml:lang="nb">Skript/funksjon for MATLAB</comment>
<comment xml:lang="nl">MATLAB-script/functie</comment>
<comment xml:lang="nn">MATLAB-skript/funksjon</comment>
<comment xml:lang="pl">Skrypt/funkcja MATLABa</comment>
<comment xml:lang="pt_BR">Script/função do MATLAB</comment>
<comment xml:lang="sv">MATLAB-skript/funktion</comment>
<comment xml:lang="uk">Сценарій/функці� MATLAB</comment>
<comment xml:lang="vi">Văn lệnh/chức năng MATLAB</comment>
<magic priority="10">
<match value="%" type="string" offset="0"/>
</magic>
<magic priority="50">
<match value="function" type="string" offset="0"/>
</magic>
<glob pattern="*.m"/>
<alias type="text/x-octave"/>
</mime-type>
-->


...and....

<!--
<mime-type type="text/x-troff-mm">
<sub-class-of type="text/plain"/>
<comment>Troff MM input document</comment>
<comment xml:lang="bg">Изходен документ — Troff MM</comment>
<comment xml:lang="ca">document d'entrada Troff MM</comment>
<comment xml:lang="cs">Vstupní dokument Troff MM</comment>
<comment xml:lang="da">Troff MM inddata-dokument</comment>
<comment xml:lang="de">Troff-MM-Eingabedokument</comment>
<comment xml:lang="el">έγγ�αφο/π�όγ�αμμα εντολών troff MM</comment>
<comment xml:lang="en_GB">Troff MM input document</comment>
<comment xml:lang="eo">eniga dokumento de Troff MM</comment>
<comment xml:lang="es">documento de entrada Troff MM</comment>
<comment xml:lang="eu">Troff MM sarrerako dokumentua</comment>
<comment xml:lang="fi">Troff MM -syöteasiakirja</comment>
<comment xml:lang="fr">document d'entrée Troff MM</comment>
<comment xml:lang="hu">Troff MM bemeneti dokumentum</comment>
<comment xml:lang="it">Documento di input Troff MM</comment>
<comment xml:lang="ja">Troff MM 入力ドキュメント</comment>
<comment xml:lang="ko">Troff MM input 문서</comment>
<comment xml:lang="lt">Troff MM įvesties dokumentas</comment>
<comment xml:lang="ms">Dokumen input Troff MM</comment>
<comment xml:lang="nb">Troff MM-inndatadokument</comment>
<comment xml:lang="nl">Troff MM-invoerdocument</comment>
<comment xml:lang="nn">Troff MM inndata-dokument</comment>
<comment xml:lang="pl">Dokument wejściowy Troff MM</comment>
<comment xml:lang="pt">documento origem Troff MM</comment>
<comment xml:lang="pt_BR">Documento de entrada Troff MM</comment>
<comment xml:lang="sq">Dokument input-i Troff MM</comment>
<comment xml:lang="sr">Troff MM улазни документ</comment>
<comment xml:lang="sv">Troff MM-indatadokument</comment>
<comment xml:lang="uk">Вхідний документ Troff MM</comment>
<comment xml:lang="vi">Tà i liệu nhập MM Troff</comment>
<comment xml:lang="zh_CN">Troff MM 输入文档</comment>
<glob pattern="*.mm"/>
</mime-type>
-->


You then need to add a file at /usr/share/mime/packages/freemind.xml with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-freemind">
<comment>FreeMind Mind Map</comment>
<glob pattern="*.mm"/>
</mime-type>
</mime-info>


Once you have edited/created these files, you need to update the MIME database:

sudo update-mime-database /usr/share/mime


To assign icons to the FreeMind .mm files, It turns out you have to create 48x48, 32x32, and 24x24 icons (PNG files) for FreeMind, copy these to /usr/share/icons/gnome under the appropriate size-named folders, and then update the icon cache. I used GIMP to create the icons based on an svg icon that came with the FreeMind source package. Each icon PNG must be named gnome-mime-application-x-freemind.png. To update the icon cache once these are in place:

sudo gtk-update-icon-cache --force gnome


Once you are done, log out and back in, and enjoy your FreeMind goodness.

NOW, if that all seems a bit much... I have created an archive containing a script that does everything except set up the main menu item pointing to FreeMind. It contains a version of FreeMind 0.9.0 beta 17 I compiled (on 64-bit Ubuntu, so this may or may not work on 32-bit versions) along with the modifications to the MIME types and the icons I created.

Download it here: freemind-0.9.0_Beta_17.tar.bz2


11 comments:

  1. This is what I was looking for. Tried it and script appeared to run successfully but when I run freemind from Term, the Freemind startup flash but then I get complaint that the Java I have is not Sun derived. I have Sun Java 6 installed and can't figure out what's it is complaining about.

    PS. I'm a newbie of sort in Ubuntu and only have some experience with Debian before.

    Thanks for any help.

    KL

    ReplyDelete
  2. k, did you notice the steps about installing the Sun Java packages? The ones that are present by default in Ubuntu won't do the trick.

    ReplyDelete
  3. Thanks, that worked famously.

    ReplyDelete
  4. Thanks for the setup for Freemind on Hardy. I have done the manual part with the Beta 18 and It works great.

    For moving the icons and building the icon cash I used the same commands as in the install script.

    For starting from the File browser I define freedom as the default application for *.mm files.

    ReplyDelete
  5. Thank you for the script! I'd tried a couple of other methods to no avail.

    This worked like a charm!

    ReplyDelete
  6. Thanks so much for the script(s)/installer... I'm a long time freemind fan, and a 'nix n00b.

    I've got it working now successfully, but there is one odd thing: I can only successfully launch it by using the Terminal. If I create a main-menu entry with the command "freemind", it fails at the "Creating Initial Mode" step (at least that's the last step that shows in the splash progress bar). Any idea why? I don't mind launching from the term, but I'm using Launchy to index my menu and I'm pretty used to launching apps that way.

    Any help would be greatly appreciated.

    Regardless, thanks again for the help. I was about to give up on getting freemind running on Hardy.

    ReplyDelete
  7. Arthur, thanks for the script and the howto. The Script is working fine with the freemind version beta17.
    I have install the beta19 version and it's working too.

    I had the problem with the 2 commands export ANT_HOME=/usr/local/ant
    export PATH=${PATH}:${ANT_HOME}/bin

    It does not work. ant couldn't be found.
    I have set the path variable with
    PATH=$PATH:/usr/local/ant/bin
    export PATH

    First i try with the ant 1.7.0 from hardy repos and it's still broken.
    I get ant binary 1.7.1 from apache and building with it is successfully.

    ReplyDelete
  8. Great post, i used it with beta 20 and runs smoothly

    ReplyDelete
  9. This worked. I installed freemind 0.9RC1 under Ubuntu 8.10.
    It only threw me a JAVA error "Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar", which I resolved by reconfiguring JAVA to standard SUN 6, using "sudo update-alternatives --config java" and choosing the " /usr/lib/jvm/java-6-sun/jre/bin/java" variant.

    Thank you for your excellent guide!

    ReplyDelete
  10. From Italy, yyyyeeeeaaaahhhhh.. Good.

    Thank's for youer notes.

    ReplyDelete
  11. An alternative to installing from source is using the repository for Ubuntu by Eric Lavell

    deb http://eric.lavar.de/comp/linux/debian/ experimental/

    deb-src http://eric.lavar.de/comp/linux/debian/ experimental/

    you can read instructions here: https://help.ubuntu.com/community/Freemind

    ReplyDelete