---
title: GNU安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/instg-osc/kunpenghpcenv_012.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/instg-osc/kunpenghpcenv_012.html
indexId: 267087cb3c62edfdb03e27aeb83c4c21d8c34452d7c8aa36cbfce47451c8e62a65
---
# GNU安装

#### 操作步骤

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

```
tar -vxf gcc-9.3.0.tar.xz
```


3. 执行以下命令进入GNU源码目录。

```
cd gcc-9.3.0
```


4. 执行以下命令进行编译安装。

```
./configure --disable-multilib --enable-languages="c,c++,fortran"  --prefix=
/path/to/GNU
--disable-static --enable-shared --with-gmp=
/path/to/GMP
--with-mpfr=
/path/to/MPFR
--with-mpc=
/path/to/MPC
make
make install
```


5. 执行以下命令加载环境变量。

```
export PATH=
/path/to/GNU
/bin:$PATH
export LD_LIBRARY_PATH=
/path/to/GNU
/lib64:$LD_LIBRARY_PATH
```
