DragonFly 3.2 supports the Areca ARC-1882 RAID controller family
[ikiwiki.git] / docs / handbook / handbook-linuxemu-matlab.mdwn
1 \r
2 \r
3 ## 22.5 Installing MATLAB® \r
4 \r
5 ***Contributed by Dan Pelleg. ***\r
6 \r
7 This document describes the process of installing the Linux version of  **MATLAB® version 6.5**  onto a DragonFly system. It works quite well, with the exception of the  **Java Virtual Machine™**  (see [linuxemu-matlab.html#MATLAB-JRE Section 22.5.3]).\r
8 \r
9 The Linux version of  **MATLAB**  can be ordered directly from The MathWorks at http://www.mathworks.com. Make sure you also get the license file or instructions how to create it. While you are there, let them know you would like a native DragonFly version of their software.\r
10 \r
11 ### 22.5.1 Installing MATLAB \r
12 \r
13 To install  **MATLAB** , do the following:\r
14 \r
15   1. Insert the installation CD and mount it. Become `root`, as recommended by the installation script. To start the installation script type:\r
16       \r
17       # /compat/linux/bin/sh /cdrom/install\r
18   \r
19    **Tip:** The installer is graphical. If you get errors about not being able to open a display, type `setenv HOME ~`***USER******, where `***USER***` is the user you did a [su(1)](http://leaf.dragonflybsd.org/cgi/web-man?command#su&section1) as.\r
20   1. When asked for the  **MATLAB**  root directory, type: /compat/linux/usr/local/matlab.\r
21    **Tip:** For easier typing on the rest of the installation process, type this at your shell prompt: `set MATLAB=/compat/linux/usr/local/matlab`\r
22   1. Edit the license file as instructed when obtaining the  **MATLAB**  license.\r
23    **Tip:** You can prepare this file in advance using your favorite editor, and copy it to `$MATLAB/license.dat` before the installer asks you to edit it.\r
24   1. Complete the installation process.\r
25 \r
26 At this point your  **MATLAB**  installation is complete. The following steps apply ***glue*** to connect it to your DragonFly system.\r
27 \r
28 ### 22.5.2 License Manager Startup \r
29 \r
30   1. Create symlinks for the license manager scripts:\r
31       \r
32       # ln -s $MATLAB/etc/lmboot /usr/local/etc/lmboot_TMW\r
33       # ln -s $MATLAB/etc/lmdown /usr/local/etc/lmdown_TMW\r
34   \r
35   1. Create a startup file at `/usr/local/etc/rc.d/flexlm.sh`. 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.\r
36       \r
37       #!/bin/sh\r
38       case "$1" in\r
39         start)\r
40               if [ -f /usr/local/etc/lmboot_TMW ]; then\r
41                     /compat/linux/bin/sh /usr/local/etc/lmboot_TMW -u `***username***` && echo 'MATLAB_lmgrd'\r
42               fi\r
43               ;;\r
44         stop)\r
45         if [ -f /usr/local/etc/lmdown_TMW ]; then\r
46                   /compat/linux/bin/sh /usr/local/etc/lmdown_TMW  > /dev/null 2>&1\r
47         fi\r
48               ;;\r
49     
50 *)\r
51         echo "Usage: $0 {start|stop}"\r
52         exit 1\r
53         ;;\r
54       esac\r
55       exit 0\r
56   \r
57    **Important:** The file must be made executable:\r
58       \r
59       # chmod +x /usr/local/etc/rc.d/flexlm.sh\r
60   \r
61   You must also replace `***username***` above with the name of a valid user on your system (and not `root`).\r
62   1. Start the license manager with the command:\r
63       \r
64       # /usr/local/etc/rc.d/flexlm.sh start\r
65   \r
66 \r
67 ### 22.5.3 Linking the Java™ Runtime Environment \r
68 \r
69 Change the  **Java™**  Runtime Environment (JRE) link to one working under DragonFly:\r
70 \r
71     \r
72     # cd $MATLAB/sys/java/jre/glnx86/\r
73     # unlink jre; ln -s ./jre1.1.8 ./jre\r
74 \r
75 \r
76 ### 22.5.4 Creating a MATLAB Startup Script \r
77 \r
78   1. Place the following startup script in `/usr/local/bin/matlab`:\r
79       \r
80       #!/bin/sh\r
81       /compat/linux/bin/sh /compat/linux/usr/local/matlab/bin/matlab "$@"\r
82   \r
83   1. Then type the command `chmod +x /usr/local/bin/matlab`.\r
84 \r
85  **Tip:** Depending on your version of [`emulators/linux_base`](http://pkgsrc.se/emulators/linux_base), you may run into errors when running this script. To avoid that, edit the file `/compat/linux/usr/local/matlab/bin/matlab`, and change the line that says:\r
86 \r
87     \r
88     if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then\r
89 \r
90 \r
91 (in version 13.0.1 it is on line 410) to this line:\r
92 \r
93     \r
94     if test -L $newbase; then\r
95 \r
96 \r
97 ### 22.5.5 Creating a MATLAB Shutdown Script \r
98 \r
99 The following is needed to solve a problem with MATLAB not exiting correctly.\r
100 \r
101   1. Create a file `$MATLAB/toolbox/local/finish.m`, and in it put the single line:\r
102       \r
103       ! $MATLAB/bin/finish.sh\r
104   \r
105    **Note:** The `$MATLAB` is literal.\r
106    **Tip:** In the same directory, you will find the files `finishsav.m` and `finishdlg.m`, which let you save your workspace before quitting. If you use either of them, insert the line above immediately after the `save` command.\r
107   1. Create a file `$MATLAB/bin/finish.sh`, which will contain the following:\r
108       \r
109       #!/usr/compat/linux/bin/sh\r
110       (sleep 5; killall -1 matlab_helper) &\r
111       exit 0\r
112   \r
113   1. Make the file executable:\r
114       \r
115       # chmod +x $MATLAB/bin/finish.sh\r
116   \r
117 \r
118 ### 22.5.6 Using MATLAB \r
119 \r
120 At this point you are ready to type `matlab` and start using it.\r
121 \r
122 \r
123 \r
124 CategoryHandbook\r
125 CategoryHandbook-linuxcompatibility\r