The easiest way to get netCDF is through a package management program, such as rpm, yum, adept, and others. NetCDF is available from many different repositories, including the default Red Hat and Ubuntu repositories.
We no longer support pre-built binary distributions from Unidata.
After installing a binary distribution from one of the package management systems, you will end up with 4 subdirectories, lib, include, man, and bin.
The lib subdirectory holds the netCDF libraries (C, Fortran, and C++). The include directory holds the necessary netcdf.h file (for C), netcdf.inc (for Fortran), netcdfcpp.h (for C++), and the .mod files (for Fortran 90). The bin directory holds the ncgen, ncdump, nccopy, and nc-config utilities, and the man directory holds the netCDF documentation.
When compiling a netCDF program, you will have to tell the linker where to find the library (e.g. with the -L option of most C compilers), and you will also have to tell the C pre-processor where to find the include file (e.g. with the -I option). The nc-config utility can be used to determine the right options to use.
If you are using shared libraries, you will also have to specify the library location for run-time dynamic linking. See your compiler documentation. For some general information see the netCDF FAQ “How do I use shared libraries” at http://www.unidata.ucar.edu/netcdf/faq.html#using_shared.