Main Content

Install Add-Ons for MATLAB on MATLAB Online Server

MATLAB® add-ons encompass a wide variety of resources, including products, apps, support packages, and toolboxes. Add-ons extend the capabilities of MATLAB with functionality for additional tasks and applications. This topic describes how to install add-ons in MATLAB Online™ so that they are accessible by all users.

Prerequisites

Before you begin, make sure that you:

  • Understand what add-ons are and how to manage them on the Linux® version of the MATLAB Desktop. For more information, see Get and Manage Add-Ons in the Help Center.

  • Installed and configured MATLAB Online Server™.

Create Docker Image with Add-Ons Installed

  1. Go to the Downloads at mathworks.com. Install the Linux version of MATLAB in the folder /MATLAB.

  2. Install the required add-ons using the Get and Manage Add-Ons instructions on mathworks.com.

    By default, MATLAB add-ons are installed in the following folder:

    ~/MATLAB Add-Ons

  3. After you install the add-ons successfully, exit MATLAB.

  4. Copy the folder where the add-ons were installed into the MATLAB installation directory, /MATLAB.

  5. Under /MATLAB, delete the licenses folder.

  6. Using the following command, build the MATLAB image from the installation you just performed:

    sudo ./mosadm build-matlab-image /MATLAB

If you have a multi-node installation, you can retag the Docker® images and then push them to a remote Docker registry using the mosadm push-docker-images command. Replace registryName with the name of your Docker registry and repositoryName with the name of your repository.

mosadm push-docker-images --deployment-image-registry registryName --deployment-image-repository repositoryName

Configure MATLAB Online Server to Use Installed Add-Ons

Each storage profile can optionally define an add-ons directory with the following YAML structure:

addons:
  directory: "<add-ons-directory>"

Ensure that add-ons-directory is available in the MATLAB container during runtime in one of these ways:

  • Inside the Docker container

  • Through a special mount using the storage profile

  • Chosen dynamically by the administrator

The benefits and drawbacks to the first two procedures are the same: the add-ons you select are installed and then rolled out to the entire organization, but MATLAB users cannot install any custom add-ons.

Alternatively, you can choose the add-ons directory during user sign in, as long as users have write access to the directory. Using this procedure, MATLAB users can install any custom add-on, but you cannot roll out any add-ons to the users. The add-ons must be installed by the users themselves.

Note

If the addons: add-ons-directory value is empty or not defined, startDirectory/MATLAB Add-Ons is the default directory for the add-ons.

From the following options, select the one that works best for your organization.

Option 1: Read-Only Add-Ons Directory Inside Docker Container

During this procedure, an add-ons directory is created inside the MATLAB installation directory and created as a Docker image. The add-ons you select are installed and then rolled out to the entire organization, but MATLAB users cannot install any custom add-ons.

In matlab-pool.yaml (override), add the add-ons directory to the storage profile as shown:

storage:
  profiles:
    - name: "nfsHome"
      startDirectory: "/home/${subject.subjectId}"
      mounts:
        - name: "home"
          permissionType: "user"
          mountPath: "/home/${subject.subjectId}"
          uid: "${subject.uid}"
          gid: "${subject.gid}"
          type: "nfs"
          server: "nfs"
          subPath: "/exports/home/${subject.subjectId}"
          mountOptions: 
"rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmi
n=600,acregmax=600,acdirmin=600,acdirmax=600,hard,nocto,noacl,prot
o=tcp,timeo=600,retrans=2,mountproto=tcp,local_lock=none,nolock"
      restrictNavigationOutsideMounts: false
      addons:
        directory: "/MATLAB/MATLAB Add-Ons"

Option 2: Read-Only Add-Ons Directory Through Special Mount

The add-ons you select are installed and then rolled out to the entire organization. MATLAB users cannot install any custom add-ons.

  1. Create a MATLAB Docker image. See Prepare Docker Images in Perform Minimal MATLAB Online Server Installation on Single Machine.

  2. Mount the add-ons directory through an external mount using Storage profiles.

In the matlab-pool.yaml (override), in the storage profile configuration, add the add-ons directory as shown:

storage:
  profiles:
    - name: "nfsHome"
      startDirectory: "/home/${subject.subjectId}"
      mounts:
        - name: "home"
          permissionType: "user"
          mountPath: "/home/${subject.subjectId}"
          uid: "${subject.uid}"
          gid: "${subject.gid}"
          type: "nfs"
          server: "nfs"
          subPath: "/exports/home/${subject.subjectId}"
          mountOptions: 
"rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmi
n=600,acregmax=600,acdirmin=600,acdirmax=600,hard,nocto,noacl,prot
o=tcp,timeo=600,retrans=2,mountproto=tcp,local_lock=none,no
lock"
       - name: "addons"
          mountPath: "/AddOns"
          type: "nfs"
          permissionType: "none"
          server: "nfs"
          subPath: "/exports/matlab/R2021a/addons"
          mountOptions: 
"ro,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,acregmi
n=600,acregmax=600,acdirmin=600,acdirmax=600,hard,nocto,noacl,prot
o=tcp,timeo=600,retrans=2,sec=sys,mountproto=tcp,local_lock=none,n
olock"
      restrictNavigationOutsideMounts: false
      addons:
        directory: "/AddOns"

Option 3: Writable User Installed Add-Ons Directory

You choose the add-ons directory during user sign in. This directory must have write access for all users.

Using this procedure, MATLAB users can install any custom add-on, but you cannot roll out any add-ons to the users. The add-ons must be installed by the users themselves.

  1. Create a MATLAB Docker image. See Prepare Docker Images in Perform Minimal MATLAB Online Server Installation on Single Machine.

  2. In the matlab-pool.yaml (override), in the storage profile configuration, add the add-ons directory as shown:

    storage:
      profiles:
        - name: "nfsHome"
          startDirectory: "/home/${subject.subjectId}"
          mounts:
            - name: "home"
              permissionType: "user"
              mountPath: "/home/${subject.subjectId}"
              uid: "${subject.uid}"
              gid: "${subject.gid}"
              type: "nfs"
              server: "nfs"
              subPath: "/exports/home/${subject.subjectId}"
              mountOptions: 
    "rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,a
    cregmin=600,acregmax=600,acdirmin=600,acdirmax=600,hard,noct
    o,noacl,proto=tcp,timeo=600,retrans=2,mountproto=tcp,local_l
    ock=none,nolock"
          restrictNavigationOutsideMounts: false
          addons:
            directory: "/home/${subject.subjectId}/MATLAB Add-Ons"
    

Related Topics