These directions are for installing the Linux version of MATLAB 7.0 (R14) under Linux Binary Compatibility. I'll assume that you already have the install CDs, and a valid license.
Enabling Linux Binary Compatibility
The first thing we need to do is install linux binary compatibility. It's likely that you have it installed already. You can check with the following command:
pkg_info | grep linux_base
If you have it installed you will see a line similar to this:
linux_base-fc-4_9 Base set of packages needed in Linux mode (for i386/amd64)
If you have it installed please skip the next commands for installing it. Otherwise, run the following to install linux binary compatibility.
cd /usr/ports/emulators/linux_base-fc4
make install clean
Either way add the following line to /etc/rc.conf.
linux_load=YES
In order to start compatibility, use the following command:
kldload linux.ko
That will be run automatically everytime you boot with the line we added to rc.conf.
Now add the following line to /etc/fstab.
linprocfs /compat/linux/proc linprocfs rw 0 0
Now run the following two commands:
kldload linprocfs
mount /compat/linux/proc
From now on that will be done for you automatically.
Installing Matlab
Now we need to install linux-java. First you'll have to download the linux-java binary from Sun. Accept the license agreement, and download the file j2sdk-1_4_2_10-linux-i586.bin or its closest equivalent. Once downloaded, move the file to /usr/ports/distfiles/. Then we can install linux-java:
cd /usr/ports/java/linux-sun-jdk14
make install clean
Now we can move on to installing MATLAB. When you mount the cds you will have to mount them with executable permissions. Or you can follow my method of copying the contents of the cds to disk, and run the install from there. Either way will work, but I'll walk you through doing it the same way that I did.
cd /usr
mkdir mat mat2 mat3
Now copy all of the contents to those respective directories (mat for cd1, mat2 for cd2, etc).
cd /compat/linux/usr/
mkdir local
cd local
mkdir matlab
cd matlab
mkdir etc
cd etc
That was a slight pain. At this point you will want copy your prepared license.dat file to etc.
cp license.dat /compat/linux/usr/local/matlab/etc
Now that the license is prepared we're ready to begin the install.
cd /compat/linux/usr/local/matlab
/compat/linux/bin/sh /usr/mat/install
Modify that command if you are installing directly off of the cd. For the install itself you will want to take the default installation directory (the directory you are currently in). The rest of the installer is self explanatory. I'll assume the install was successful.
cd /compat/linux/usr/local/matlab/etc
ln -s lmboot /usr/local/etc/lmboot_TMW
ln -s lmdown /usr/local/etc/lmdown_TMW
We just made a few links for files that will be referenced in our license manager script. Now we'll get that script going.
cp rc.lm.glnx86 /usr/local/etc/rc.d/flexlm.sh
cd /usr/local/etc/rc.d/
chmod +x flexlm.sh
vi flexlm.sh
That will give us a good template for the file. We just need to edit a few paths. In the end your file should look like this:
#!/bin/sh
case "$1" in
start)
if [ -f /usr/local/etc/lmboot_TMW ]; then
/compat/linux/bin/sh /usr/local/etc/lmboot_TMW -u xaenn && 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 0
You will want to change xaenn to the appropriate username for your system.
/usr/local/etc/rc.d/flexlm.sh start
For the first time we need to start it manually, but it will happen at startup automatically from now on. Right now we could use MATLAB, but it's a bit cumbersome to invoke, so let's write a quick script.
vi ~/bin/matlab
Add the following lines:
#!/bin/sh
/compat/linux/bin/sh /compat/linux/usr/local/matlab/bin/matlab
As per the FreeBSD Handbook, depending on your version of emulators/linux_base, you may need to edit the matlab script.
vi /compat/linux/usr/local/matlab/bin/matlab
Edit the following line
if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then
and replace it with
if test -L $newbase; then
And one final note, sound support has been hit or miss for me. Sometimes it works, and other times it won't. As an alternative you may use the wavwrite function, and then play the output from mplayer. It's not ideal, but it works. Finally, you'll have something nice like this:
2008年3月31日 星期一
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言