module软件管理工具的使用

module软件管理工具的使用

1.简介

Typically users initialize their environment when they log in by setting environment information for every application they will reference during the session. The Environment Modules package is a tool that simplify shell initialization and lets users easily modify their environment during the session with modulefiles.
更多信息,可以前往 module官网了解。

2.安装

yum install environment-modules

默认的modulefile路径设置在/usr/share/Modules/init/.modulespath文件中。
手动修改modulefiles路径,则使用MODULEPATH环境变量:export MODULEPATH=/opt/modulefiles
软件的配置文件则均存放在/opt/modulefiles中。

3.使用

1.查看当前module里已预装的软件:module avail

[user@localhost ~]$ module load 
-------------------------------------------------------- /public/software/modulefiles ---------------------------------------------------------
anaconda2/py2716_tf2.0 cdf/38_1-dist          gcc/6.5.0			     intel/2017u5           root/5.34.14          
binutils/2.27          cmake/3.21.3           glibc/2.14             python/2.7.18          scons/2.3.6
boost/1.65.0           fftw/3.3.7             gsl/2.6                python/3.10.5          singularity/3.4.2

2.查看某软件详细的环境变量设置:module display xxx

[user@localhost ~]$ module display  gcc/6.5.0
-------------------------------------------------------------------
/public/software/modulefiles/gcc/6.5.0:

module-whatis	 loads the modules environment
conflict	 gcc
prepend-path	 PATH /public/software/gcc/6.5.0/bin
prepend-path	 INCLUDE /public/software/gcc/6.5.0/include
prepend-path	 LD_LIBRARY_PATH /public/software/gcc/6.5.0/lib
prepend-path	 LD_LIBRARY_PATH /public/software/gcc/6.5.0/lib64
prepend-path	 LD_LIBRARY_PATH /public/software/gcc/6.5.0/libexec
setenv		 CC /public/software/gcc/6.5.0/bin/gcc
setenv		 CXX /public/software/gcc/6.5.0/bin/g++
setenv		 FC /public/software/gcc/6.5.0/bin/gfortran
-------------------------------------------------------------------

3.加载某软件环境:module load xxx

当前环境为默认的gcc,当加载gcc/6.5.0环境【module load gcc/6.5.0】后,可以看到gcc版本已变成6.5.0版本。

[user@localhost ~]$ which gcc  && gcc --version
/usr/bin/gcc
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
[user@localhost ~]$ module load gcc/6.5.0
[user@localhost ~]$ which gcc  && gcc --version
/public/software/gcc/6.5.0/bin/gcc
gcc (GCC) 6.5.0

4.查看已加载的环境环境:module list

加载完gcc环境后,此时执行【module list】,可以看到刚刚加载的gcc环境。

[user@localhost ~]$ module list
Currently Loaded Modulefiles:
  1) gcc/6.5.0

5.卸载某软件环境:module unload xxx

软件使用完成后,我们可以通过【module unload gcc/6.5.0】卸载该软件环境变量,执行完成后再次查看,软件已卸载了,gcc版本也已恢复成系统版本。

[user@localhost ~]$ module unload gcc/6.5.0
[user@localhost ~]$ module list
No Modulefiles Currently Loaded.
[user@localhost ~]$ which gcc  && gcc --version
/usr/bin/gcc
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

6.清空所有软件环境:module purge

如果已同时加载几个软件,可以使用【module purge】命令一键清空。

[user@localhost ~]$ module list
Currently Loaded Modulefiles:
  1) gcc/6.5.0              2) python/2.7.14_gcc650
[user@localhost ~]$ module purge
[user@localhost ~]$ module list
No Modulefiles Currently Loaded.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值