Steps to Install Matlab via CLI Sliently

In this post, I will introduce the essential steps to install MATLAB on a server with only Command Line Interface.

Keywords: MATLAB, CLI, installation, activation

Installation

Dowload the two ISO files, disk1.iso and disk2.iso, and we assume that you put them into the directory ~/matlab_install.

1
2
3
4
5
6
7
8
9
10
11
12
13
cd ~/matlab_install

# Create mount point for later use of the ISO files
sudo mkdir /mnt/matlab_iso
# You can just ignore the warning: WARNING:device write-protected,mounted read-only
sudo mount -t auto -o loop disk1.iso /mnt/matlab_iso

# Make a copy of the inputfile and activation property files to your current directory.
cp /mnt/matlab_iso/activate.ini /mnt/matlab_iso/installer_input.txt .

# Add the install folder to the environmental variable
export MATLABROOT=/usr/local/matlab2018a/bin
echo "export MATLABROOT=$MATLABROOT" >> ~/.bashrc

Use whatever the editor you like to edit installer_input.txt and activate.ini. Here I only write about the offline activation of standalone version of the Matlab.

For installer_input.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
## SPECIFY INSTALLATION FOLDER
destinationFolder=/usr/local/matlab2018a

## SPECIFY FILE INSTALLATION KEY
leInstallationKey=09806-07443-53955-64350-21751-41297

## ACCEPT LICENSE AGREEMENT
agreeToLicense=yes

## SPECIFY OUTPUT LOG
outputFile=/tmp/matlab.log

## SPECIFY INSTALLER MODE
mode=silent

For activate.ini

1
2
3
4
5
6
# SPECIFY ACTIVATION MODE
isSilent=true
# SPECIFY ACTIVATION TYPE (Required)
activateCommand=activateOffline
# SPECIFY LICENSE FILE LOCATION (Required if activateCommand=activateOffline)
licenseFile=license_standalone.lic

Start the installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/mnt/matlab_iso/install -inputFile ./installer_input.txt
# After a while, you will need to umount the disk1 and mount disk2 to countinue the installation
sudo umount /mnt/matlab_iso
sudo mount -t auto -o loop disk2.iso /mnt/matlab_iso

# After finishing the installation, we can unmount the disk2 now
# unmount the disk2
sudo umount /mnt/matlab_iso

# Then we will need to replce lmgrimpl module in the matlab installation directory for activation
sudo cp bin/* $MATLABROOT/

# Activate the Matlab by running, it will says 'success'
$MATLABROOT/activate_matlab.sh -propertiesFile activate.ini

# Finally, link the matlab to /usr/bin,
sudo ln -s $MATLABROOT/matlab /usr/local/matlab

You may now start your journey on Matlab now by just typying matlab.

Reference