Rate This Document
Findability
Accuracy
Completeness
Readability

Installing NetCDF

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Download the installation packages.
    cd /path/to/netcdf
    wget https://codeload.github.com/Unidata/netcdf-fortran/tar.gz/refs/tags/v4.4.5 -O netcdf-fortran-4.4.5.tar.gz
    wget https://codeload.github.com/Unidata/netcdf-c/tar.gz/refs/tags/v4.7.0 -O netcdf-c-4.7.0.tar.gz
  3. Decompress the NetCDF-C installation packages.
    tar xvf netcdf-c-4.7.0.tar.gz
    tar xvf netcdf-fortran-4.4.5.tar.gz
  4. Go to the directory generated after the decompression.
    cd netcdf-c-4.7.0
  5. Set the environment variables.
    export CC=mpicc CXX=mpicxx FC=mpifort
    export HDF5_DIR=/path/to/hdf5
    export PNETCDF_DIR=/path/to/pnetcdf
  6. Compile and install NetCDF-C.
    ./configure --prefix=/path/to/netcdf --build=aarch64-unknown-linux-gnu --enable-shared --enable-netcdf-4 --enable-dap --with-pic --disable-doxygen --enable-static --enable-pnetcdf --enable-largefile CPPFLAGS="-I${HDF5_DIR}/include -I${PNETCDF_DIR}/include" LDFLAGS="-L${HDF5_DIR}/lib -L${PNETCDF_DIR}/lib -Wl,-rpath=${HDF5_DIR}/lib -Wl,-rpath=${PNETCDF_DIR}/lib" CFLAGS="-L${HDF5_DIR}/lib -L${PNETCDF_DIR}/lib -I${HDF5_DIR}/include -I${PNETCDF_DIR}/include"
    make -j
    make install
  7. Set the environment variables.
    export PATH=/path/to/netcdf/bin:$PATH
    export LD_LIBRARY_PATH=/path/to/netcdf/lib:$LD_LIBRARY_PATH
    export NETCDF=/path/to/netcdf
  8. Compile and install NetCDF-Fortran.
    cd ../netcdf-fortran-4.4.5
    ./configure --prefix=/path/to/netcdf --build=aarch64-unknown-linux-gnu --enable-shared --with-pic --disable-doxygen --enable-largefile --enable-static CPPFLAGS="-I${HDF5_DIR}/include -I${NETCDF}/include" LDFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -Wl,-rpath=${HDF5_DIR}/lib -Wl,-rpath=${NETCDF}/lib" CFLAGS="-L${HDF5_DIR}/HDF5/lib -L${NETCDF}/lib -I${HDF5_DIR}/include -I${NETCDF}/include" CXXFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -I${HDF5_DIR}/include -I${NETCDF}/include" FCFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -I${HDF5_DIR}/include -I${NETCDF}/include"
    sed -i '11838c wl="-Wl,"' libtool
    make -j
    make install