2

Linux 安装 MATLAB

 1 year ago
source link: https://xujinzh.github.io/2022/06/22/linux-install-matlab/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Linux 安装 MATLAB

2022-06-22technologylinux

3 3.3k 3 分钟

MATLAB 是美国的 The MathWorks 公司出品的商业数学软件。其可用于数据可视化、数据分析、数值计算、算法开发(如计算机视觉中的目标跟踪)等。从 2006 年开始,发行编号以年份来命名,每年推出两个版本,上半年(3 月份)标识为 a 版,下半年(9 月份)标识为 b 版,如发行编号 R2017a 表示 2017 年上半年推出的 MATLAB 软件,其对应的版本号是 MATLAB 9.2。本篇介绍如何在 Linux 系统(以 Ubuntu 为例)上安装 MATLAB,发行编号 R2017a. 所有命令以普通用户运行,但部分代码需要用户有 sudo 权限。

因为 MATLAB 是商业软件,所以使用其需要进行许可证购买,永久购买大概是 15500 元人民币,或者 6200元人民币/年。本篇介绍的软件是破解版,如果能力允许建议购买正版软件。

破解版软件下载地址:MATLAB_R2017a_Linux

百度网盘提取码是:6ygs

下载后,我们需要使用到如下几个文件:

tree  /home/jinzhongxu/MATLAB_R2017a_Linux
/home/jinzhongxu/MATLAB_R2017a_Linux
├── libmwservices.so
├── license_standalone.lic
├── R2017a_glnxa64_dvd1.iso
├── R2017a_glnxa64_dvd2.iso
└── readme.txt
  1. 创建挂载点

因为 iso 文件在 Ubuntu 上需要我们先挂载才能打开,因此先创建一个目录作为挂载点

mkdir -p /home/jinzhongxu/matlab
  1. 挂载 iso 文件 1

把第一个 iso 文件挂载到挂载点

cd /home/jinzhongxu/MATLAB_R2017a_Linux
sudo mount -o loop R2017a_glnxa64_dvd1.iso /home/jinzhongxu/matlab
# mount: /home/jinzhongxu/matlab: WARNING: device write-protected, mounted read-only.

如果挂载不上,可把 iso 文件的权限放开,方法如下:

chmod 777 /home/jinzhongxu/MATLAB_R2017a_Linux/*.iso
  1. 安装

挂载好后,进入 /home/jinzhongxu/matlab 目录,可以看到类似如下文件

ls /home/jinzhongxu/matlab
# activate.ini bin help installer_input.txt java patents.txt sys ui
# archives etc install install_guide.pdf license_agreement.txt readme.txt trademarks.txt version.txt

一切正常,则可进行软件安装,注意安装时不要在 /home/jinzhongxu/matlab/ 目录下直接运行 install,这样行不通,建议使用如下方法:

sudo /home/jinzhongxu/matlab/install

此时,就会出现熟悉的 MATLAB 安装界面。

选择 Use a File Installation Key —> 选择下一步 —> 选择 I have the File Installation Key for my license —> 输入密钥(在 readme.txt 中的 standalone)09806-07443-53955-64350-21751-41297 —> 选择下一步 —> 安装目录建议默认 /usr/local/MATLAB/R2017a —> 建议全选所有产品 —> 选择下一步进行继续安装

当安装到 75% 时,需要更换 iso 2

  1. 挂载 iso 文件 2

挂载 iso 2 前需要先卸载 iso 1,方法如下

sudo umount /home/jinzhongxu/matlab

然后挂载 iso 2

cd /home/jinzhongxu/MATLAB_R2017a_Linux
sudo mount -o loop R2017a_glnxa64_dvd2.iso /home/jinzhongxu/matlab
# mount: /home/jinzhongxu/matlab: WARNING: device write-protected, mounted read-only.

挂载好后,查看挂载点下的文件,大概如下:

ls /home/jinzhongxu/matlab
# archives

如果一切正常,则可以点击 ok 继续安装。直接完成安装为止。

当安装完成后,挂载 iso 2 即可

sudo umount /home/jinzhongxu/matlab
  1. 激活软件

首先需要在安装目录创建如下目录

sudo mkdir -p /usr/local/MATLAB/R2017a/bin/licenses

然后把下面的两个文件拷贝到指定目录

sudo cp license_standalone.lic /usr/local/MATLAB/R2017a/bin/licenses
sudo cp libmwservices.so /usr/local/MATLAB/R2017a/bin/glnxa64

最后启动MATLAB

sudo /usr/local/MATLAB/R2017a/bin/matlab

第一次启动需要配置。选择 Activate manually without the Internet —> 选择 Enter the full path to your license file, including the file name: 选择 /home/jinzhongxu/MATLAB_R2017a_Linux 里面的 license_standalone.lic 文件 —> 选择下一步完成激活。

激活后再次启动MATLAB,即可正常使用。

配置MATLAB

在上面所有步骤都完成后,可以通过命令 sudo /usr/local/MATLAB/R2017a/bin/matlab 启动 MATLAB,但是,总感觉命令有些长,而且需要在命令行输入。

如何缩短命令?

首先,把 MATLAB 的安装目录配置到环境变量

echo 'export MATLAB_HOME=/usr/local/MATLAB/R2017a' >> ~/.bashrc
echo 'export PATH=$MATLAB_HOME/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

把 MATLAB 的所有者和所属组更改为普通用户

sudo chown -R jinzhongxu:jinzhongxu /usr/local/MATLAB
sudo chown -R jinzhongxu:jinzhongxu /home/jinzhongxu/.matlab

此时,在命令行通过如下命令即可打开 MATLAB

matlab

如何通过点击图标打开 MATLAB

sudo vim /usr/share/applications/matlab.desktop

添加如下内容

[Desktop Entry]
Type=Application
Name=MATLAB
GenericName=MATLAB2017a
Comment=MATLAB2017a:The matlab IDE
Exec=/usr/local/MATLAB/R2017a/bin/matlab -desktop
Icon=/usr/local/MATLAB/R2017a/toolbox/nnet/nnresource/icons/matlab.png
Terminal=matlab
Categories=MATLAB;

此时就可以通过所有应用程序打开 MATLAB 软件。

  1. 在Linux环境(Ubuntu16.04)下安装Matlab2017a_VJONE_UCAS_BUPT的博客-CSDN博客_matlab在linux安装

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK