Docker容器内安装MATLAB---以静默方式安装

一、准备文件和安装包

1.本次介绍是在容器里安装R2022a_Linux,环境信息为一个镜像、MATLAB的ISO文件等。

基础文件

 2.配置静默安装文件

#Descriptive information
#This is to tell the installation script that you agree to the terms of the installation
agreeToLicense=yes
#Here's how to fill in the key
fileinstallationKey=50874******14209-*******33348-
#This tells the installation script where you want to install it
destinationFolder=/matlab
#Here's how to tell the installation script where your license file is in license.lic
licensePath=/store/license.lic
#Here is to tell the installation script what you want to install
product.Embedded_Coder
product.MATLAB
product.Simulink
product.Simulink_Coder
product.Stateflow

二、配置容器

1.创建容器

  • run :创建一个新的容器并运行一个命令

  • -d 后台运行容器,并返回容器ID

  • -i: 以交互模式运行容器,通常与 -t 同时使用;

  • --privileged=true是要以root权限启动容器

 2.在容器里创建文件用于存放MATLAB

进入容器,执行命令mkdir -p matlab/store

在matlab文件夹里存放R2022a_Linux.iso解压后的文件

在store里存放install_input.txt、license.lic、libmwlmgrimpl.so

 3.使用命令将本地的文件拷贝至容器里

#使用docker cp进行拷贝,将install_input.txt拷贝至store
docker cp ./installer_input.txt e271602be:/matlab/store/
docker cp ./libmwlmgrimpl.so e271602be:/matlab/store/
docker cp ./license.lic e271602be:/matlab/store/
docker cp ./R2022a_Linux.iso e271602be:/matlab/

docker cp用于主机与容器之间的数据拷贝

docker cp [OPTIONS] PC_PATH|- CONTAINER:DEST_PATH

 三、安装MATLAB

1.安装解压文件用于解压iso文件

#在ubuntu容器当中需要先更新apt-get之后才能找到软件包
apt-get update
apt-get install -y p7zip-full

2.解压R2022a_Linux.iso 

7z x R2022a_Linux.iso  -o/matlab

3.替换installer_input.txt文件

mv /store/installer_input.txt /matlab

替换文件可以有多种方式,这里使用mv直接将原始文件覆盖掉

4. 修改matlab文件夹的权限

chmod a+x -R /matlab

5.使用静默的方式安全matlab

cd /matlab
./install -inputFile ./install_input.txt

6.验证

mv matlab/bin/glnxa64/matlab_startup_plugins/lmgrimpl
rm -r libmwlmgrimpl.so
mv /store/libmwlmgrimpl.so ./

7.运行matlab

cd /matlab/bin
./matlab -nodisplay

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值