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

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令进入安装目录并解压软件包。

```
cd
/path/to/
SWAN
tar -zxvf swan4131.tar.gz
cd swan4131
```


3. 执行以下命令修改“platform.pl”文件。

  a. 打开“platform.pl”文件。

```
vim platform.pl
```


  b. 按“i”进入编辑模式。
    修改第406行：

```
print OUTFILE "F90_MPI = mpifort\n";
```


    修改第414行：

```
print OUTFILE "NETCDFROOT =/path/to/NETCDF\n";
```


    将第788行修改为“$compiler = "gfortran";”
    ：

```
782 sub getcmpl {
784    my $compiler = $ENV{'FC'};
786    unless ( $compiler ) {
787       foreach ('ifort','gfortran','f90','ifc','efc','pgf90','xlf90', 'lf95','g95') {
788          $compiler = "gfortran";
789          my $path  = `which $compiler`;
790          last if $path;
791       }
792    }
793
794    return $compiler;
795 }
```


  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
4. 执行以下命令生成配置文件。

```
make config
```


5. 执行以下命令生成“swan.exe”可执行文件。

```
make mpi
```
