一般來說血崭,新安裝的ubuntu系統(tǒng)都太干凈,缺很多庫文件情竹,下面的代碼先運(yùn)行一波堪藐!
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`sudo apt install --fix-missing libcurl4-openssl-dev libxml2-dev libgdal-dev libssl-dev libglu1-mesa-dev libmagick++-dev libudunits2-dev
sudo apt install -y libcurl4-gnutls-dev
sudo apt install -y libxml2-dev
sudo apt install -y openssl
sudo apt install -y libssl-dev` </pre>
安裝最新版R語言
使用root權(quán)限(系統(tǒng)管理員)安裝最新版的R,我們的ubuntu是20浅乔,所以選擇focal這個代號倔喂,然后是cran40,全部的代碼如下:
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 sudo add-apt-repository 'deb https://mirrors.ustc.edu.cn/CRAN/bin/linux/ubuntu focal-cran40/' sudo apt update sudo apt install r-base
</pre>
實(shí)際上還需要使用root權(quán)限(系統(tǒng)管理員)安裝一些R包靖苇。
安裝一些R包
這里我們使用root權(quán)限(系統(tǒng)管理員):sudo R
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`options()BioC_mirror
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()BioC_mirror
https://bioconductor.org/packages/release/bioc/html/GEOquery.html
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("KEGG.db",ask = F,update = F)` </pre>
一般來說不會報(bào)錯席噩,然后繼續(xù)安裝更多的包:
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`BiocManager::install(c("GSEABase","GSVA","clusterProfiler" ),ask = F,update = F)
BiocManager::install(c("GEOquery","limma","impute" ),ask = F,update = F)
BiocManager::install(c("org.Hs.eg.db","hgu133plus2.db" ),ask = F,update = F)
options()$repos
install.packages('WGCNA')
install.packages(c("FactoMineR", "factoextra"))
install.packages(c("ggplot2", "pheatmap","ggpubr"))
library("FactoMineR")
library("factoextra")
library(GSEABase)
library(GSVA)
library(clusterProfiler)
library(ggplot2)
library(ggpubr)
library(hgu133plus2.db)
library(limma)
library(org.Hs.eg.db)
library(pheatmap)
BiocManager::install("ChAMP")` </pre>
不得不說,有一些R包真的很難安裝贤壁,搞了一個下午悼枢,比如ChAMP這個甲基化芯片數(shù)據(jù)處理包,如下脾拆;
我的空白u(yù)buntu系統(tǒng)馒索,全部運(yùn)行完上述代碼后,有327個包:
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">(base) jmzeng@biotrainee:/usr/local/lib/R/site-library$ du -h -d 1 |tail 404K ./ruv 3.2M ./biovizBase 4.5M ./colorspace 1.8M ./prettydoc 444K ./lazyeval 392K ./statmod 5.2M ./WGCNA 156K ./generics 8.0M ./urltools 2.9G .
</pre>
配置網(wǎng)絡(luò)服務(wù)(選修)
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">sudo apt install -y nginx curl
</pre>
同時(shí)需要設(shè)置好 /var/www/html 文件夾權(quán)限名船,就是需要增加一個 www-data 的用戶組绰上,里面包含的用戶都是可以訪問的。
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`sudo chgrp -R www-data /var/www
sudo usermod -a -G www-data jmzeng
sudo usermod -a -G www-data ubuntu
sudo chmod -R 2770 /var/www/html` </pre>
同時(shí)渠驼,也需要管理ubuntu的端口蜈块,Nginx安裝后,理論上IP可以在瀏覽器打開訪問迷扇,但是要求網(wǎng)頁端口80的開通的百揭。
ufw是一個主機(jī)端的iptables類防火墻配置工具
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">sudo ufw enable # 打開防火墻 sudo ufw allow 80 ## 打開端口 sudo ufw status ### 查看防火墻狀態(tài) sudo ufw allow 8787 ## 打開端口
</pre>
服務(wù)器那邊打開端口才可以。
安裝rstudio-server
參考:https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
一定要看清楚ubuntu系統(tǒng)的版本哦谋梭!
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">sudo apt-get install gdebi-core wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.3.1056-amd64.deb sudo gdebi rstudio-server-1.3.1056-amd64.deb
</pre>
在這個版本上面信峻,我浪費(fèi)了至少兩個小時(shí)。安裝shiny和rsutdio的服務(wù)器瓮床,官網(wǎng)找到最新版咯
- https://www.rstudio.com/products/rstudio/download-server/
- https://www.rstudio.com/products/shiny/shiny-server/
自己尋找地址啦盹舞!
配置shiny權(quán)限(選修)
這個呢,基本上只有你真正需要開發(fā)自己的網(wǎng)頁工具隘庄,才用得上哈踢步!
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">sudo systemctl restart shiny-server
</pre>
可能需要經(jīng)常重啟,安裝成功之后查看端口開放情況:netstat -tln
配置用戶組:
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">sudo groupadd shiny sudo chgrp -R shiny /srv/shiny-server/ sudo usermod -a -G shiny jmzeng
</pre>
一些自己開發(fā)的網(wǎng)頁小工具丑掺,可以統(tǒng)一存放在 /srv/shiny-server/ 目錄获印。
<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`sudo chmod -R 2775 /srv/shiny-server/
cd /srv/shiny-server/
mkdir -p plot123
cd plot123
mkdir lineplot dotplot scatterplot boxplot barplot histplot pieplot density
mkdir violinplot qqplot errorplot
mkdir veen upsetr heatmap circos volcano
mkdir genestructure
cd /srv/shiny-server/
mkdir analysis
cd analysis
mkdir deg det deu enrich gsea gsva wgcna timeseries pca tsne
mkdir kmsurvival cox forest
cd /srv/shiny-server/
mkdir database
cd database
mkdir tcga icgc ccle gtex encode roadmap
mkdir ncbi ucsc ensembl
cd /srv/shiny-server/
mkdir paper
cd paper `</pre>