Installing Matlab on Ubuntu (22.04)

Urban Pistek
2 min readSep 24, 2022
Photo by Gabriel Heinzer on Unsplash

Wish to install Matlab on Ubuntu? Yes, the answer is yes. Here is how.

Download and Run the Installer

Download the Installer from the Matlab Website: Installer

  1. Unzip the files
  2. Open a terminal and run:
xhost +SI:localuser:root

3. Navigate into the unzipped folder and run the installer with:

sudo ./install

During install be sure to create a symbolic link to be able to run matlab using the matlab command.

Running Matlab

Once installed you can run Matlab from the terminal as follows:

If you created symbolic links:

matlab

Otherwise, you can try:

/usr/local<PATH TO INSTALL>/bin/matlab -desktop

Example:

/usr/local/MATLAB/R2022a/bin/matlab -desktop

Add Desktop Icon

If you wish to create a desktop application icon, the easiest way is to install the following packages:

sudo apt-get install matlab-support

Fixing Errors When Running Matlab

If you start matlab from the terminal you may notice some errors show up, in particular if you see the following error (these as far as I can tell are not critical, however probably best to fix):

Gtk-Message: 08:14:28.995: Failed to load module "canberra-gtk-module"

You can fix it by running the following:

sudo apt install libcanberra-gtk-module
sudo ln -s /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so /usr/lib/libcanberra-gtk-module.so

Note: You may see additional errors on Ubuntu 22.04 if you have a AMD graphics card. These are because at the time of writing this (2022/09/23) the AMD drivers are not yet fully supported on Ubuntu 22.04.

References

[1] https://www.mathworks.com/matlabcentral/answers/1459909-installer-hang-when-installing-matlab-r2021b-as-root-on-ubuntu-20-04

[2] https://www.mathworks.com/matlabcentral/answers/472134-gtk-message-10-32-31-466-failed-to-load-module-canberra-gtk-module

[3] https://askubuntu.com/questions/971560/what-is-the-purpose-of-canberra-gtk-module

--

--

Urban Pistek
0 Followers

Engineering | ML & AI | R&D | Embedded | Software