Linux Ubuntu安装netcdf4.4

1. Fortran编译器是Intel的ifort,终端中输入:

export CC=icc
export CXX=icpc
export FC=ifort
export F90=ifort
export F77=ifort

由于安装netcdf4需要zlib和hdf5,我们将把这些安装在同一个目录下,方便后面的环境变量配置

2. 安装zlib

下载地址:ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/

解压 tar -zxvf zlib-1.2.8.tar.gz

配置安装信息:./configure --prefix=/usr/local/netcdf4-needed

编译:make

检查:make check

安装:make install

安装完成之后会在/usr/local/netcdf4-needed这个目录下生成三个文件lib include share

3.安装szip

下载地址:ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/

解压 tar -zxvf slib-2.1.tar.gz

配置安装信息:./configure --prefix=/usr/local/netcdf4-needed

编译:make

检查:make check

安装:make install

安装完成之后会在/usr/local/netcdf4-needed这个目录下生成三个文件lib include share

4.安装hdf5

下载地址:ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/

解压 tar -zxvf hdf5-1.8.13.tar.gz

配置安装信息. ./configure --prefix=/usr/local/netcdf4-needed --with-zlib=/usr/local/netcdf4-needed/

编译:make

检查:make check

安装:make install

5.安装netcdf-c

下载地址 ftp://ftp.unidata.ucar.edu/pub/netcdf/old/

解压 tar -zxvf netcdf-4.3.2.tar.gz

配置安装信息 CPPFLAGS=-I/usr/local/netcdf4-needed/include LDFLAGS=-L/usr/local/netcdf4-needed/lib ./configure --prefix=/usr/local/netcdf4-needed --disable-dap

编译:make

检查:make check

安装:make install

6.安装netcdf-fortran

告知库文件位置.终端中输入 export LD_LIBRARY_PATH=/usr/local/netcdf4-needed/lib:$LD_LIBRARY_PATH

解压tar -zxvf netcdf-fortran-4.4.0.tar.gz

配置安装信息 CPPFLAGS=-I/usr/local/netcdf4-needed/include LDFLAGS=-L/usr/local/netcdf4-needed/lib ./configure --prefix=/usr/local/netcdf4-needed --disable-dap

编译:make

检查:make check

安装:make install

7.环境变量,bashrc中添加

#netcdf4.4
export NETCDF=/usr/local/netcdf4-needed
export PATH=$NETCDF/bin:$PATH
export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH
export CPPFLAGS='-I/usr/local/netcdf4-needed/include'
export LDFLAGS='-L/usr/local/netcdf4-needed/lib'

终端运行source ~/.bashrc

你可能感兴趣的:(环境配置)