R をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
本家様 [[https://www.r-project.org/>+https://www.r-projec...
言わずもがなの「R」
パッケージとして登録されているのでyumで気軽にインストール...
&size(10){[[CRAN>R/CRAN]]、[[RStudio>R/RStudio]]、[[RStud...
各ディストリビューターでは
-CentOS7.9
#code(nonumber){{
[root@centos7 ~]# yum list |grep R-core
R-core.x86_64 3.6.0-1.el7 ...
R-core-devel.x86_64 3.6.0-1.el7 ...
[root@centos7 ~]#
}}
-RockyLinux8.6
#code(nonumber){{
[root@rockylinux ~]# dnf --enablerepo=powertools list | g...
R-core.x86_64 4.2.2-1.el8 ...
R-core-devel.x86_64 4.2.2-1.el8 ...
[root@rockylinux ~]#
}}
ここではCentOS7でRを使ってみる
epelからRは得られるが、そのバージョンは「3.6.0」と若干古い.
&size(10){古くても構わないなら「yum install R-core R-core...
より最新の「R」を使いたい場合は自らコンパイルする必要があ...
&size(10){その場合 [[EnvironmentModules]] を使ってバージ...
っで
***下拵え [#y1ccc9e2]
#code(nonumber){{
(centos7)
yum groupinstall "Development Tools"
yum install readline-devel libX11-devel libXt-devel bzip2...
tcl-devel tk-devel libjpeg-turbo-devel libicu-devel l...
(RHEL8系RockyLinux)
dnf groupinstall "Development Tools"
dnf install gcc-gfortran readline-devel libX11-devel libX...
tcl-devel tk-devel libjpeg-turbo-devel libXmu-devel l...
java-1.8.0-openjdk-devel
dnf install --enablerepo=devel texinfo-tex texlive-fonts-...
wget https://dl.fedoraproject.org/pub/fedora/linux/releas...
dnf localinstall texlive-inconsolata-svn54512-65.fc38.noa...
(ubuntu20.04)
apt install build-essential
apt install gfortran libreadline-dev libz-dev libbz2-dev ...
(ubuntu22.04)
apt install build-essential
apt install gfortran libreadline-dev zlib1g-dev libbz2-de...
}}
***コンパイル [#z927e6ba]
#code(nonumber){{
[root@centos7 ~]# mkdir -p /apps/src && cd /apps/src
[root@centos7 src]# curl -O https://cran.r-project.org/sr...
[root@centos7 src]# tar xf R-4.3.2.tar.gz && cd R-4.3.2
[root@centos7 R-4.3.2]# ./configure --prefix=/apps/R-4.3....
:
:
R is now configured for x86_64-pc-linux-gnu
Source directory: .
Installation directory: /apps/R-4.3.2
C compiler: gcc -std=gnu11 -g -O2
Fortran fixed-form compiler: gfortran -g -O2
Default C++ compiler: g++ -std=gnu++11 -g -O2
C++11 compiler: g++ -std=gnu++11 -g -O2
C++14 compiler:
C++17 compiler:
C++20 compiler:
C++23 compiler:
Fortran free-form compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11, tcltk
External libraries: pcre2, readline, curl
Additional capabilities: PNG, JPEG, TIFF, NLS, cair...
Options enabled: shared R library, shared B...
Capabilities skipped:
Options not enabled: memory profiling
Recommended packages: yes
configure: WARNING: you cannot build info or HTML version...
configure: WARNING: you cannot build PDF versions of the ...
configure: WARNING: you cannot build PDF versions of vign...
[root@centos7 R-4.3.2]# make && make check && make install
}}
***Environment Modules [#y6437f85]
RHEL系なら「/etc/modulefiles」あたり、ubuntuなら「/etc/en...
独自の場所「/apps/modulefiles」に置くなら「module use &co...
「/etc/modulefiles/R/4.3.2」
#code(nonumber){{
[root@centos7 ~]# vi /apps/modulefiles/R/4.3.2
#%Module1.0
set R /apps/R-4.3.2
prepend-path PATH $R/bin
setenv R_HOME_DIR $R
setenv R_LIBS_USER $env(HOME)/.R/%V
setenv R_ENVIRON_USER $env(R_LIBS_USER)/.Renviron
setenv R_PROFILE_USER $env(HOME)/.Rprofile
setenv R_HISTFILE $env(HOME)/.Rhistory
setenv R_HISTSIZE 65535
[root@centos7 ~]#
}}
***試す [#ld3d43cc]
#code(nonumber){{
[saber@centos7 ~]$ module use --append /apps/modulefiles/
[saber@centos7 ~]$ module load R
[saber@centos7 ~]$ which R
/apps/R-4.3.2/bin/R
[saber@centos7 ~]$
[saber@centos7 ~]$ R --version
R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Compu...
Platform: x86_64-pc-linux-gnu (64-bit)
(略
[saber@centos7 ~]$
}}
***ubuntu(20.04)でR [#h3385234]
パッケージで済ませるならこんな感じで。
[[https://cran.ism.ac.jp/bin/linux/ubuntu/>+https://cran....
#code(nonumber){{
apt update 「apt update -qq」の「-qq」はログ...
apt install --no-install-recommends software-properties-c...
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/ma...
「lsb_release -cs」の値が「focal」(ubuntu20.04の名称)として
add-apt-repository "deb https://cloud.r-project.org/bin/l...
「/etc/apt/sources.list」にリポジトリが追加される
リポジトリの削除は「add-apt-repository --remove 'deb ...
「https://cloud.r-project.org/bin/linux/ubuntu/focal-cr...
apt search r-base-core
インストールされるRの確認
apt install r-base
}}
っでテスト
#code(nonumber){{
illya@ubuntu:~$ which R
/usr/bin/R
illya@ubuntu:~$ R --version
R version 4.2.2 Patched (2022-11-10 r83330) -- "Innocent ...
Copyright (C) 2022 The R Foundation for Statistical Compu...
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
illya@ubuntu:~$
}}
「/usr/bin/R」の中身を見るとshellスクリプトで「R_HOME_DIR...
***ubuntu(20.04)でソースから構築 [#d9f73e95]
#code(nonumber){{
(ubuntu20.04)
apt install build-essential
apt install gfortran libreadline-dev libz-dev libbz2-dev ...
root@ubuntu:~# mkdir -p /apps/src && cd /apps/src
root@ubuntu:/apps/src# wget https://cran.r-project.org/sr...
root@ubuntu:/apps/src# tar xf R-4.2.2.tar.gz && cd R-4.2.2
root@ubuntu:/apps/src/R-4.2.2# ./configure --prefix=/apps...
root@ubuntu:/apps/src/R-4.2.2# make && make check && make...
}}
これでインストールは完了.
あとはEnvironment Modulesの設定を行う
終了行:
本家様 [[https://www.r-project.org/>+https://www.r-projec...
言わずもがなの「R」
パッケージとして登録されているのでyumで気軽にインストール...
&size(10){[[CRAN>R/CRAN]]、[[RStudio>R/RStudio]]、[[RStud...
各ディストリビューターでは
-CentOS7.9
#code(nonumber){{
[root@centos7 ~]# yum list |grep R-core
R-core.x86_64 3.6.0-1.el7 ...
R-core-devel.x86_64 3.6.0-1.el7 ...
[root@centos7 ~]#
}}
-RockyLinux8.6
#code(nonumber){{
[root@rockylinux ~]# dnf --enablerepo=powertools list | g...
R-core.x86_64 4.2.2-1.el8 ...
R-core-devel.x86_64 4.2.2-1.el8 ...
[root@rockylinux ~]#
}}
ここではCentOS7でRを使ってみる
epelからRは得られるが、そのバージョンは「3.6.0」と若干古い.
&size(10){古くても構わないなら「yum install R-core R-core...
より最新の「R」を使いたい場合は自らコンパイルする必要があ...
&size(10){その場合 [[EnvironmentModules]] を使ってバージ...
っで
***下拵え [#y1ccc9e2]
#code(nonumber){{
(centos7)
yum groupinstall "Development Tools"
yum install readline-devel libX11-devel libXt-devel bzip2...
tcl-devel tk-devel libjpeg-turbo-devel libicu-devel l...
(RHEL8系RockyLinux)
dnf groupinstall "Development Tools"
dnf install gcc-gfortran readline-devel libX11-devel libX...
tcl-devel tk-devel libjpeg-turbo-devel libXmu-devel l...
java-1.8.0-openjdk-devel
dnf install --enablerepo=devel texinfo-tex texlive-fonts-...
wget https://dl.fedoraproject.org/pub/fedora/linux/releas...
dnf localinstall texlive-inconsolata-svn54512-65.fc38.noa...
(ubuntu20.04)
apt install build-essential
apt install gfortran libreadline-dev libz-dev libbz2-dev ...
(ubuntu22.04)
apt install build-essential
apt install gfortran libreadline-dev zlib1g-dev libbz2-de...
}}
***コンパイル [#z927e6ba]
#code(nonumber){{
[root@centos7 ~]# mkdir -p /apps/src && cd /apps/src
[root@centos7 src]# curl -O https://cran.r-project.org/sr...
[root@centos7 src]# tar xf R-4.3.2.tar.gz && cd R-4.3.2
[root@centos7 R-4.3.2]# ./configure --prefix=/apps/R-4.3....
:
:
R is now configured for x86_64-pc-linux-gnu
Source directory: .
Installation directory: /apps/R-4.3.2
C compiler: gcc -std=gnu11 -g -O2
Fortran fixed-form compiler: gfortran -g -O2
Default C++ compiler: g++ -std=gnu++11 -g -O2
C++11 compiler: g++ -std=gnu++11 -g -O2
C++14 compiler:
C++17 compiler:
C++20 compiler:
C++23 compiler:
Fortran free-form compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11, tcltk
External libraries: pcre2, readline, curl
Additional capabilities: PNG, JPEG, TIFF, NLS, cair...
Options enabled: shared R library, shared B...
Capabilities skipped:
Options not enabled: memory profiling
Recommended packages: yes
configure: WARNING: you cannot build info or HTML version...
configure: WARNING: you cannot build PDF versions of the ...
configure: WARNING: you cannot build PDF versions of vign...
[root@centos7 R-4.3.2]# make && make check && make install
}}
***Environment Modules [#y6437f85]
RHEL系なら「/etc/modulefiles」あたり、ubuntuなら「/etc/en...
独自の場所「/apps/modulefiles」に置くなら「module use &co...
「/etc/modulefiles/R/4.3.2」
#code(nonumber){{
[root@centos7 ~]# vi /apps/modulefiles/R/4.3.2
#%Module1.0
set R /apps/R-4.3.2
prepend-path PATH $R/bin
setenv R_HOME_DIR $R
setenv R_LIBS_USER $env(HOME)/.R/%V
setenv R_ENVIRON_USER $env(R_LIBS_USER)/.Renviron
setenv R_PROFILE_USER $env(HOME)/.Rprofile
setenv R_HISTFILE $env(HOME)/.Rhistory
setenv R_HISTSIZE 65535
[root@centos7 ~]#
}}
***試す [#ld3d43cc]
#code(nonumber){{
[saber@centos7 ~]$ module use --append /apps/modulefiles/
[saber@centos7 ~]$ module load R
[saber@centos7 ~]$ which R
/apps/R-4.3.2/bin/R
[saber@centos7 ~]$
[saber@centos7 ~]$ R --version
R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Compu...
Platform: x86_64-pc-linux-gnu (64-bit)
(略
[saber@centos7 ~]$
}}
***ubuntu(20.04)でR [#h3385234]
パッケージで済ませるならこんな感じで。
[[https://cran.ism.ac.jp/bin/linux/ubuntu/>+https://cran....
#code(nonumber){{
apt update 「apt update -qq」の「-qq」はログ...
apt install --no-install-recommends software-properties-c...
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/ma...
「lsb_release -cs」の値が「focal」(ubuntu20.04の名称)として
add-apt-repository "deb https://cloud.r-project.org/bin/l...
「/etc/apt/sources.list」にリポジトリが追加される
リポジトリの削除は「add-apt-repository --remove 'deb ...
「https://cloud.r-project.org/bin/linux/ubuntu/focal-cr...
apt search r-base-core
インストールされるRの確認
apt install r-base
}}
っでテスト
#code(nonumber){{
illya@ubuntu:~$ which R
/usr/bin/R
illya@ubuntu:~$ R --version
R version 4.2.2 Patched (2022-11-10 r83330) -- "Innocent ...
Copyright (C) 2022 The R Foundation for Statistical Compu...
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
illya@ubuntu:~$
}}
「/usr/bin/R」の中身を見るとshellスクリプトで「R_HOME_DIR...
***ubuntu(20.04)でソースから構築 [#d9f73e95]
#code(nonumber){{
(ubuntu20.04)
apt install build-essential
apt install gfortran libreadline-dev libz-dev libbz2-dev ...
root@ubuntu:~# mkdir -p /apps/src && cd /apps/src
root@ubuntu:/apps/src# wget https://cran.r-project.org/sr...
root@ubuntu:/apps/src# tar xf R-4.2.2.tar.gz && cd R-4.2.2
root@ubuntu:/apps/src/R-4.2.2# ./configure --prefix=/apps...
root@ubuntu:/apps/src/R-4.2.2# make && make check && make...
}}
これでインストールは完了.
あとはEnvironment Modulesの設定を行う
ページ名:
1