自己按照网上的安装教程摸索了很久还是遇到了问题,无奈只能使用钞能力,顺便自己也记录一下这个昂贵的安装教程(自己又摸索着在新电脑上安装了一遍),和网上的略有差别,可以结合别的帖子一起作为参考
用到的教程主要是气象家园上的帖子:
教程:ubuntu14.10下安装最新版本WRF+WPS+ARWpost+GrADS等软件
教程:Win7 64位+虚拟机VMware12+ubuntu17.04 下安装WRF3.6
教程:WRF 3.9.1.1 在Ubuntu16.04 LTS 下的安装包括Chem kpp
UbuntuKylin15.10下的WRF3.7.1的配置教程
需要提前下载好的文件:zlib、szip、hdf5、netcdf-c、netcdf-cxx4、netcdf-fortran、mpich、jasper、libpng、geog、WPS、WRF
本次用到的版本是:zlib-1.2.11.tar.gz、szip-2.1.1.tar.gz、hdf5-1.10.5.tar.gz、netcdf-c-4.7.2.tar.gz、netcdf-cxx4-4.3.0.tar.gz、netcdf-fortran-4.5.2.tar.gz、mpich-4.1.tar.gz、jasper-1.701.0.tar.gz、libpng-1.2.12.tar.gz、geog_high_res_mandatory.tar.gz、WPS-4.2.tar.gz、WRF-4.2.tar.gz
下载可以参考:
libjpeg库:http://www.ijg.org/files/jpegsrc.v9c.tar.gz
zlib库:1. http://www.zlib.net/zlib-1.2.11.tar.gz
2. Download zlib-1.2.11.tar.gz (LIBPNG: PNG reference library)
libpng库:1.Download libpng-1.6.35.tar.gz (LIBPNG: PNG reference library)
2.Download libpng-1.6.35.tar.gz (LIBPNG: PNG reference library)
JasPer库:http://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip
其他JasPer版本:http://www.ece.uvic.ca/~frodo/jasper/#download
HDF5库:HDF5® Source Code - The HDF Group
NETCDF库:netCDF Downloads
0.复制文件
cd/
mkdir apps
cd apps
mkdir src
cd src
cp /(文件路径)/zlib-1.2.11.tar.gz ./
cp /(文件路径)/szip-2.1.1.tar.gz ./
cp /(文件路径)/hdf5-1.10.5.tar.gz ./
cp /(文件路径)/netcdf-* ./
cp /(文件路径)/mpich-4.1.tar.gz ./
cp /(文件路径)/jasper-1.701.0.tar.gz ./
cp /(文件路径)/libpng-1.2.12.tar.gz ./
ls
#确认一下hdf5-1.10.5.tar.gz、libpng-1.2.12.tar.gz、netcdf-c-4.7.2.tar.gz、netcdf-fortran-4.5.2.tar.gz、zlib-1.2.11.tar.gz、jasper-1.701.0.tar.gz、mpich-4.1.tar.gz、netcdf-cxx4-4.3.0.tar.gz、szip-2.1.1.tar.gz这些文件都已被成功复制到scr文件夹下
1.安装zlib
tar zxfv zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/apps
make
make install
cd ../
2.安装szip
tar zxfv szip-2.1.1.tar.gz
cd szip-2.1.1
./configure --enable-shared --prefix=/apps
make
make install
cd ../
3.安装hdf5
tar zxfv hdf5-1.10.5
cd hdf5-1.10.5
./configure --with-zlib=/apps --with-szlib=/apps --enable-shared --prefix=/apps
make
make install
cd ../
4.安装netcdf-c
tar zxfv netcdf-c-4.7.2.tar.gz
cd netcdf-c-4.7.2
./configure CPPFLAGS=-I/apps/include LDFLAGS=-L/apps/lib --enable-shared --prefix=/apps
make
make install
cd ../
如果configure报错:configure: error: curl required for remote access. Install curl or build with --disable-dap.
则:
sudo apt-get install libcurl4-openssl-dev
如果configure报错:configure: error: Cannot find m4 utility. Install m4 and try again.
则:
sudo apt-get install m4
然后再重新configure一次
5.安装netcdf-fortran
tar zxfv netcdf-fortran-4.5.2.tar.gz
cd netcdf-fortran-4.5.2
export LD_LIBRARY_PATH=/apps/lib:${LD_LIBRARY_PATH}
./configure CPPFLAGS=-I/apps/include LDFLAGS=-L/apps/lib --enable-shared --prefix=/apps
make
make install
cd ../
如果configure报错:configure: error: Can't find F90 compiler.
则:
apt-get install gfortran
补充:降低gcc、g++和gfortran的版本
参考帖子:GAMIT安装报错:Type mismatch / Rank mismatch
#下载9版本
sudo apt-get install gcc-9
sudo apt-get install g++-9
sudo apt-get install gfortran-9
#调整gcc-11的优先级为40,gcc-9的优先级为100
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
#调整g++-11的优先级为40,g++-9的优先级为100(可能报错)
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 40
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
#调整gfortran-11的优先级为40,gfortran-9的优先级为100
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-11 40
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-9 100
6.安装netcdf-cxx4
tar zxfv netcdf-cxx4-4.3.0.tar.gz
cd netcdf-cxx4-4.3.0
./configure CPPFLAGS=-I/apps/include LDFLAGS=-L/apps/lib --enable-shared --prefix=/apps
make
make install
cd ../
7.安装mpich
tar zxfv mpich-4.1.tar.gz
cd mpich-4.1
./configure --prefix=/apps
make
#(非常久,大约30min)
make install
cd ../
8.安装libpng
tar zxfv libpng-1.2.12.tar.gz
cd libpng-1.2.12
./configure --enable-shared CPPFLAGS=-I/apps/include LDFLAGS=-L/apps/lib --prefix=/apps
make
make install
cd ../
9.安装jasper
tar zxfv jasper-1.701.0.tar.gz
cd jasper-1.701.0
./configure --enable-shared CPPFLAGS=-I/apps/include LDFLAGS=-L/apps/lib --prefix=/apps
make
make install
cd ../
10.安装WRF
mkdir WRFV4
cd WRFV4
cp /home/jiumy/WRFpakg/WRF-4.2.tar.gz ./
cp /home/jiumy/WRFpakg/WPS-4.2.tar.gz ./
tar zxfv WRF-4.2.tar.gz
cd WRF-4.2
gedit ~/.bashrc
文末输入:
export NETCDF=/apps
export NETCDF_LIB=${NETCDF}/libgesh
export NETCDF_INC=${NETCDF}/include
export PATH=${NETCDF}/bin:$PATH
export LD_LIBRARY_PATH=${NETCDF_LIB}:${LD_LIBRARY_PATH}
(补充:也有用下面这个版本,但我尝试失败,因此不建议
export NETCDF=/apps
export NCARG_ROOT=/apps
export LD_LIBRARY_PATH=/apps/lib:${LD_LIBRARY_PATH}
export PATH=/apps/bin:${PATH}
补充完毕。)
source ~/.bashrc
ncdump
./configure
34
1
./compile
如果报错:bash: ./compile: /bin/csh: 错误的解释器: 没有那个文件或目录
则安装csh即可:
sudo apt-get install csh
./compile -j 4 em_real
#(比较久,大约5-10min)
cd ../
mv WRF-4.2 WRF
11.安装WPS
tar zxfv WPS-4.2.tar.gz
cd WPS-4.2
./configure
3
#终端窗口不要关闭
12.安装GEOG
#另开一个终端窗口
cd WRFV4
mkdir GEOG
cd GEOG
cp /(文件路径)/geog_high_res_mandatory.tar.gz ./
tar zxfv geog_high_res_mandatory.tar.gz
#放置即可,回到上一步的终端窗口
gedit configure.wps
#第60行:-L/glade/u/home/wrfhelp/UNGRIB_LIBRARIES/lib -ljasper -lpng -lz
#改为:
-L/apps/lib -ljasper -lpng -lz
#第61行:-I/glade/u/home/wrfhelp/UNGRIB_LIBRARIES/include
#改为:
-I/apps/include
./compile
rm *gz
mv WPS-4.2/ WPS
完成。
历时五个月终于装上WRF了。
彩蛋
朋友锐评: