Monday, December 13, 2010

Making loaddap work on ubuntu at UCT


  1. Download a libdap.rpm and loaddap.rpm appropriate to your version of matlab. For matlab 6, loaddap 3.5.2 and libdap 3.6.2 are the packages to use. http://www.opendap.org/download/ml-structs.html
  2. Convert the rpm packages to debian (.deb) using alien (which is in the ubuntu repository)
  3. Install the packages, libdap first and then loaddap
  4. Install a pthreads library (libpthread), which is in the repository
  5. You will need to create links to a number of libraries (the versions may differ according to the versions of loaddap and libdap that you are using) that possibly exist as newer versions in your version of ubuntu (in my case, 10.04/Lucid Lynx).
  • In /usr/lib: sudo ln -s libssl.so.0.9.8 libssl.so.4
  • In /usr/lib: sudo ln -s libcrypto.so.0.9.8 libcrypto.so.4
  • In /usr/lib: sudo ln -s libcurl.so.3 libcurl.so.2
  • In /lib: sudo ln -s libcomm_err.so.2.1 libcomm_err.so.3
  1. This is the dodgy bit: the /usr/bin/loaddap.mexglx seems to be incompatible with the version of matlab and/or mexcdf that I have, so I copied it from /Roms_tools/Opendap_tools/FEDORA/ and pasted it into /usr/bin (renaming the old one loaddap.mexglx_bckp)
  2. Edit you start.m script in order to point to the loaddap and libdap libraries:
  • addpath(['/usr/bin'])
  • addpath(['/usr/lib'])
  • addpath(['/usr/sbin'])
  • addpath(['/usr/share'])

If you are using a machine that is not at UCT, you should be good to go. If you are at UCT, you need to do the following (thanks Neil!) in order to get around some proxy issues.

  1. Install cntlm (available in the ubuntu repository)
  2. As root, you need to edit the following file: /etc/cntlm.conf according to the following example (everything else in the file is uncommented):

Username <your UCT username (i.e. staff or student number)>
Domain wf

Password <your UCT password> # Use hashes instead (-H)


Proxy campusnet.uct.ac.za:8080


Listen 3128




ISAScannerSize 1024

ISAScannerAgent Wget/

ISAScannerAgent APT-HTTP/

ISAScannerAgent Apt/

ISAScannerAgent Svn/

ISAScannerAgent Loaddap/


  1. In order to activate the changes made in cntlm.conf so that you can bypass the proxy issues so that your username and password is automatically provided for command-line opendap downloads, you need to type:

sudo /etc/init.d/cntlm start

You won't want to have to type this command everytime you do a download, so in order to automate it on start-up, go to System – Preferences – Startup Applications. Click on add, type a name for command (e.g. Run cntlm), the command (use gksudo instead of sudo: gksudo /etc/init.d/cntlm start) and a comment if you wish. You will be asked for your root password on startup in a gui (the reason you need to use gksudo) so that this is able to run.

  1. In .bashrc, add the following lines (the port needs to be consistent with what is in cntlm.conf)

export http_proxy=http://localhost:3128

export https_proxy=$http_proxy

export ftp_proxy=$http_proxy

  1. In System-Preferences-Network Proxy, I changed mine to Manual Proxy Configuration (and checked the box: use the same name for all protocols), with localhost as the HTTP proxy and the port 3128.

Note: for my Mozilla Firefox (version 3.6.12) and for my Thunderbird email client I kept the preferences for network connections to 'Auto-detect proxy settings'.

Note: this is one solution. There may also be a cleaner work-around in which you specify your proxy, username and password in .dodsrc (which should be in your home directory).


No comments:

Post a Comment