创建环境变量

操作步骤

  1. 使用PuTTY工具,以root用户登录服务器。
  2. 执行以下命令创建环境变量文件“env.sh”

    1. 创建环境变量文件“env.sh”
      vi /root/env.sh
    2. 按“i”进入编辑模式,编写“env.sh”文件。
      #!/bin/bash
      export GNU_HOME=/path/to/GNU
      export MPI_HOME=/path/to/OPENMPI 
      export HDF5=/path/to/HDF5
      export PNETCDF=/path/to/PNETCDF
      export NETCDF=/path/to/NETCDF 
      export PHDF5=$HDF5
      export CPPFLAGS=" -I$HDF5/include -I$PNETCDF/include -I$NETCDF/include -I$MPI_HOME/include "
      export CFLAGS=" -I$HDF5/include -I$PNETCDF/include -I$NETCDF/include -I$MPI_HOME/include "
      export CXXFLAGS=" -I$HDF5/include -I$PNETCDF/include -I$NETCDF/include -I$MPI_HOME/include "
      export FCFLAGS=" -I$HDF5/include -I$PNETCDF/include"
      export FFLAGS=" -I$HDF5/include -I$PNETCDF/include"
      export LDFLAGS=" -L$HDF5/lib -L$PNETCDF/lib -L$NETCDF/lib"
      export LD_LIBRARY_PATH=$HDF5/lib:$PNETCDF/lib:$NETCDF/lib:$MPI_HOME/lib: $GNU_HOME/lib64:$LD_LIBRARY_PATH
      export PATH=$NETCDF/bin:$PNETCDF/bin:$MPI_HOME/bin:$GNU_HOME/bin:$PATH
    3. 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。

  3. 执行以下命令配置文件生效。

    source /root/env.sh