---
title: 编译和安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/openmind_kunpengwavewatch_02_0011.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/prtg-osc/openmind_kunpengwavewatch_02_0011.html
indexId: ca8ef91b13edd7a895d9c736a6ea1670efb7c0e01b094f72272a7add5db12a7180
---
# 编译和安装

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令进入WAVEWATCH III安装目录。

```
cd
/path/to/WAVEWATCH
```


3. 执行以下命令解压WAVEWATCH III源码包。

```
tar -xvf WW3-6.07.1.tar.gz
```


4. 执行以下命令进入解压后的目录。

```
cd WW3-6.07.1
```


5. 执行以下命令创建环境变量文件。

  a. 创建环境变量文件。

```
vi env_ww3.sh
```


  b. 按“i”进入编辑模式，添加如下内容。

```
############# clang + hypermpi #################
export PATH=/opt/compiler/bisheng-compiler-1.3.3-aarch64-linux/bin:$PATH
export LD_LIBRARY_PATH=/opt/compiler/bisheng-compiler-1.3.3-aarch64-linux/lib:$LD_LIBRARY_PATH
export PATH=/path/to/hypermpi/hmpi/bin:/path/to/hypermpi/ucx/bin:$PATH
export LD_LIBRARY_PATH=/path/to/hypermpi/hmpi/lib:/path/to/hypermpi/ucx/lib:$LD_LIBRARY_PATH############# netcdf #################
export NETCDF_DIR=
/path/to/NETCDF
export NETCDF_LIBDIR=$NETCDF_DIR/lib
export NETCDF_INCDIR=$NETCDF_DIR/include
export PATH=$NETCDF_DIR/bin:$PATH
export LD_LIBRARY_PATH=$NETCDF_LIBDIR:$LD_LIBRARY_PATH
export WWATCH3_NETCDF=NC4
export NETCDF_CONFIG=$NETCDF_DIR/bin/nc-config
############# metis #################
export METIS_PATH=
/path/to/METIS
export PATH=$METIS_PATH/bin:$PATH
export LD_LIBRARY_PATH=$METIS_PATH/lib:$LD_LIBRARY_PATH
```


  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
6. 执行以下命令加载环境变量。

```
source env_ww3.sh
```


7. 执行以下命令配置ww3参数，注意粗体部分。

```
./model/bin/w3_setup model/
```

```
*****************************
***   WAVEWATCH III setup     ***
*****************************
[INFO] local env file wwatch3.env created in /home/WW3-6.07.1/model/bin/wwatch3.env
Setup file /home/WW3-6.07.1/model/bin/wwatch3.env not found
Default set up :
Printer (listings)       :
printer
Auxiliary FORTRAN comp.  :
gfortran
Auxiliary C compiler     :
gcc
Scratch directory        :
/path/to/WAVEWATCH
/WW3-6.07.1/model/tmp
Save sources             :
yes
Save listings            :
yes
Update settings ? [y/n]
y
Creating new set-up :
Printer for listings [printer] :
Auxiliary FORTRAN compiler [gfortran] :
flang
Auxiliary C compiler [gcc] :
clang
Scratch space [/home/wdy/WW3-6.07.1/model/tmp] :
Save source code files (*.f)  [yes] :
Save listing files  [yes] :
Modified set up :
Printer (listings)       : printer
Auxiliary FORTRAN comp.  : flang
Auxiliary C compiler     : clang
Scratch directory        : /path/to/WAVEWATCH III/WW3-6.07.1/model/tmp
Save sources             : yes
Save listings            : yes
New settings OK ? [y/n] y
Setup makefile for auxiliary programs
……
Create required model subdirectories
Finished setting up WAVEWATCH III
```
