阅读量:2
CentOS服务器安装网页版Rstudio-server及R包批量安装
以下为CentOS 7/8的Rstudio-server安装、配置和R包安装操作
1. 软件包安装
Centos 7安装
# 下载安装包,大小115.14 MB wget -c https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-2023.09.1-494-x86_64.rpm # 安装 sudo yum install rstudio-server-rhel-2023.09.1-494-x86_64.rpm
Centos 8安装
# 下载安装包,大小110.57 MB wget https://download2.rstudio.org/server/rhel8/x86_64/rstudio-server-rhel-2023.09.1-494-x86_64.rpm # 安装 sudo yum install rstudio-server-rhel-2023.09.1-494-x86_64.rpm
2. 开放访问端口
# 查询rstudio-server服务运行状态 sudo systemctl status rstudio-server # 永久开放8787端口,用于Web访问 sudo firewall-cmd --zone=public --add-port=8787/tcp --permanent # 重启防火墙 sudo systemctl restart firewalld
3. 浏览器访问Rstudi-server
server-ip为服务器IP地址,例如192.168.1.10
打开浏览器输入以下地址
# 查询服务器IP地址 ifconfig # 启动Rstudi-server Web程序 sudo systemctl start rstudio-server
http:// server-ip:8787
# 关闭rstudio-server服务 sudo systemctl stop rstudio-server # 启动有报错,使用下列命令查询错误 sudo rstudio-server verify-installation # 重启rstudio-server服务 sudo systemctl stop rstudio-server
服务器账号密码登录
4. 主题配置
5. 下载源配置和R包批量下载
Ctrl + Shift + N 新建一个Rscript
R包批量下载参考生信技能树
# 配置下载源为清华镜像 options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")) options()$repos ################## R包批量下载 ################### # 常用安装包,可自行添加 listOfPackages <- c("shiny", "tidyr", 'tidyverse', "clusterProfiler", "DT", "ashr", "enrichplot", "plotly", "ALL", "CLL", "dbplyr", "GEOquery" ) # listOfPackages 为待安装的包 allPackages = rownames(installed.packages()) save(allPackages,file = 'allPackages.Rdata') # 检查 listOfPackages 列表中包是否安装 newPackages <- listOfPackages[!(listOfPackages %in% installed.packages()[,"Package"])] newPackages # 检查待安装的包与已安装的包是否存在差异 packageToInstall <- setdiff(listOfPackages, installed.packages()) packageToInstall if(T){ # BiocManager安装包 lapply(packageToInstall, function(x){ BiocManager::install(x,ask = F,update = F) }) } ################## 等待R包批量安装 ################### # 载入 listOfPackages 中安装包 lapply(intersect(listOfPackages, installed.packages()),function(x){ # 不输出安装报错 suppressPackageStartupMessages(library(x,character.only = T)) })
800个R包安装
将上述Rscript中的listOfPackages 变量替换为以下变量即可
listOfPackages <- "abind, acepack, ade4, ADGofTest, afex, affxparser, affy, affyio, AIMS, airway, ALL, amap, AnnoProbe, annotate, AnnotationDbi, AnnotationFilter, AnnotationHub, ape, aplot, aroma.light, arules, arulesViz, askpass, assertthat, backports, base, base64, base64enc, base64url, BayesFactor, bayestestR, bbmle, bdsmatrix, beachmat, beanplot, beeswarm, benchmarkme, benchmarkmeData, BH, bibtex, Biobase, BiocFileCache, BiocGenerics, BiocIO, BiocManager, BiocNeighbors, BiocParallel, BiocSingular, BiocVersion, biocViews, biomaRt, Biostrings, biovizBase, bit, bit64, bitops, blob, bluster, boot, bootstrap, brew, bridgesampling, brio, Brobdingnag, broom, broom.mixed, broomExtra, BSgenome, bslib, bumphunter, BWStest, ca, cachem, callr, car, carData, caret, caTools, ccdrAlgorithm, cellranger, checkmate, ChIPpeakAnno, ChIPseeker, chron, circlize, class, cli, clipr, clisymbols, CLL, clue, cluster, clusterProfiler, ClusterR, cmprsk, coda, codetools, coin, colorspace, colourpicker, combinat, cometExactTest, commonmark, compiler, ComplexHeatmap, conquer, ConsensusClusterPlus, contfrac, copula, corpcor, correlation, corrplot, cowplot, cpp11, crayon, credentials, crosstalk, ctc, curl, cutoff, data.table, datasets, datawizard, DBI, dbplyr, dbscan, DDRTree, DelayedArray, DelayedMatrixStats, deldir, dendextend, densityClust, DEoptimR, desc, DescTools, DESeq2, deSolve, devtools, dichromat, diffobj, digest, diptest, discretecdAlgorithm, do, DO.db, docopt, doParallel, doRNG, DOSE, dotCall64, downloader, dplyr, dqrng, DT, dtplyr, dynamicTreeCut, e1071, EDASeq, edgeR, effectsize, egg, ellipse, ellipsis, elliptic, emmeans, EMT, enrichplot, EnsDb.Hsapiens.v75, ensembldb, estimability, europepmc, evaluate, Exact, exactRankTests, exomeCopy, ExperimentHub, expm, ez, factoextra, FactoMineR, fansi, farver, fastcluster, fastGHQuad, fastICA, fastmap, fastmatch, FD, FDb.InfiniumMethylation.hg19, ff, fgsea, fields, filelock, fit.models, fitdistrplus, flashClust, flexmix, FNN, fontawesome, forcats, foreach, foreign, formatR, Formula, fpc, fs, furrr, futile.logger, futile.options, future, future.apply, gameofthrones, gapminder, gargle, gbRd, gclus, gdata, genefilter, genefu, geneplotter, generics, genomation, GenomeInfoDb, GenomeInfoDbData, GenomicAlignments, GenomicFeatures, GenomicRanges, geometry, GEOquery, gert, GetoptLong, GGally, ggbeeswarm, ggbio, ggcorrplot, ggdendro, ggExtra, ggforce, ggfortify, ggfun, ggnetwork, ggplot2, ggplotify, ggpubr, ggraph, ggrepel, ggridges, ggrisk, ggsci, ggsignif, ggstatsplot, ggtext, ggthemes, ggtree, gh, git2r, gitcreds, gld, glmnet, glmSparseNet, GlobalOptions, globals, glue, gmodels, gmp, gnm, GO.db, goftest, googledrive, googlesheets4, GOplot, GOSemSim, gower, GPArotation, gplots, graph, graphics, graphite, graphlayouts, grDevices, grid, gridBase, gridExtra, gridGraphics, gridtext, GSEABase, gsl, gsubfn, GSVA, gtable, gtools, harrypotter, hash, haven, HDF5Array, here, hexbin, hgu133a.db, hgu133a2.db, hgu133plus2.db, hgu95av2.db, highr, Hmisc, hms, howmany, HSMMSingleCell, htmlTable, htmltools, htmlwidgets, httpuv, httr, hugene10sttranscriptcluster.db, hwriter, hypergeo, iC10, iC10TrainingData, ica, idr, ids, igraph, illuminaHumanv3.db, illuminaio, impute, ini, inline, insight, InteractionSet, interactiveDisplayBase, ipred, IRanges, IRdisplay, IRkernel, irlba, isoband, iterators, jackstraw, jcolors, jmv, jmvcore, jomo, eg, jquerylib, jsonlite, KEGGREST, kernlab, KernSmooth, km.ci, KMsurv, knitr, kSamples, labeling, labelled, laeken, lambda.r, LaplacesDemon, lars, later, lattice, latticeExtra, lava, lavaan, lazyeval, leaps, learnr, leiden, lfa, libcoin, lifecycle, limma, linprog, listenv, lme4, lmerTest, lmom, lmtest, locfdr, locfit, logspline, loo, loose.rock, lpSolve, lsei, lubridate, lumi, made4, maftools, magic, magick, magrittr, manipulate, manipulateWidget, mapproj, maps, maptools, markdown, MASS, Matching, MatchIt, mathjaxr, matlab, Matrix, MatrixGenerics, MatrixModels, matrixStats, maxstat, mbkmeans, mc2d, mclust, mcmc, MCMCpack, memoise, memuse, metaBMA, metafor, metap, metaplus, metapod, methods, methylumi, mets, mgcv, mice, mime, minfi, miniUI, minqa, miRNAtap, missMDA, mitml, mitools, mlbench, mnormt, ModelMetrics, modelr, modeltools, monocle, multcomp, multcompView, MultiAssayExperiment, multtest, munsell, mutoss, mvnfast, mvnormtest, mvtnorm, network, nleqslv, nlme, nloptr, NMF, nnet, nomogramFormula, nor1mix, nortest, npsurv, numDeriv, oligo, oligoClasses, oompaBase, openssl, openxlsx, ordinal, org.Dm.eg.db, org.Hs.eg.db, org.Mm.eg.db, org.Rn.eg.db, OrganismDbi, packrat, paletteer, palr, pals, pamr, pan, pander, parallel, parallelly, parameters, patchwork, pbapply, pbdZMQ, pbivnorm, pbkrtest, pcaMethods, pcaPP, pd.hugene.2.0.st, pdftools, pec, performance, permute, pheatmap, phylobase, pillar, pinfsc50, pixmap, pkgbuild, pkgconfig, pkgload, pkgmaker, plogr, plotly, plotrix, plyr, PMCMR, PMCMRplus, png, polspline, polyclip, polynom, prabclus, pracma, praise, preprocessCore, prettyunits, princurve, prismatic, pROC, processx, prodlim, progress, progressr, promises, ProtGenerics, proto, proxy, ps, pspline, psych, Publish, purrr, purrrlyr, qap, qlcMatrix, qpdf, quadprog, quantmod, quantreg, qvalue, qvcalc, R.methodsS3, R.oo, R.utils, R6, randomForest, ranger, RANN, rappdirs, rat2302.db, RBGL, rbibutils, rcmdcheck, RColorBrewer, rcompanion, rcorpora, Rcpp, RcppAnnoy, RcppArmadillo, RcppEigen, RcppGSL, RcppHNSW, RcppParallel, RcppProgress, RcppZiggurat, RCurl, RCy3, Rdpack, reactome.db, ReactomePA, readr, readxl, recipes, regioneR, registry, relimp, rematch, rematch2, remotes, renv, repr, reprex, reshape, reshape2, restfulr, reticulate, rex, Rfast, rgl, rhdf5, rhdf5filters, Rhdf5lib, Rhtslib, rio, riskRegression, rJava, rjson, RJSONIO, rlang, rmarkdown, rmeta, Rmpfr, rms, RnBeads, RnBeads.hg38, rncl, RNeXML, rngtools, robust, robustbase, RobustRankAggreg, ROCit, ROCR, rootSolve, ROTS, roxygen2, rpart, rprojroot, rrcov, rsample, Rsamtools, RSpectra, RSQLite, rstan, rstantools, rstatix, rstudioapi, rsvd, RTCGA, RTCGA.clinical, RTCGA.miRNASeq, RTCGA.rnaseq, rtracklayer, Rtsne, RUnit, rvcheck, rversions, rvest, rWikiPathways, S4Vectors, sandwich, sass, ScaledMatrix, scales, scater, scattermore, scatterpie, scatterplot3d, scico, scran, scrime, scRNAseq, sctransform, scuttle, segmented, selectr, seqinr, seqPattern, seriation, sessioninfo, set, Seurat, SeuratObject, shadowtext, shape, shiny, shinyjs, shinythemes, ShortRead, siggenes, SingleCellExperiment, sitmo, sjlabelled, sjmisc, sjstats, skimr, slam, slider, slingshot, smoother, sn, sna, snow, softImpute, SomaticCancerAlterations, SomaticSignatures, sourcetools, sp, spam, sparsebn, sparsebnUtils, SparseM, sparseMatrixStats, sparsesvd, spatial, spatstat.core, spatstat.data, spatstat.geom, spatstat.sparse, spatstat.utils, splines, sqldf, SQUAREM, stabledist, StanHeaders, statmod, statnet.common, stats, stats4, statsExpressions, stringi, stringr, SummarizedExperiment, SuppDists, survcomp, survey, survival, survivalROC, survminer, survMisc, sva, swirl, sys, table1, tableone, taRifx, TCGAbiolinks, TCGAbiolinksGUI.data, tcltk, tensor, testthat, TFisher, TH.data,tibble, tidygraph, tidyr, tidyselect, tidytree, tidyverse, timeDate, timereg, timeROC, tinytex, TMB, tmcn, tmvnsim, tools, TrajectoryUtils, treeio, triebeard, tsne, TSP, TTR, tweenr, TxDb.Dmelanogaster.UCSC.dm3.ensGene, TxDb.Dmelanogaster.UCSC.dm6.ensGene, TxDb.Hsapiens.UCSC.hg19.knownGene, tximport, tzdb, uchardet, ucminf, UpSetR, urltools, usethis, utf8, utils, uuid, uwot, V8, VariantAnnotation, vcd, vcdExtra, vcfR, vctrs, vegan, VennDiagram, VGAM, VIM, vipor, viridis, viridisLite, visNetwork, vroom, waldo, warp, webshot, WGCNA, whisker, withr, wordcloud, WRS2, xfun, XLConnect, XML, xml2, xopen, xtable, xts, XVector, yaml, yulab.utils, zeallot, zinbwave, zip, zlibbioc, zoo"