Introduce R v3.4.1 and various packages to CentOS 6.4 in offline environment

Purpose of this article

In order to perform genome analysis, it is necessary to install a large number of software that composes the analysis pipeline. However, the server that handles personal information called the genome is usually isolated from the Internet for security reasons. Therefore, once the analysis pipeline is built, the OS and software will not be updated for the time being. Due to various circumstances, it became necessary to add the analysis written in R to the pipeline only with user privileges, but the installation of the R package was premised on the network environment, and it was not straightforward. Therefore, I decided not to update the old linux and old R versions in the offline environment, but to leave a way to install the necessary packages with the appropriate version.

Work environment

Online environment: --Host MacOS 10.15.7 --Virtual environment CentOS 6.4 on Parallels Desktop 15 for Mac Offline environment: CentOS 6.4, R 3.4.1

Create a CentOS virtual environment

I think that any software that can create a virtual environment can be specified, but this time I am using Parallels. First, go to http://mirror.nsc.liu.se/centos-store/ and follow the directory structure of the desired version (6.4) → isos → x86_64. Since setting the network environment is troublesome with the minimum configuration CentOS-6.4-x86_64-minimal.iso, download CentOS-6.4-x86_64-bin-DVD1.iso and install the Desktop version. The download was only 300kbps and took about 4 hours. If you select the standard installation using the downloaded image file and proceed, the GUI can be specified in about 10 minutes. When a network connection is established, an IP address is automatically assigned (ex. 10.211.55.XX). After that, log in with ssh from the host and work on the terminal. Log in as root once and grant sudo authority. Also, GUI is not required, so start it with CUI. Set the proxy as appropriate. http://mzgkworks.com/post/linux-su-sudo/ https://qiita.com/Esfahan/items/a159753d156d23baf180 http://blog.doli.jp/blog/2012/post526/ https://qiita.com/hirohiro77/items/cdf6d8baa619c0e0e82d https://kitamix.net/archives/set-proxy-when-rstudio-started/1049

Introduce R 3.4.1 into a virtual environment

Download the desired version of the tar.gz file from the CRAN website below. https://cran.r-project.org/src/base/

wget https://cran.r-project.org/src/base/R-3/R-3.4.1.tar.gz

Save it in an appropriate directory (~ / etc.) and build it. An error will occur related to bzip2, so please refer to the following. https://www.21064.com/2018/11/07/rhel7-r-3-3-1-install/ http://pentan.info/server/linux/zlib.html https://noknow.info/it/os/install_bzip2_from_source?lang=ja https://qiita.com/kuchida1981/items/d028940ade41096490de http://note.kurodigi.com/sudo-path/ https://stats.biopapyrus.jp/r/devel/r-install.html

tar zxvf R-3.4.1.tar.gz
cd R-3.4.1
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel zlib-devel texinfo gtk+-devel gtk2-devel qt-devel tcl-devel tk-devel kernel-headers kernel-devel readline-devel
sudo yum install bzip2-devel

wget http://zlib.net/fossils/zlib-1.2.5.1.tar.gz
sudo tar zxvf zlib-1.2.5.1.tar.gz
cd zlib-1.2.5.1
make clean
sudo CFLAGS='-mstackrealign -fPIC -O3' ./configure
sudo make
sudo make install

cd ~

sudo yum install openssl-devel

wget https://sourceware.org/pub/bzip2/bzip2-1.0.6.tar.gz --no-check-certificate
sudo tar xvfz bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
sudo make clean
sudo make
sudo make install
export PATH=$PATH:/usr/local/bin/bzip2
vi ~/.bash_profile # export PATH=$PATH:/usr/local/bin/Added bzip2
su -
visudo # Defaults    env_keep += "PATH"Postscript
       # Defaults    env_reset comment out
       #Defaults     secure_path=Comment out

cd ~

wget https://tukaani.org/xz/xz-5.2.4.tar.gz --no-check-certificate
sudo tar xzvf xz-5.2.4.tar.gz
sudo ./configure --prefix=/home/$USER/local
sudo make
sudo make install PREFIX=/home/$USER/local

cd ~

wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz --no-check-certificate
sudo tar xzvf pcre-8.42.tar.gz
cd pcre-8.42
sudo ./configure --prefix=/home/$USER/local --enable-utf8
sudo make
sudo make install

cd ~
wget https://curl.haxx.se/download/curl-7.61.0.tar.gz --no-check-certificate
sudo tar xzvf curl-7.61.0.tar.gz
cd curl-7.61.0
sudo ./configure  --enable-libcurl-option
sudo make
sudo make install

LIBCURL_LOCAL_DIR="/home/[user name]/local/bin/curl"
export PATH=$LIBCURL_LOCAL_DIR/bin:$PATH
export LD_LIBRARY_PATH=$LIBCURL_LOCAL_DIR/lib:$LD_LIBRARY_PATH
export LIBCURL_CFLAGS=-I$LIBCURL_LOCAL_DIR/include
export LIBCURL_LIBS=-L$LIBCURL_LOCAL_DIR/lib

export CPPFLAGS="-I/home/[user name]/local/include" # ~/.Added to bashrc
export LDFLAGS="-L/home/[user name]/local/lib" # ~/.Added to bashrc

cd ~/R-3.4.1

./configure
sudo make
sudo make install
sudo yum install libxml2-devel
sudo yum install openssl-devel

Download the required package

The package I want to use this time is a package on my own github, and I am using the package registered in CRAN and Bioconductor. https://github.com/MANO-B/MicroSEC First, install the dependent package.

if (!requireNamespace("BiocManager", quietly = TRUE)){
    install.packages("BiocManager")
}
install.packages(c('tidyr', 'openxlsx', 'data.table', 'R.utils', 'stringr', 'magrittr', 'dplyr', 'gtools', 'devtools'), dependencies = TRUE)
BiocManager::install(c("Rsamtools", "Biostrings", "GenomicAlignments", "GenomeInfoDb"), update=FALSE)

# install necessary genomes
BiocManager::install("BSgenome.Hsapiens.UCSC.hg38", update=FALSE)
BiocManager::install("BSgenome.Hsapiens.UCSC.hg19", update=FALSE)
BiocManager::install("BSgenome.Mmusculus.UCSC.mm10", update=FALSE)

If you cannot install it properly due to the version of the compiler, install it from github.

devtools::install_github(”tidyverse/tidyr", ref="v1.1.0")

Finally, install the target package and check the operation as appropriate.

devtools::install_github("MANO-B/MicroSEC", upgrade="never")  
library(MicroSEC)
fun_zero(4, 2)

After that, copy the package to the offline environment and finish.

cd ~/R/x86_64-pc-linux-gnu-library
scp -r 3.4 XXX.XXX.XXX.XXX:~/R/x86_64-pc-linux-gnu-library/

Check the operation.

$ R
> library(MicroSEC)
> fun_zero(4, 2)

Recommended Posts

Introduce R v3.4.1 and various packages to CentOS 6.4 in offline environment
How to install Titan2D (v4.2.0) in virtual environment
What happened in "Java 8 to Java 11" and how to build an environment
How to install PHP 7.4 and SQL Server drivers in CentOS 7.7
Offline environment construction CentOS edition
How to install the language used in Ubuntu and how to build the environment
Install CentOS Stream 8 in Hyper-V environment
How to introduce jQuery in Rails 6
Java --Introduce CheckStyle plugin to IntelliJ IDEA and reflect it in formatter