*  Informatique / Matlab / Matlab R2018a : installation of License Manager without GUI on Linux server

        * Installation
        * License Manager at boot-time

pict pict

On the license server (Ubuntu server 16.04 LTS), one only needs to install the license manager files (i.e. without any other Matlab product). On the license server we want

On a client computer, if the license server is directly accessible one can run Matlab :

matlab -c @27300@<SERVER>

where <SERVER> is the name or the IP address of the license server. If it is only accessible by a gateway, one can create a ssh tunnel

ssh -N -g -L 27300:<SERVER>:27300 -L 3121:<SERVER>:3121 <GATEWAY>

and in an other terminal

matlab -c 27300@localhost

The lsb-core and the unzip packages suppose to be installed on this server.

*  Installation

For the installation the following is needed

We suppose these files stored on the <TMP> directory (<TMP> must be replaced in the following commands by the directory you have choosen)

We extract the contents of the Matlab Installer :

cd <TMP>
unzip matlab_R2018a_glnxa64.zip

The /usr/local/MATLAB/R2018a installation directory is created and the license file is copied to it :

sudo mkdir -p /usr/local/MATLAB/R2018a
sudo cp license.lic /usr/local/MATLAB/R2018a

The FlexlmInstallR2018a.txt is created in <HOME>/tmp with content
destinationFolder=/usr/local/MATLAB/R2018a  
fileInstallationKey=xxxxx-xxxxx-xxxxx-xxxxx  
agreeToLicense=yes  
mode=silent  
licensePath=/usr/local/MATLAB/R2018a/license.lic  
lmgrFiles=true

where the file Installation Key must be changed to fit your configuration.

Now the install process can be runned. The <TMP> directory must be given as a full directory in -inputFile option.

sudo <TMP>/matlab_R2018a_glnxa64/install -mode silent -inputFile <TMP>/FlexlmInstallR2018a.txt

To specify the ports used by the license server we modify the license file created during the installation process by changing SERVER port to 27300 (default is 27000) and adding port=3121 at the end of the DAEMON MLM line :

SERVER <HOSTNAME> <MAC> 27300  
DAEMON MLM "/usr/local/MATLAB/R2018a/etc/MLM" port=3121  
...

where <HOSTNAME> is the hostname of the license server and <MAC> is the MAC address of the server given to Mathworks for the license activation.

Thereafter one can try the configuration

/usr/local/MATLAB/R2018a/etc/lmstart
/usr/local/MATLAB/R2018a/etc/lmstat
/usr/local/MATLAB/R2018a/etc/lmdown
/usr/local/MATLAB/R2018a/etc/lmstat

*  License Manager at boot-time

I want to use systemd to start the Matlab License Manager at boot-time.

For that I create the flexlm.service in <HOME>/service directory :

[Unit]  
Description=Service for running Matlab License Manager.  
After=network.target  
 
[Service]  
ExecStart=/usr/local/MATLAB/R2018a/etc/lmstart  
ExecStop=/usr/local/MATLAB/R2018a/etc/lmdown  
User=cuvelier  
RemainAfterExit=yes  
 
[Install]  
WantedBy=multi-user.target

You have to change User line to fit with your configuration.

Thereafter, I insert this file in systemd by a link (<HOME> is the fullpath to the directory)

sudo systemctl link <HOME>/service/flexlm.service

Now one can try the service

sudo systemctl status flexlm.service
sudo systemctl start flexlm.service
sudo systemctl status flexlm.service

Finaly, the service is enabled at boot-time

sudo systemctl enable /home/cuvelier/service/flexlm.service