Use MATLAB on Ubuntu 22.04, a technical and scientific software from Mathworks for powerful numerical calculations and professional visualization of data and results. It is a platform-independent software for solving mathematical problems and graphically displaying the results. The software package is best-known for tools for calculating and simulating complex mathematical and technical problems.
The name MATLAB has derived from the terms MATrix LABoratory. It is software from The MathWorks for solving mathematical problems. The commercial software can be used platform-independently. Results of the numerical calculations can be displayed graphically. MATLAB’s calculations are based on matrices.
Here we learn the steps to install MATLAB on Ubuntu 22.04 Jammy JellyFish Linux and how to create its Desktop shortcut…
Steps to Install MATLAB for Ubuntu 22.04 Linux.
The steps given here will not only applicable for Ubuntu 22.04 LTS but also work for Ubuntu 20.04 and 18.04 including Debian, Linux Mint, MX Linux, Zorin OS, Elementary OS, Deepin, CentOS, OpenSUSE, Kali, RHEL, and other Linux distros.
1. Download the MATLAB Linux version
While writing this tutorial, the latest version of Matlab available to download was R2022b, however, that doesn’t mean the process of its installation will be changed, if you are one of some other latest versions.
- Open the browser and go to www.mathworks.com
- Click the download button for the current release
- Enter your email ID to Sign in, if you don’t have an account with MathWorks, then simply Sign up for it.
- Select between two options Get Trail or Link your licenses. Click on the Get Trail button, you can link your license, if you have, later otherwise continue using the trial version until it gets expired.
- Download the installer for Linux.
2. Extract Zip file
The MATLAB Linux installer will be in zip format, thus to get started with its installer, first we need to unzip the same.
- Open the Command terminal
- Switch to the Downloads directory because the files we download from the browser automatically go to that. Here is the command:
cd Downloads
- Check the availability of files-
ls
- Installer Unzip–
sudo apt install unzip
- Create a folder to extract files-
mkdir matlab
- Unzip the MATLAB file-
unzip -qq matlab*.zip -d matlab
3. Run MATLAB Linux Installer on Ubuntu 22.04
Once the extraction of the zipped file has been completed, the next step is to run the installer that will offer a graphical user interface installation wizard.
Switch to the directory we have created to extract MATLAB files:
cd matlab
Now, display all files, inside it:
ls
Run installer
sudo ./install
or
./install
Note: If you are choosing to run the “Install” script without sudo then while installing the Matlab, change the default installation folder to some place or directory that is writable by your current user.
4. Login with MathWorks Account
Enter your Mathworks Account email address and password to use the corresponding available License information.
5. Select the available License
As we are using the Trail version, the license available corresponding to it will show there. If you have purchased one that will also appear in the “Select License” area. Alternatively, we can also enter the Activation key manually.
6. Select Matlab Products or Toolbox to install
All the Toolbox packages will appear, by default, all will be marked to install, if you want some particular Toolbox then choose that only and uncheck the others.
7. Select the Destination address
Leave the default folder if you have used sudo to run the Install script otherwise select or create a folder that your system user can write and then select the NEXT button.
8. Create MATLAB Symbolic link
To run the MATLAB directly using the Command line terminal, we have to create a Symbolic for its script.
sudo ln -s /<path-to-your-matlab>/matlab /usr/local/bin/matlab
If you have followed the above steps then it will be like this:
sudo ln -s /usr/local/MATLAB/R2020b/bin/matlab /usr/local/bin/matlab
9. Launch the Matlab app on Ubuntu 22.04
Once the installation is completed, to start the MATLAB software, on your command terminal type:
matlab &
10. Create Matlab Desktop Shortcut Linux
If you are on Ubuntu or using some other Linus Distro and want to create a MATLAB desktop shortcut icon to easily run it. Then follow the below steps:
1. Open a command terminal
2. Create a Desktop Shortcut file for MATLAB using the command:
nano ~/Desktop/Matlab.desktop
3. Copy-paste the below lines
[Desktop Entry] Version=1.0 Type=Application Name=MATLAB Exec=/usr/local/MATLAB/R2022b/bin/./matlab Icon=/usr/local/MATLAB/R2022b/resources/coreui/matlab/splash.png Terminal=false
Note: Change Exec and Icon Path, in case you have installed Matlab in some other directory apart from the default one showing in the above-given lines.
4. Save the Desktop Shortcut file by pressing Ctr+X and the type Y followed by the Enter Key.
5. Now, go to the Desktop, right-click on the created file and select the “Allow Launching” option.
6. Double click on the Ubuntu MATLAB desktop shortcut to start the application.
11. Uninstall Matlab from Ubuntu 22.04 LTS
To remove the installation of Matlab, we just need to delete its folder and Syslink created by it. Here we are using the default path suggested by the software to install it, thus we are using that with the remove command. If you have used any custom directory then use the path of the same:
sudo rm -r /usr/local/bin/matlab sudo rm -r /usr/local/MATLAB
Other Articles:
• How to install Octave on Ubuntu 22.04 | 20.04 LTS
• How to Setup and use Google Drive on Ubuntu 20.04
• Install Bottles on Ubuntu 22.04 LTS
Hi,
Nice post. Congrats. Just a question: how long does the installation take?
After: sudo ./install nothing happens in my terminal. I’ve been waiting for a while.
Any idea?
Hi Troncho,
I wanted to reply to your comment but accidentally just left a general comment on the original post, maybe there’s something of use in there for you once it’s been cleared by Akismet for spam.
Hi Troncho,
I encountered the same issue, if you haven’t found a fix in the mean time, or for anyone else encountering the same issue, I found the following fix at:
https://uk.mathworks.com/matlabcentral/answers/1459909-installer-hang-when-installing-matlab-r2021b-as-root-on-ubuntu-20-04#comment_1759029
Simply run:
xhost +SI:localuser:root
and then:
sudo ./install
should take you to the matlab install gui. It worked for matlab-r2022a for me. I hope that helps.
Also thank you Heyan Maurya for the original guide 🙂