• Welcome to LiuJason's Blog!

CentOS7下安装所有的R包|Install all R packages in CentOS7

Linux笔记 Jason 6 years ago (2019-04-11) 1884 Views 2 Comments QR code of this page

为了做R语言云计算服务,需要给服务器安装所有的R包,这样一来用户就不用担心安装和编译各种包的时候出现问题了。
打个小广告:一个月仅15元的R语言云计算服务

首先更新系统:
yum update -y

添加jag repo
vi /etc/yum.repos.d/jags.repo
#写入
[home_cornell_vrdc]
name=Sundry packages for scientific computing (CentOS_7)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/cornell_vrdc/CentOS_7/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/cornell_vrdc/CentOS_7//repodata/repomd.xml.key
enabled=1

给系统安装所有需要的Lib:
yum groups mark convert
yum install epel-release -y
yum groupinstall "Development tools" -y
yum install wget openblas java-1.8.0-openjdk-devel zlib-devel libicu-devel libpng-devel libcurl-devel libxml2-devel openssl-devel openmpi-devel numpy python-matplotlib netcdf4-python netcdf-devel netcdf python-pandas python-basemap proj-epsg proj-devel gdal-devel monitorix gnuplot ImageMagick librsvg2-devel libsodium-devel libwebp-devel cairo-devel hunspell-devel openssl-devel poppler-cpp-devel protobuf-devel mariadb-devel mysql-devel v8-devel redland-devel cyrus-sasl-devel libtiff-devel tcl-devel tk-devel xauth mesa-libGLU-devel glpk-devel libXt-devel gsl-devel fftw-devel bzip2-devel geos-devel gtk2-devel gtk3-devel libjpeg-turbo-devel jags4-devel bwidget blas-devel lapack-devel mpfr-devel unixODBC-devel libsndfile-devel udunits2-devel postgresql-devel libRmath-devel qt-devel libdb-devel octave-devel hiredis-devel poppler-glib-devel QuantLib-devel boost-devel czmq-devel ImageMagick-c++-devel file-devel opencl-headers gdal gdal-devel proj proj-devel proj-nad proj-epsg openssl-devel libcurl-devel postgresql-devel udunits2-devel libxml2-devel geos-devel libjpeg-turbo-devel libpng-devel udunits2-devel screen glpk-devel cairo-devel mesa-libGL-devel mesa-libGLU-devel freeglut-devel -y

#安装gdal2.0
wget http://s3.amazonaws.com/etc-data.koordinates.com/gdal-travisci/install-libkml-r864-64bit.tar.gz
tar xzf install-libkml-r864-64bit.tar.gz
sudo cp -r install-libkml/include/* /usr/local/include
sudo cp -r install-libkml/lib/* /usr/local/lib
sudo ldconfig
wget http://download.osgeo.org/gdal/2.2.3/gdal-2.2.3.tar.gz
tar xzf gdal-2.2.3.tar.gz
cd gdal-2.2.3
./configure --with-libkml
make
make install
cd ..
cp /usr/local/lib/* /usr/lib64/

#安装libkml1.3
wget https://cbs.centos.org/repos/cloud7-openstack-common-candidate/x86_64/os/Packages/libkml-1.3.0-3.el7.x86_64.rpm
yum install libkml-1.3.0-3.el7.x86_64.rpm -y
wget https://cbs.centos.org/repos/cloud7-openstack-common-candidate/x86_64/os/Packages/libkml-devel-1.3.0-3.el7.x86_64.rpm
yum install libkml-devel-1.3.0-3.el7.x86_64.rpm

#安装gsl
wget ftp://ftp.gnu.org/gnu/gsl/gsl-latest.tar.gz
tar xzf gsl-latest.tar.gz
cd gsl*
./configure --prefix=/usr
make
make install
cd ..

#安装R
yum install R -y

#替换openBLAS
mv /usr/lib64/R/lib/libRblas.so /usr/lib64/R/lib/libRblas.so_
ln -s /usr/lib64/libopenblas.so.0 /usr/lib64/R/lib/libRblas.so

#设置java环境
env PATH=/usr/local/bin:$PATH R CMD javareconf

#设置openMPI
sudo echo "/usr/lib64/openmpi/lib" > /etc/ld.so.conf.d/openmpi.conf
sudo ldconfig

#安装ggobi
wget http://www.ggobi.org/downloads/ggobi-2.1.11.tar.bz2
bunzip2 ggobi-2.1.11.tar.bz2
tar -xf ggobi-2.1.11.tar
cd ggobi-2.1.11
./configure --with-all-plugins
make
sudo make install
make ggobirc
sudo mkdir -p /etc/xdg/ggobi
sudo cp ggobirc /etc/xdg/ggobi/ggobirc
sudo ln -s /usr/local/lib/libggobi.so.0 /usr/lib64/libggobi.so.0
cd ..

#安装OpenCL
wget http://registrationcenter-download.intel.com/akdlm/irc_nas/9019/opencl_runtime_16.1.1_x64_rh_6.4.0.25.tgz
tar -xzf opencl_runtime_16.1.1_x64_rh_6.4.0.25.tgz
sudo yum install opencl_runtime_16.1.1_x64_rh_6.4.0.25/rpm/*

#安装SYMPHONY
wget http://www.coin-or.org/download/source/SYMPHONY/SYMPHONY-5.6.14.tgz
tar -xzf SYMPHONY-5.6.14.tgz
cd SYMPHONY-5.6.14
./configure
make
sudo make install
sudo cp -R include/* /usr/include/
sudo cp -R bin/* /usr/bin/
sudo cp -R lib/* /usr/lib64/
sudo cp -R share/* /usr/share/
cd ..

#安装OpenBugs
yum install http://pj.freefaculty.org/EL/7/x86_64/openbugs-3.2.3-1.x86_64.rpm

#如果需要显卡支持的话要安装CUDA
#https://developer.nvidia.com/cuda-downloads
#vi /etc/profile.d/custom.sh
#写入
#export CPATH=\$CPATH:/usr/include/openmpi-x86_64
#PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
#export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
#export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:${LD_LIBRARY_PATH}

开始安装Packages
install.packages('devtools')
library(devtools)
devtools::install_github('imanuelcostigan/RSQLServer')
source("https://bioconductor.org/biocLite.R")
biocLite(c("DNAcopy", "SAGx", "aroma.light", "aroma.core", "genefilter", "limma", "DESeq", "graph", "Rgraphviz", "genefilter", "edgeR", "RDAVIDWebService", "sva", "fabia", "beadarray", "geneplotter", "biomaRt", "Biostrings", "GOSemSim", "qvalue", "DESeq2", "marray", "GEOquery", "GenomicRanges", "GenomeInfoDb", "pcaMethods", "chopsticks", "RBGL", "BSgenome", "BSgenome.Hsapiens.UCSC.hg19", "affxparser", "affy", "oligo", "supraHex", "siggenes", "gcrma", "Rsamtools", "GenomicAlignments", "impute", "flowWorkspace", "flowCore", "breastCancerVDX", "snpStats", "EBImage", "rtracklayer", "GenomicFeatures", "genoset", "nem", "a4Core", "Icens", "lfa", "org.Hs.eg.db", "GOstats", "pdInfoBuilder", "convert", "GEOmetadb", "annotate", "simpleaffy", "lumi", "globaltest", "ssize", "GeneMeta", "MergeMaid", "metaArray", "seqLogo", "GlobalAncova", "GSVA", "mzR", "xcms", "vsn", "minet", "ShortRead", "safe", "piano", "LBE", "survcomp", "fmcsR", "ChemmineR", "KEGGREST", "widgetTools", "copynumber", "phyloseq", "MassSpecWavelet", "MAIT", "CNTools", "qpgraph", "topGO", "kelvin", "miscF", "randtoolbox", "mcGlobaloptim", "ycinterextra", "DiceOptim", "GPareto", "KrigInv", "bamsignals", "Rdisop", "KEGGgraph", "VariantAnnotation", "iBBiG", "rqubic", "BicARE", "CMA", "affyPLM"))
install.packages('tcltk2')
install.packages('udunits2',configure.args='--with-udunits2-include=/usr/include/udunits2')
install.packages('Rmpi',configure.args = '--with-Rmpi-include=/usr/include/openmpi-x86_64 --with-Rmpi-libpath=/usr/lib64/openmpi/lib --with-Rmpi-type=OPENMPI')
availablePackages <- names(available.packages()[,1]); installedPackages <- names(installed.packages()[,'Package']); badPackages <- c("rngWELL", "randtoolbox", "cda", "cepp", "copBasic", "DiceOptim", "ESGtoolkit", "FDGcopulas", "GPareto", "GPC", "iterLap", "KrigInv", "mcGlobaloptim", "minimaxdesign", "moko", "ndjson", "TruncatedNormal", "ycinterextra", "ROracle", "ora", "cplexAPI", "ROI.plugin.cplex", "Rcplex", "Rmosek", "REBayes", "RcppAPT", "rLindo", "sybilSBML", "RSAP", "gmatrix", "BRugs", "agRee", "miscF", "PottsUtils", "rngWELL", "randtoolbox", "cda", "cepp", "copBasic", "DiceOptim", "ESGtoolkit", "FDGcopulas", "GPareto", "GPC", "iterLap", "KrigInv", "mcGlobaloptim", "minimaxdesign", "moko", "ndjson", "TruncatedNormal", "ycinterextra", "ROracle", "ora", "cplexAPI", "ROI.plugin.cplex", "Rcplex", "Rmosek", "REBayes", "RcppAPT", "rLindo", "sybilSBML", "RSAP", "gmatrix") installPackages <- availablePackages[!availablePackages %in% installedPackages]; installPackages <- installPackages[!installPackages %in% badPackages] install.packages(installPackages) 以上内容全部完成后大约会安装1万个左右的包


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/262.html
Like (62)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(2)个小伙伴在吐槽
  1. Jason
    if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")BiocManager::install()biocLite安装方式升级了
    Jason2019-11-05 03:45 Reply Mac OS X | Chrome 77.0.3865.120
  2. Jason
    gdal编译的时候,./configure需要加--prefix=/usr
    Jason2019-11-05 05:48 Reply Mac OS X | Chrome 77.0.3865.120