安装matlab

安装matlab

软件版本
matlab2022a
节点IP系统功能CPU内存硬盘
node110.80.0.100kylin v10-sp3matlab4核心8GB100GB

参考网址:https://code84.com/770448.html

参考网址:https://zhuanlan.zhihu.com/p/394298249

node1

上传相关软件包到root目录,校验数据:

1
# md5sum -c CODE.md5

新建安装目录:

1
# mkdir -p /usr/local/Matlab/{R2020a,license}

新建挂载目录:

1
# mkdir /mnt/matlab

解压安装包:

1
# tar -xzvf Matlab_R2020a_Lin64.tar.gz

挂载镜像:

1
# mount -r Matlab98R2020a_Lin64.iso /mnt/matlab

创建安装配置文件:

1
2
3
4
5
6
# tee /usr/local/Matlab/installer_input.txt &> /dev/null << EOF
destinationFolder=/usr/local/Matlab/R2020a
fileInstallationKey=09806-07443-53955-64350-21751-41297
agreeToLicense=yes
outputFile=/usr/local/Matlab/matlab_install.log
EOF

删除压缩包,确保安装目录剩余26.86g:

1
# rm -rf /root/Matlab_R2020a_Lin64.tar.gz

安装:

1
# /mnt/matlab/install -inputFile /usr/local/Matlab/installer_input.txt

查看日志:

1
# tail -f /usr/local/Matlab/matlab_install.log

卸载镜像:

1
# umount /mnt/matlab/

删除挂载目录:

1
# rm -rf /mnt/matlab/

复制license:

1
# cp /root/Matlab_Crack/*.lic /usr/local/Matlab/license

备份文件:

1
# tar -czf /usr/local/Matlab/R2020a/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so.bak.tar.gz /usr/local/Matlab/R2020a/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so --remove-files

复制替换的.so文件:

1
2
# cp Matlab_Crack/libmwlmgrimpl.so /usr/local/Matlab/R2020a/bin/glnxa64/matlab_startup_plugins/lmgrimpl/
# chmod 555 /usr/local/Matlab/R2020a/bin/glnxa64/matlab_startup_plugins/lmgrimpl/libmwlmgrimpl.so

创建激活配置文件:

1
2
3
4
5
# tee /usr/local/Matlab/activate.ini &> /dev/null << EOF
isSilent=true
activateCommand=activateOffline
licenseFile=/usr/local/Matlab/license/license_standalone.lic
EOF
1
# chmod 444 /usr/local/Matlab/activate.ini

激活:

1
# /usr/local/Matlab/R2020a/bin/activate_matlab.sh -propertiesFile /usr/local/Matlab/activate.ini

成功显示:Silent activation succeeded.

添加matlab环境变量:

1
2
3
# vi /etc/profile
# 尾行,添加配置
export PATH=$PATH:/usr/local/Matlab/R2020a/bin
1
# source /etc/profile

编写测试脚本:

1
2
3
4
5
# cat > matlab_test.m << EOF
a=[1,2,3;4,5,6;7,8,9];
b=[2;3;3];
a*b
EOF

启动报错:

1
2
3
4
5
# matlab 
MATLAB is selecting SOFTWARE OPENGL rendering.
Unexpected exception: 'N7mwboost16exception_detail10clone_implINS0_39current_exception_std_exception_wrapperISt13runtime_errorEEEE: Bundle#11 start failed: libXt.so.6: cannot open shared object file: No such file or directory' in createMVMAndCallParser phase 'Creating local MVM'

MATLAB: management.cpp:702: find: Assertion `find: no active context for type 'services::io::TypedMLStream<(mlutil::io::StreamTypeEnum)1>'' failed.

安装软件:

1
# yum install -y xorg-x11-server-utils

启动成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
# matlab 
MATLAB is selecting SOFTWARE OPENGL rendering.

< M A T L A B (R) >
Copyright 1984-2020 The MathWorks, Inc.
R2020a (9.8.0.1323502) 64-bit (glnxa64)
February 25, 2020


To get started, type doc.
For product information, visit www.mathworks.com.

>>

测试:

1
2
3
4
5
6
7
8
9
>> matlab_test

ans =

17
41
65

>> exit

非交互式测试:

1
2
3
4
5
6
7
# matlab -batch matlab_test

ans =

17
41
65