---
title: 安装R-4.2.0
description: "1. 执行以下命令下载R语言源码包。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/kunpengwgcna_02_0006.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/prtg-osc/kunpengwgcna_02_0006.html
indexId: 0358b2b438a7c0dd7c94f960386cca3dc5954cbcada97c3362ad3deb20078b1167
---
# 安装R-4.2.0

#### 操作步骤

1. 执行以下命令下载R语言源码包。

```
cd
/path/to/WGCNA
wget https://cran.r-project.org/src/base/R-4/R-4.2.0.tar.gz
```


2. 执行以下命令解压安装包并进入解压后的目录。

```
tar xvf R-4.2.0.tar.gz
cd R-4.2.0
```


3. 执行以下命令安装依赖。

```
yum install libXt-devel libX11-devel readline-devel
```


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

```
./configure --prefix=
/path/to/WGCNA
/R_install
make
make install
```


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

```
export PATH=
/path/to/WGCNA
/R_install/bin:$PATH
export LB_LIBRARY_PATH=
/path/to/WGCNA
/R_install/lib/R/lib:$ LB_LIBRARY_PATH
```


6. （可选）若用户当前网速较慢，可执行以下命令添加R语言的镜像源。

  a. 创建“~/.Rprofile”文件。

```
v
i
~
/.Rprofile
```


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

```
options("repos"= c(CRAN="http://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/")
```


  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
