This document describes the process of installing the Linux® version of MATLAB® version 6.5 onto a FreeBSD system. It works quite well, with the exception of the Java Virtual Machine™ which is described further in Section 11.5.3, “Linking the Java™ Runtime Environment”.
The Linux® version of MATLAB® can be purchased and licensed from MathWorks. Consider letting the company know that you would like a native FreeBSD version of this software.
To install MATLAB®:
Become root
, as recommended by
the installation script. Insert the installation CD and
mount it. To start the installation script type:
#
/compat/linux/bin/sh /cdrom/install
The installer is graphical. If it is not able to
open a display, type setenv HOME
~
,
where USER
USER
is the user who
ran su(1).
When asked for the MATLAB®
root directory, type:
/compat/linux/usr/local/matlab
.
For easier typing on the rest of the installation
process, type this at the shell prompt: set
MATLAB=/compat/linux/usr/local/matlab
.
Edit the license file as instructed when obtaining the MATLAB® license.
This file can be prepared in advance using an
editor, and copied to
$MATLAB/license.dat
before the
installer asks to edit it.
Complete the installation process.
At this point the MATLAB® installation is complete. The following steps apply “glue” to connect it to the FreeBSD system.
Create symlinks for the license manager scripts:
#
ln -s $MATLAB/etc/lmboot /usr/local/etc/lmboot_TMW
#
ln -s $MATLAB/etc/lmdown /usr/local/etc/lmdown_TMW
Create a startup file named
/usr/local/etc/rc.d/flexlm
. The
example below is a modified version of the distributed
$MATLAB/etc/rc.lm.glnx86
. The
changes are file locations and startup of the license
manager under Linux® emulation.
username
&& echo 'MATLAB_lmgrd'
fi
;;
stop)
if [ -f /usr/local/etc/lmdown_TMW ]; then
/compat/linux/bin/sh /usr/local/etc/lmdown_TMW > /dev/null 2>&1
fi
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0The file must be made executable:
#
chmod +x /usr/local/etc/rc.d/flexlm
Replace username
with the
name of a valid user on the system which is not
root
.
Start the license manager with the command:
#
service flexlm start
Change the Java™ Runtime Environment (JRE) link to one working under FreeBSD:
#
cd $MATLAB/sys/java/jre/glnx86/
#
unlink jre; ln -s ./jre1.1.8 ./jre
Place the following startup script in
/usr/local/bin/matlab
:
Then, type the command
chmod +x /usr/local/bin/matlab
.
Depending on the version of emulators/linux_base
, running
this script may result in errors. To avoid errors, edit
/compat/linux/usr/local/matlab/bin/matlab
,
and change the line that says:
to this line:
The following is needed to solve a problem with MATLAB® not exiting correctly.
Create
$MATLAB/toolbox/local/finish.m
containing the single line:
The $MATLAB
is
literal.
The same directory contains
finishsav.m
and
finishdlg.m
, which allow the
workspace to be saved before quitting. If either file
is used, insert the line above immediately after the
save
command.
Create
$MATLAB/bin/finish.sh
which
contains the following:
Make the file executable:
#
chmod +x $MATLAB/bin/finish.sh
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.