linux系统当中源码安装R,无root权限安装

1.安装zlib1.2.5版本及以上 cd zlib-1.2.11 ./configure --prefix =/share/work/biosoft/zlib make make install 2.安装bzip cd bzip2-1.0.6 make -f Makefile-libbz...
R当中有很多包,这些包之间有很多依赖关系,如果不是最新版本的R,在安装R各种包的时候,就会默认安装一些低版本的包。有些包更新频繁,例如:clusterprofile,如果你的R版本太低就只能安装低版本的,或者有些包根本安装不上去,所以必须更新一下自己linux 上的R版本了,这里我源码安装了一下R最新版本,分享一下。

一、安装依赖库:
1.安装zlib1.2.5版本及以上
cd zlib-1.2.11 ./configure --prefix =/share/work/biosoft/zlib make make install
2.安装bzip
cd bzip2-1.0.6 make -f Makefile-libbz2_so 修改Makefile 中的PREFIX=/share/work/biosoft/bzip2 make && make install
3.安装liblzma5.0.3版本及以上
cd xz-5.2.3 ./configure -prefix=/share/work/biosoft/xz make make install
4.安装pcre
tar -zxvf pcre-8.41.tar.gz cd pcre-8.41 ./configure --enable-utf --enable-unicode-properties --enable-jit --disable-cpp --prefix /share/work/biosoft/pcre##这个包的安装参数是有要求的,因此用的是官方文档的推荐命令 make make install
5.安装libcurl7.22.0及以上,但是不要超过版本8
tar -zxf curl-7.28.0.tar.gz cd curl-7.28.0 ./configure --prefix=/share/work/biosoft/curl make make install

二、安装R
提高GCC版本编译R,如果你的gcc版本太低有些包是安装不成功的,比如fgsea这个包,我这里用的是v6.4.0,我系统自带的4.4.7的编译安装的R在安装fgsea的时候就会报错;
1,设置环境变量:
export PATH=/share/work/biosoft/gcc/gcc-v6.4.0/bin/:$PATH
export LD_LIBRARY_PATH=/share/work/biosoft/gcc/gcc-v6.4.0/lib64/:$LD_LIBRARY_PATH
我这里的LD_LIBRARY_PATH:注意把/share/work/biosoft/gcc/gcc-v6.4.0/lib64/添加进去:
LD_LIBRARY_PATH=/share/work/biosoft/gcc/gcc-v6.4.0/lib64/:/share/work/biosoft/mpc/mpc-v1.0.2/lib/:/share/work/biosoft/cufflinks/samtools-0.1.18/htslib-1.3.2/htslib:/share/work/biosoft/samtools/htslib/:/share/work/biosoft/lib/atlas/:/share/work/biosoft/lib:/share/work/biosoft/Root/root/lib/:/share/work/biosoft/gsl/gsl-2.1/lib/:/share/work/biosoft/gcc/gcc-v4.7.3/lib64/:/share/work/biosoft/zlib/lib/:/share/work/biosoft/boost/boost.1.50/lib:/share/work/biosoft/xz/xz-v5.2.3/lib:/opt/gridengine/lib/linux-x64:/opt/openmpi/lib:/opt/python/lib

2,设置R默认的GCC 最后两行:

编辑这个文件添加最后两行指定gcc:~/.R/Makevars
F77 = /usr/bin/gfortran
FC = $F77
FLIBS = -L/usr/bin/gfortran
CC=/share/work/biosoft/gcc/gcc-v6.4.0/bin/gcc
CXX=/share/work/biosoft/gcc/gcc-v6.4.0/bin/g++

3,配置R编译:
./configure --prefix=/share/work/biosoft/R/R-v3.5.0 --with-gnu-ld --with-cairo --with-x --enable-R-shlib --with-jpeglib --with-readline --with-tcltk --with-blas --with-lapack --enable-R-profiling --enable-memory-profiling CPPFLAGS="-I/share/work/biosoft/zlib/include -I/share/work/biosoft/bzip2/bzip2-v1.0.6/include/ -I/share/work/biosoft/xz/xz-v5.2.3/include -I/share/work/biosoft/pcre/pcre-v8.38/include -I/share/work/biosoft/curl/curl-v7.47.1/include" LDFLAGS="-L/share/work/biosoft/bzip2/bzip2-v1.0.6/lib/ -L/share/work/biosoft/zlib/lib/ -L/share/work/biosoft/xz/xz-v5.2.3/lib -L/share/work/biosoft/pcre/pcre-v8.38/lib -L/share/work/biosoft/curl/curl-v7.47.1/lib"

4,make之前添加一个参数:
inserted -fPIC as a CFLAG in the Makefile
添加:CFLAG = -fPIC
5,之后就可以make &install


  • 发表于 2018-06-02 18:03
  • 阅读 ( 5437 )
  • 分类:R

0 条评论

请先 登录 后评论
omicsgene
omicsgene

生物信息

698 篇文章

作家榜 »

  1. omicsgene 698 文章
  2. 安生水 347 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. xun 82 文章
  6. 红橙子 78 文章
  7. rzx 74 文章
  8. CORNERSTONE 72 文章