Update matlab on image cluster

From ImageWiki

Jump to: navigation, search

Update matlab on image cluster

This guide worked for matlabR2010a.

For imageserver1:

  1. download zip-file containing matlab and text file containing activation keys from punkt.ku.dk. Transfer the zip file using scp to /tmp on imageserver1
  2. unzip and mount extracted iso:
 unzip file.zip
 mkdir iso
 mount -o loop file.iso iso
  1. run install in the directory where the iso is mounted. Choose e.g. /usr/local/matlabR2010a for the matlab root folder and use the file installation key from the text file you downloaded above. Matlab will install but give an error for the activation. Don't worry about that.
  2. go to https://www.mathworks.com/licensecenter/ and log in using your matlab account information (my @stud.ku.dk email address works here, @diku.dk doesn't).
  3. choose 'Activation and Installation' and click the 'Activate' button. Use the activation key from the text file. For the host id use the mac address of imageserver1. You can retrieve it by issuing /sbin/ifconfig and copy the 'HWaddr' field.
  4. download the license file you get from the license center and save it as e.g. /usr/local/matlabR2010a/licenses/license.lic
  5. check that the new version of matlab will run
  1. if everything works correctly, remove symbolic link /usr/local/matlab and create it again pointing to the new matlab install
 rm /usr/local/matlab
 ln -s /usr/local/matlabR2010a /usr/local/matlab
  1. not all installed toolboxes are included in the matlab install. Copy the remaining to the /usr/local/matlab/toolbox/ folder and update /usr/local/matlab/toolbox/local/pathdef.m . The following script will do this for you when invoked with the directory containing the old matlab installation as the sole parameter, e.g. ./copy-toolboxes /usr/local/matlabR2008a

OLD=`echo $1|sed -e 's/\/$//'`/toolbox # old matlab toolbox dir
NEW=/usr/local/matlab/toolbox # new matlab toolbox dir

# identify missing toolboxes
MISSING=`diff $NEW $OLD|grep "Only in $OLD"|cut -d: -f2`

REGEXP=`echo $REGEXP|cut -d\| -f2-`
INSERT=`grep -E "$REGEXP" $OLDPATHDEF|tr : \;`

HEAD=`sed -e "/$SEP/,// d" $NEWPATHDEF`
TAIL=`sed -e "1,/$SEP/ d" $NEWPATHDEF`

STR=`echo -e "$HEAD\\n$INSERT\\n$SEP\\n$TAIL"`

echo "The following toolbox(es) will be copied: $MISSING"
echo ""
echo "The following changes will be done to $NEWPATHDEF:"
echo "$STR"|diff $NEWPATHDEF -
echo ""
echo ""
echo -n "Proceed? [y/n] "
read -e CONF

if [ $CONF = "y" ]; then
  echo "Wrinting pathdef"
  for TOOLBOX in $MISSING; do
    echo "Copying $TOOLBOX"
    cp -R $OLD/$TOOLBOX $NEW
  echo ""
  echo "Aborted"

  1. run matlab again to test it
  1. if you feel confident, you might want to delete the old version of matlab.
  2. umount iso and remove temporary files
 umount /tmp/iso
 rm -rf file.zip file.iso iso

For each of the remaining servers, do the following:

  1. copy the matlab install to from imageserver1 to the server, e.g. from imageserver1 execute
 scp -r /usr/local/matlabR2010a root@imageserver2:/usr/local
  1. get a license file from the matlab license center using the servers mac address and replace /usr/local/matlabR2010a/licenses/license.lic with the obtained file
  2. verify that the new version of matlab runs
  3. make /usr/local/matlab point to the new matlab directory
  4. test again

Stefan Sommer, July 2010

Personal tools