Lee wins registration - Lee wins Entertainment registered under Moudle introduction and use of tools

Lee wins under Linux Moudle Entertainment specified Registered Address: introduction and use of introduction and use of tools Moudle tools

I. Introduction

In Linux, when with an editor, runtime, and multiple versions of the software will need multiple versions in different scenes or personnel, configure the environment variables that content is a very tedious process, but the tool is Moudle provides a simple and fast way, Moudle called the module-environment, is a specialized management tool environment variable.

Second, the official website

Third, the installation

Moudle tools are based TCL (8.4 or later) of the tool, the tool is now 4.4.1 module, based versions tcl8.5 or higher, based on the version module3.X tcl8.4 version, installed RedHat6 series tcl 8.5 yum version.

Moudle tool can be used to compile binaries installed, you can use yum / apt quick installation,

Redhat/Centos使用:yum install environment-modules;

such as the use ubuntu: apt-get install environment-modules installed.

Fourth, the initialization

After installing the module tool, you will find it is not an executable binary file, you need a tool for module initialization. In / usr / share / modules / init (note here, may be module may be modules) You can find internal binary initialization file for each script, find your current script, source binary file, for example, you are a bash script , after the source / usr / share / modules / init / bash, you can use the module tool.

Five commonly used commands (via the command you can see why I foolishly regardless of the module and modules)

module avail display module may be used

module load / add load module

module unload / rm unload modules

module list display module has been loaded

After the entire module are configured, these four commands basically meet all requirements, and more detailed commands and use module, we will explain in a future article.

Sixth, the use of tools Moudle

Module tools relying on MODULEPATH this environment variable to locate the configuration directory, that you have set up your directory structure, the configuration environment variables, only need to set a module of this environment variable, then the module will automatically go to find this tool path All configuration information under.

Seven, Moudlefile wording

In Section VI we say that the role of MODULEPATH, then this section we talk about the directory structure and wording modulefile is the configuration file.

Usually we will content the same kind of software, libraries, etc. in the same directory, assuming that a directory named / soft, contains gcc, python, java and other tools commonly used in soft directory, gcc also contains 4.8.4,4.9.3 , three versions 4.9.7, python contains two versions 2.7,3.6, java contains three versions 1.6,1.7,1.8, its directory structure is as follows:

So soft directory is the directory MODULEPATH variable set, the rearmost version of the file is modulefile, we only need to install this directory format to create directories and files.

In several considerations when writing modulefile files, such as 4.8.4 I want to write this document, note that when the file gcc4.8.4 environment variable configuration file, not the storage path of gcc. It must be a file instead of a folder.

  1. Be sure to include the beginning of the file

#%Module1.0

This is to identify the file as modulefile, and without him the file will not be recognized

2, prepend-path environment variables to modify the path

This command will be added to the tool path environment variable front

3, setenv environment variable name value

This command will you need to configure environment variables to the system

Consider the following example: gcc / 4.8.4 (I install this tool in /software/gcc/4.8.4/)

#%Module1.0

setenv GCC_HOME /software/gcc/4.8.4/

prepend-path PATH /software/gcc/4.8.4/bin

This is after a gcc4.8.4 environment variable configuration, we will all environment variables configured using modue avail command to view the appropriate information as follows:

Use module load loads the appropriate tools and version

Use module list view loading tools and version

Use module show Tools / version to view the configuration information (very command)

At this time we can echo $ PATH to see whether to add the gcc path to the path PATH

Use echo $ GCC_HOME check whether they have set up this environment variable

This time on behalf of your directory settings, modulefile no problem, as long as the path to software / tools stored no problem, then can be used normally.

Eight, multipath

MODULEPATH multiple paths can be set, for example, I set / soft, storage path / soft1, / soft2 are the tools, software, scripts, then I can set MODULEPATH multiple paths, colon split between the paths.

This time we module avail to view information, you can see the following

Note: Do not appear software name and version of the same modulefile

Nine, the default version

In the module avail, we can set the default version, for example, I want to gcc 4.9.3 as the default version, when I module load gcc when directly loaded version 4.9.3, we can use this file to control .version default information.

Created in the same directory modulefile .version file, see, or in front of a point, worded as follows

#%Module1.0

set ModulesVersion "4.9.3"

Use module avail view information

In version 4.9.3 back one more (default)

We just delete loaded 4.8.4

Load the default version of gcc

Note: Due to moudle can only load similar tools, a repository, and deleted when you delete a direct reflection of tools, libraries can, and do not need to bring back the version number.

Ten, the global use

Due to the nature of the problem module, if used within a company, you may need to use all of the staff set up a unified initial script, either bash or csh, usually we recommend the establishment of a unified script files readable by the user, and then link to each using the initial script home directory staff.

For example, we build to create a unified file for the csh csh.cshrc. Link to zhangsan

ln -s csh.cshrc /home/zhangsan/.cshrc

We can join in a unified source ./cshrc.own initial script

So users only need to create a home directory file cshrc.own so-called personalized script file.

Guess you like

Origin www.cnblogs.com/laobeipai/p/12572755.html