Step by Step Guide to Installing MATLAB on Linux

Installing MATLAB On Linux

MATLAB, or Matrix Laboratory, is a programming and numeric computing platform used by millions of engineers and scientists to analyze data, develop algorithms, create models, and provide visual insights. It is a staple for any sort of complex numerical or mathematical programming, which makes it a valuable tool for research, development, and innovation.

MATLAB is available for installation on almost all of the leading operating systems (OS), such as Microsoft Windows, Mac, and Linux. In this article, we will learn how to install and run MATLAB on Linux.

Step 1. Sign Up or Log In to MathWorks to Acquire Your MATLAB License

Since MATLAB is proprietary software, we need a license to run it. To obtain a license, we need a MathWorks account. If you already have an account, you can simply log in from here; otherwise, you will have to create an account using your school or work email address on the registration page.

Note: We can also create an account after choosing the license as shown below, but we are creating the account in advance for the sake of convenience.

Once done, we can then choose the type of license we need from the MathWorks Store.

MATLAB, by default, offers four types of licenses—Standard, Education, Student, and Home. Mathworks also offers a free 30-day trial license, which I will install in this tutorial.

To obtain the trial license, enter your university’s or organization’s email ID here.

Matlab Trial 1

After you enter your Email ID, A verification email will be sent to your inbox, which requires you to enter your details and how you plan to use the product. Regardless of the license you choose, after the user verification is complete, you will be given access to the MATLAB Dashboard, where you can download the MATLAB application.

Matlab Dashboard
Matlab Dashboard

Step 2. Downloading MATLAB

To download MATLAB, click “Install MATLAB on your computer” and then click on the “Download for Linux” option.

Matlab Linux Download

This will download a zip file that contains your MATLAB software.

Step 3. Install MATLAB

To install MATLAB, we must first unzip the downloaded folder. However, before unzipping, we will first make a separate folder in which we can unzip the downloaded folder. Here I am naming that folder “matlab” but you can name it anything.

To do that, execute the following command in the terminal.

1 2mkdirmatlabunzip matlab_R2022a_glnxa64.zip -d matlab

You can replace matlab_R2022a_glnxa64.zip with the name of your downloaded folder.

Unzip Matlab

Now go to the directory in which you unzipped all the files and execute the install script.

1 2cd matlab ./install

Read more on Linux zip and unzip commands.

This command will prompt an installation wizard asking you to log in.

Matlab Installer

After entering the email and password, you will be asked to select your license or activation key, the destination folder, the products you want to install, and whether you want to create symbolic links in the root directory.

Destination Folder Matlab

Note: It is possible that you don’t have sudo privileges, in which case, the installer will refuse to select /usr/local/ as the destination folder. In that case, you choose /home/ as your destination folder, so there is no need to create symbolic links.

After everything is done, it will install the product in the destination folder.

Note: Ensure your internet is connected to your system, as MATLAB requires some additional files that need to be downloaded.

Mathworks Product Installer

Step 4. Launch MATLAB

If you made symbolic links during the installation, you can launch Matlab by simply typing matlab in terminal.

If you cannot make symbolic links, then all the launch scripts are placed in the /bin/ folder where you installed MATLAB.

To launch MATLAB. Go to the bin folder of the destination directory and execute the following.

1./matlab
Launch Matlab

You may not want to browse to this folder and execute .matlab every time you have to start MATLAB. In that case, you can make an alias (like the one shown below) and add it to ~/.bashrc

1aliasmatlab="~/matlab/bin/matlab"
Matlab Alias

Finally, you have installed MATLAB and can start working on it.

Installed Matlab

Optional: Activating MATLAB License With a Different Key

It may happen that in order to learn and explore MATLAB, you have purchased a non-commercial license, which could be student, education, or home. Whichever version of the license you have purchased, we need to upgrade it to a standard license in order to use it in a commercial environment. 

To do so, we need to activate the standard license with a different key. For that, we need to go to the bin file located in the installation directory of our program.
Here we open the terminal and type ./activate_matlab.sh to run the activation script. Once done, we will come to the following screen: Click on the Activate automatically using the internet’ option. 

Activating Matlab With A Different Key
Activating Matlab With A Different Key – Screen 1

Now we will come to the Login page like so,

Login Or Provide License Page Screen 2
Login Or Provide License Page Screen 2

Enter your account details, create a new account, or simply select the license file on this screen to proceed.

Select License Or Provide An Activation Key Screen 3
Select License Or Provide An Activation Key Screen 3

Select the type of license you need to upgrade. For now, it’s just a trial license, but you will see the standard license option here.

Changing The Username Screen 4
Changing The Username Screen 4

We can change the username as well, if required, on this screen.

Activation Complete With A Different Key Screen 5
Activation Complete With A Different Key Screen 5

There you go; we have successfully re-activated MATLAB, the standard license, with a different key.

Conclusion

Installing MATLAB on a Linux system is a straightforward process that opens the door to a world of numerical computing and data analysis.

From registering or logging in to MathWorks to acquiring a license, downloading and installing the software, and even re-activating with a different key if needed, this article has walked you through every step.

Now, with MATLAB successfully installed on your system, you’re all set to explore its powerful capabilities and apply them to your research, development, or innovation projects.