How to install MATLAB on Ubuntu

How to Install MATLAB on Ubuntu 20.04

Today I’ll walk you through the steps to Install MATLAB on Ubuntu 20.04. The steps are pretty simple and you should be able to finish the installation of MATLAB in less than 5 mins on your ubuntu by following this tutorial.

What is MATLAB – Matlab, which stands for “matrix laboratory”, is a high-performance language for technical computing with extensive use in the engineering and scientific communities, it has a graphical interface for creating and running programs.

Create an MathWorks Account

Now to be able to download and Install MATLAB you will need a Math Works account and a License key.

To begin, first, open your web browser and go to this link – https://mathworks.com/login, this is the official website for MATLAB, here you will need to click on “Create one” to create a new MATLAB account.

mathworks signup page

Now enter all the required information like your email (use university email if you have), your country, in “Which best describes you” select “student”, after that click on yes in age confirmation, and click on the “Create” button below.

mathworks enter info for account signup

On the next page you will be asked to enter your work or university email ( If you have one ), if you don’t then continue by clicking on “Continue with current Email”, the benefits of work or university email can be seen here.

email confirmation popup for mathworks account

After that Mathworks will send you an email at the email address that you provided with the link to verify the email address, open your email app and see the email set by Mathworks, click on the link or the “Verify Email” button to verify your email.

verify email for mathworks accountverify email for mathworks account

Now here you will need to finish the registration process by filling up a few more details, enter your name, last name, create a new password, confirm the password, in “role” select student, in “department” select the department you are in.

finish mathworks profile creation

In the Location of School/University, enter your university location and name, after that scroll down and accept the Agreement and click on “Create” to finish creating your Mathworks account.

After clicking on the create button your Mathworks account will be created and you will be redirected to the Mathworks dashboard, here you will need to now get a “Licence Key”, you can either buy the students license for 21 dollars or you can click on “Try now” to start a 30-day free trial.

Get MATLAB License

To Get a MATLAB Licence first Log in to your Mathworks account at https://mathworks.com/mwaccount/, after that go to this link – https://mathworks.com/products/get-matlab.html, here you will get three options to select from, the first option will be to get a 30 days trial of MATLAB, If your university already has access to MATLAB then you can select the second option, if you want to buy MATLAB student license then click on the third option.

choose matlab license

I’ll show you how you can get a free trial and also how you can buy a student license.

Trial Licence

To get a free Trial Licence of MATLAB you’ll need to click on the “Download a Trial” button on the products page of Mathworks.

Here enter your address, zip code, click “NO” in the question of whether this request is on behalf of a faculty member, enter the year of graduation, select “MATLAB Essentials” from the trial usage dropdown and click on Submit.

fill-matlab-trial-formfill-matlab-trial-form

After clicking on Submit, you will be redirected to https://matlab.mathworks.com/, from where you can download MATLAB.

Buy License

To buy a MATLAB student license first Log in to your Mathworks account at https://mathworks.com/mwaccount/, after that go to the products page at – https://mathworks.com/products/get-matlab.html, here click on the “Buy” button.

After that in the “Pricing and Licensing” page select Student and select the Student Licence, after that click on Buy now>Add to cart> Checkout. Complete the transaction and get your Student Licence Key for MATLAB.

buy matlab student license

Download MATLAB

After either purchasing a license key or using the trial version of MATLAB, you can download MATLAB by going to https://matlab.mathworks.com/, here log in using your Mathworks account info.

After logging in to the dashboard of MATLAB you will need to click on the “Install MATLAB on your Computer” option. 

open matlab downloads page

In the download page you will need to click on the “Download for Linux” button, if it’s showing Download for Windows then click on the arrow at the right side of the button and select Linux.

The downloaded zip file will be saved to your Ubuntu downloads directory by default, or you might get a popup asking where to save the file. After downloading the MATLAB zip file it is time to install MATLAB on your ubuntu 20.04.

Install MATLAB on Ubuntu

Update Index Packages

Okay, so the first step will be to first open your ubuntu terminal and update the index packages, this is a good habit to do whenever starting any installation on your ubuntu system.

sudo apt-get update 
sudo apt-get upgrade

Now you can start the installation of MATLAB on ubuntu 20.04, before starting the installation make sure that you have sudo permissions, as we will need sudo permissions for installing MATLAB.

Unzip MATLAB

Now you will need to unzip the downloaded MATLAB zip file, you can do that by right-clicking the downloaded zip and then clicking on “Extract here”, you can also unzip it using the terminal by entering “sudo unzip -X -K file_name.zip -d extracted_file_destination”.

The version of MATLAB that I have downloaded is r2021b. First, change your directory to the one where you downloaded the zip,

cd Downloads

After that use the command “ls” to see all the files in that directory, after that use the unzip command and unzip the downloaded MATLAB zip, using this command the zip files will be extracted to a new folder called “matlab_new” you can name it anything you want.

sudo unzip -X -K matlab_R2021b_glnxa64.zip -d matlab_new

Once the zip file is unzipped to “matlab_new” folder, change your directory to that folder using the command –

cd matlab_new

Install MATLAB

To install MATLAB you will need to run the install script that is in the extracted folder, here, after you have changed your directory type the command given below to go to the root of the “matlab_new” folder.

sudo su

After that you will need to enter the xhost command, which you will need to open the GUI installer of MATLAB.

xhost +SI:localuser:root

After that to run the MATLAB GUI installer you will need to run the install script, to run that script type the following command in the terminal –

./install

This will start the GUI Installer of MATLAB, at first you will be asked to Log in, log in using the Mathworks account Email and Password.

Now here in the Agreement, click on the yes option to accept the agreement, and after that click on “NEXT”.

In the “Licensing” page the trial or paid license that you have on your Mathworks account will automatically get selected, if you want you can select a different one or enter an activation key. Click NEXT to continue.

select matlab license

After that in “Confirm user” check if all the details are correct, here you will need to add a username that you will need to use to run MATLAB. Enter a username and click NEXT to continue.

In the “Destination” tab keep the destination path the default one and click on the NEXT button to continue.

After that, you will be now on the “products” page, here you will need to select all the products that you want to download, click NEXT after selecting the products to continue. A popup will then appear asking you to add the products to install, click on “Add” to continue.

select matlab products

Now you will be in the “Options” tab, here tick the “Create symbolic links” option and click on NEXT.

select create symbolic links

After the options tab, you will be in the “Confirmation” tab where you will need to check if all the things are correct or not, like licensing, username, products. It will also display the disk space that you will need for the installation. Now click on “Begin Install’ to Download and Install MATLAB.

Once the download finishes click on the “Close” button on the installer.

Activate MATLAB

Now to be able to use MATLAB, you will need to activate MATLAB. To do that first you will need to exit out of root using the command “exit”, now after that, you will need to change your directory to home using the command –

cd ~

Once you are in the home directory, change your directory to “/usr/local/” using the command –

cd /usr/local/

After that go inside the MATLAB directory.

cd MATLAB/

Now type the “ls” command to see the folder that is available inside the MATLAB directory, here inside the MATLAB directory you will get a folder named “R2021b” as we have installed the R2021b version of MATLAB. Go inside that version folder.

cd R2021b/

Again change your directory to bin.

cd bin

Now if you do a “ls” command inside this directory you will see a script named “activate_matlab.sh”, you will need to run that script in order to start the activation process of MATLAB.

./activate_matlab.sh

The GUI MATLAB activation software will now open, here you will need to select the “Activate automatically using the Internet” option then click on NEXT. Now here sign in using your MathWorks Account and click on NEXT.

On the “License Selection ” tab the license will be automatically selected, if you want to use a different license then you can select a different license, click on NEXT when done.

On the “username” tab, enter the username that you used during the installation process of MATLAB. After that click next and in the “Confirm Selection” tab check if all the provided details are correct or not.

Click on “Confirm” to continue, if you have a valid license then the activation will be completed. After activating MATLAB click on “Finish” to close the GUI Activation software.

Run MATLAB

To run MATLAB, first, close all the terminal windows and open a new one, here in the terminal type the following command to run MATLAB –

matlab 

This will start MATLAB. And that’s it, that is how you can Download, Install and Activate MATLAB on Ubuntu 20.04. If you have any questions then comment below or send me a mail at – [email protected]

FAQ -

How to uninstall MATLAB on Ubuntu 20.04?

If you want to uninstall MATLAB from your Ubuntu, then you can follow these steps.

First change your directory to “/usr/local/” then go into the root of that directory using the command “sudo su”, after that use the command given below to delete all the MATLAB-related files from your Ubuntu system.

rm -rf /usr/local/MATLAB/R2021b/

Here “R2021b” is the version of MATLAB that is installed on your Ubuntu. Once MATLAB is uninstalled, change your directory to home using the command “cd ~” and run the command “matlab” to see if MATLAB has been successfully removed from your Ubuntu system or not.

How long does MATLAB free trial License last?

The free trial given by MATLAB is for 30 days, which means that you can use MATLAB for 30days using the free trial, after that, you will need to purchase a license. You can get a MATLAB trial for 30 days with one email. After that, you can buy a lifetime student license for 21 dollars.

What are the System Requirements to Install MATLAB on ubuntu?

To be able to install MATLAB on your Ubuntu you will need a ubuntu version of 20.04, 18.04 (MATLAB is not Supported on ubuntu 16.04) that has at least 6GB of free storage for just the installation and running of MATLAB. If you want to install other products then you will need more free space.

Leave a Comment

Your email address will not be published. Required fields are marked *