Add something similar to .bashrc
*Note you will need to modify the paths for your specific environment. *Note this includes a setting to the path for “DIR.” This is just for the sake of simplifying installation.**
export PATH=.:/*full-path-to-netcdf-directory*/netcdf/bin:/*full-path-to-libs-directory/*bin:${PATH}
export LD_LIBRARY_PATH=/*full-path-to-libs-directory*/libs/lib:/*full-path-to-libs-directory*/libs/netcdf/lib:/*full-path-to-libs-directory*/libs/grib2/lib
export JASPERLIB=/*full-path-to-libs-directory*/libs/grib2/lib
export JASPERINC=/*full-path-to-libs-directory*/libs/grib2/include
export NETCDF=/*full-path-to-netcdf-directory*/netcdf
export DIR=/*full-path-to-libs-directory*/libs
export CC=gcc
export CXX=g++
export FC=gfortran
export FCFLAGS="-m64"
export F77=gfortran
export FFLAGS="-m64"
export LDFLAGS="-L/*full-path-to-libs-directory*/libs/lib -L/*full-path-to-libs-directory*/libs/netcdf/lib -L/*full-path-to-libs-directory*/libs/grib2/lib"
export CPPFLAGS="-I/*full-path-to-libs-directory*/libs/include -I/*full-path-to-libs-directory*/libs/netcdf/include -I/*full-path-to-libs-directory*/libs/grib2/include"
Source the .bashrc file
source .bashrc
Make a directory to install all the libraries.
mkdir libs
mpich
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz
tar -xf mpich-3.0.4.tar.gz
cd mpich-3.0.4
./configure --prefix=$DIR
make 2>&1
make install
cd ..
rm -rf mpich*
zlib
wget https://www2.mmm.ucar.edu/people/duda/files/mpas/sources/zlib-1.2.11.tar.gz
tar xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=$DIR/grib2
make -j 4
make install
cd ..
rm -rf zlib*
HDF5
wget https://www2.mmm.ucar.edu/people/duda/files/mpas/sources/hdf5-1.10.5.tar.bz2
tar -xf hdf5-1.10.5.tar.bz2
cd hdf5-1.10.5
./configure --prefix=$DIR --with-zlib=$DIR/grib2 --enable-fortran --enable-shared
make -j 4
make install
cd ..
rm -rf hdf5*
NetCDF-c
wget https://github.com/Unidata/netcdf-c/archive/v4.7.2.tar.gz
tar -xf v4.7.2.tar.gz
cd netcdf-c-4.7.2
./configure --enable-shared --enable-netcdf4 --disable-filter-testing --disable-dap --prefix=$DIR/netcdf
make -j 4
make install
cd ..
rm -rf v4.7.2.tar.gz netcdf-c*
netcdf-fortran
export LIBS=”-lnetcdf -lhdf5_hl -lhdf5 -lz”
wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.2.tar.gz
tar -xf v4.5.2.tar.gz
cd netcdf-fortran-4.5.2
./configure --enable-shared --prefix=$DIR/netcdf
make -j 4
make install
cd ..
rm -rf netcdf-fortran* v4.5.2.tar.gz
libpng
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz
tar xzvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
./configure --prefix=$DIR/grib2
make -j 4
make install
cd ..
rm -rf libpng*
jasper
wget https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz
tar xzvf jasper-1.900.1.tar.gz
cd jasper-1.900.1
./configure --prefix=$DIR/grib2
make -j 4
make install
cd ..
rm -rf jasper*
WRF
git clone --recurse-submodule https://github.com/wrf-model/WRF.git
cd WRF
./configure (choose options 34 and 1)
./compile em_real -j 4 >& log.compile
WPS
git clone https://github.com/wrf-model/WPS.git
cd WPS
export WRF_DIR=path-to-WRF-top-level-directory/WRF
./configure (choose option 1)
./compile >& log.compile
https://forum.mmm.ucar.edu/threads/full-wrf-and-wps-installation-example-gnu.12385/