WSL使用Ubuntu 24.04安装Libradtran
ubuntu 24.04 wsl版本的下载地址:
https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/noble/
第一步,终端进行更新操作:
sudo apt update
sudo apt upgrade
第二步,安装必要的包:
sudo apt-get install make cmake m4
sudo apt install build-essential
sudo apt-get install gfortran gcc
sudo apt-get install flex bison
sudo apt install perl
第三步,安装库
先设置系统环境变量
vim ~/.bashrc
把光标移到最后一行,插入下面的环境变量:
export NETCDF=/home/你的用户名/netcdf
export PATH=NETCDF/bin:{NETCDF}/bin:NETCDF/bin:PATH
export LD_LIBRARY_PATH=NETCDF/lib:{NETCDF}/lib:NETCDF/lib:{LD_LIBRARY_PATH}
export LD_RUN_PATH=NETCDF/lib:{NETCDF}/lib:NETCDF/lib:{LD_RUN_PATH}
export CPPFLAGS=-I/home/你的用户名/netcdf/include
export LDFLAGS=-L/home/你的用户名/netcdf/lib
复制粘贴以后,按下键退出编辑,输入“:wq”退出保存;
source ~/.bashrc 使环境变量生效。
安装gsl
tar –xvf gsl-2.7.tar.gz
cd gsl-2.7
./configure --prefix=/home/你的用户名/netcdf
make
make install
zlib
tar –xvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/home/你的用户名/netcdf
make
make install
hdf5
tar -xvf hdf5-1.10.1.tar.gz
cd hdf5-1.10.1
./configure --with-zlib=/home/你的用户名/netcdf --prefix=/home/你的用户名/netcdf
make
make install
curl
tar -xvf curl-7.55.1.tar.gz
cd curl-7.55.1
./configure --with-zlib=/home/你的用户名/netcdf --prefix=/home/你的用户名/netcdf
make
make install
netcdf-c
tar -xvf netcdf-c-4.8.0.tar.gz
cd netcdf-c-4.8.0
./configure --prefix=/home/你的用户名/netcdf
make
make install
netcdf-fortran
tar -xvf netcdf-fortran-4.5.3.tar.gz
cd netcdf-fortran-4.5.3
./configure --prefix=/home/你的用户名/netcdf
make
make install
最后是安装libRadtran
首先需要先新建一个文件夹用于安装libRadtran,如可以使用mkdir /home/你的用户名/librad
tar -xvf libradtran-2.0.5.tar.gz
cd libRadtran-2.0.5
./configure --prefix=/home/你的用户名/librad
make
make install
make check
安装完成之后,修改环境变量,具体设置如下: 先使用vim ~/.bashrc命令打开配置文件
export LIBRAD=/home/你的用户名/librad
export DATA=LIBRAD/share/libRadtran/dataexportINP={LIBRAD}/share/libRadtran/data export INP=LIBRAD/share/libRadtran/dataexportINP={LIBRAD}/share/libRadtran/examples
export PATH=LIBRAD/bin:{LIBRAD}/bin:LIBRAD/bin:PATH
export LD_LIBRARY_PATH=LIBRAD/lib:{LIBRAD}/lib:LIBRAD/lib:{LD_LIBRARY_PATH}
export LD_RUN_PATH=LIBRAD/lib:{LIBRAD}/lib:LIBRAD/lib:{LD_RUN_PATH}
插入完成后,使用source ~/.bashrc来是配置生效。