Linux Applications

Installing Matlab on Linux

“This tutorial shows how to install Matlab on Linux. The tutorial was initially written in 2018 and updated in 2022.

As its official website says, Matlab is a very powerful application for analyzing data, developing algorithms, creating mathematical models, running simulations, generating code, and testing and verifying embedded systems, among other features.

We’ll learn how to install MatLab for free using the 30-day trial license in this tutorial. If you are a student, your educational institution probably already provides an unlimited free license; you can check if your institution has a MatLab license here.

All installation steps described in this document include screenshots, making it easy for every Linux user to follow them.”

Installing Matlab on Linux

To begin installing Matlab on Linux, you need to create an account at this link. But first, when accessing the Matlab website, you will be requested to choose your country, as shown in the screenshot below. Just select it to continue to the free license page.

After being redirected to the Matlab account creation page, fill out the form, including your email address, location, description, and age question and press the Create button.

Then you will be notified a confirmation email was sent to your email address.

Open the confirmation email and press the Verify email button or the link below it.

You will be redirected to an account creation page. Type your name, last name, and password and scroll down to the page. If you have a paid license, you can add the activation key or license below; this step is optional. If you are using a free 30-day trial, ignore the license field and scroll down.

Select the “I accept the Online Services Agreement” option and press the Create button.

In the Matlab trial screen, type your email address and select the dropdown menu asking about your matlab usage preferences.

At this step, you can choose as many options as you want to be included in your Matlab installation. Available options include the following.

  • MATLAB Essentials
  • Simulink Essentials
  • Biological Sciences
  • Deep Learning & Machine Learning
  • Image Processing and Computer Vision
  • Model-Based Systems Engineering
  • Power Electronics Control Design
  • Predictive Maintenance
  • Quantitative Finance and Risk Management
  • Robotics
  • Signal Processing
  • Simscape for Physical Modeling
  • Test and Measurement
  • Wireless Communications

Once you type the email address and select the best option fitting your needs, press the Submit button.

After creating your account, you will be redirected to the Matlab online dashboard. As you can see, you can use Matlab’s online version, but if you are reading this tutorial, let’s continue with the Linux local installation.

Press the Install MATLAB button as indicated by the arrow in the following image.

When the download page shows up, press the Download button shown in the screenshot below.

After downloading Matlab, you need to create a dedicated directory for installation files. Usually, this directory is created under the /opt directory by running the command shown below.

sudo mkdir /opt/matlab

Move the Matlab .zip file you just downloaded to the /opt/matlab directory created in the previous step. The syntax is the following.

sudo mv matlab_R<Version>..zip /opt/matlab

Therefore to move the version I got, I run the following command.

sudo mv matlab_R2022a_glnxa64.zip /opt/matlab

Change your current directory for /opt/matlab.

cd /opt/matlab

Unzip matlab by executing the syntax below.

sudo unzip matlab_R<Version>..zip

In my case, to unzip Matlab’s last version, I execute the command shown in the following image.

sudo unzip matlab_R2022a_glnxa64.zip

If the Matlab Installer does not start, use the command below to fix the error. You can try to launch the installer as shown in the next step, and if it does not open the installer, then execute the command below.

xhost +SI:localuser:root

To start Matlab installation, execute the command shown in the image below.

sudo ./install

The first step requires you to type your email address and press the Next button.

The second step of the graphical installer will ask you to fill in the password, type it and press the Sing In button.

Tick the question “Do you accept the terms of the license agreement?” and press Next.

The licensing screen allows you to add a paid license. If you want to use a free trial, just press Next.

Confirm the user when requested by pressing Next.

I recommend you to leave the default destination directory; if you agree, then press Next.

You can include additional Matlab features depending on your needs. This step is a custom step; select any product you want and press Next.

Allow the installer to create symbolic links by pressing Next. This may prevent possible future problems.

To start Matlab files installation, press Begin Install.

The installation process will start. This only will last a few minutes.

When the installation process ends, press the Close button.

After completing the installation, you can launch matlab from the console by executing the command shown in the example below.

matlab &

As you can see, Matlab is ready to start working.

How to Uninstall Matlab in Linux

Uninstalling Matlab is pretty simple as removing the installation root directory. First, check the Matlab root directory by running the command shown below.

which matlab

If you selected the default installation directory, remove Matlab using rm.

sudo rm /usr/local/bin/matlab

Finally, to remove the installer directory run:

sudo rm -rf /opt/matlab/

That’s all about installing and uninstalling Matlab.

Conclusion

As you can see, installing Matlab on Linux is very simple and can be done by any Linux user independently of his expertise level. Matlab is an excellent choice for scientists of almost all fields and one of the most popular tools for it. Matlab alternatives include GNU Octave, Scilab,
AnyLogic and more. Linux always offers alternatives and varied options. Matlab also supports Microsoft Windows and Mac Os, which makes it great to share work between different platforms.

I hope you found this article useful to get started with Matlab. Keep following LinuxHint for more Linux tips and professional tutorials.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.