在 centOS6 上安裝 R 3.6.0

內容說明

如何在 centOS 上安裝 R ,並記錄所有的坑與雷點
sudo apt-get install build-essential (OS: ubuntu) 與 yum install gcc gcc-c++ make (OS : centOS ) 不同需要特別注意
此版本為: centOS 6
為甚麼會寫兩篇文章關於 R 的安裝呢,很簡單!因為之前 3.2.0 不支援太多套件了,只好來重新安裝 R 的新版本(P.S. 不歸路阿…都是坑)
注意:如果不需要,建議還是安裝 3.2.0 較為方便
centOS6 在安裝 R新版本會有非常大問題出錯。
警告:這篇文章實用性不高,對於可信度請不要太過於相信,太多事情沒有紀錄確實。在此獻上歉意
為甚麼實用性不高,還要放在網路上呢? 因為就算實用性不高這些錯誤我曾踩過,也許未來的我能從這邊啟發一些事情

安裝教學

  1. 安裝前置作業必要套件

    1
    2
    3
    4
    5
    6
    7
    yum install gcc-gfortran     
    yum install gcc gcc-c++
    yum install readline-devel
    yum install libXt-devel
    yum install libpng libpng-devel libtiff libtiff-devel libjpeg-turbo libjpeg-turbo-devel
    yum install libgfortran4
    yum install libxml2-devel
  2. 安裝使用

    1
    2
    3
    sudo yum install epel-release
    sudo yum install R
    sudo ./configure --prefix=/opt/R/3.6.0 --enable-R-shlib

錯誤排除

R 如果 ERROR 並且你的 linux 系統 c++ < 11 or nullptr 不可用 就必須要安裝 c++ 11

如果你在安裝套件上遇到錯誤時,仔細閱讀可以發現似乎有 bug 關於說 nullptr 不可使用,這時候你可能知道了一件事,對!centOS6 的 complier 是 C99,不是 C11,生不生氣!所以我們就要來安裝 C11

Answer:

run a c++ program with c++11 support in older CentOS machine 參考此文章,這文章寫得很好。

ERROR : C++11 standard requested but CXX11 is not defined

試圖加入這些命令

1
2
3
4
CXX11 = g++
CXX11FLAGS = -O2 -g $(LTO)
CXX11PICFLAGS = -fPIC
CXX11STD = -std=c++11

參考連結

Installing hits ‘C++11 standard requested but CXX11 is not defined

Error: Protected multilib versions

如果遇到有不同版本的問題,則將版本移除即可。下面是我遇到的錯誤訊息

1
2
Error: Protected multilib versions: libRmath-3.5.2-2.el6.i686 != libRmath-3.6.0-1.el6.x86_64
Error: Protected multilib versions: R-java-devel-3.5.2-2.el6.i686 != R-java-devel-3.6.0-1.el6.x86_64

解決方案

1
2
3
sudo yum remove openssh
sudo yum remove libRmath
sudo yum remove R-java-devel

心得

老實說,這篇文章我並沒有打得很好,因為我花了太多時間在 debug,以及這是我第一次花時間去完整地找出 bug,然後各個擊破。我在 bug 的過程中沒有紀錄確實,導致紀錄的不好。有許多我知道我曾經有錯的地方我也有找出 solutation,但我卻沒有紀錄。我覺得這點不好,這樣我在以後如果有遇到類似問題時會遇到一樣久的時間。

但是有了這次經驗,我知道我應該要怎麼來做 debug 會更好。應該在邊學中碰到 Error 就做紀錄,這樣才是最好的。

學習連結

我在尋找的過程中,受到這幾個網站的幫助,如果我解釋得不好可以考慮從這些網站下尋求幫助,如下:
libcurl-devel-7.19.7-53.el6_9.x86_64.rpm
在CentOS服务器上配置RStudio Server
linux下R 3.6.0的安装手册
Unable to install R 3.6.0 on centos
本地安裝R-devel的Gfortran錯誤
Updating GFortran on Scientific Linux 7?
R-devel-3.6.0-1.el6.x86_64.rpm

我在 debug 時做的簡單紀錄

由於太簡單了,反而導致我很難做紀錄。需要改進

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#install.packages("magrittr")
#install.packages("devtools")
install.packages("igraph")
#install.packages("RJSONIO")
install.packages("doBy")
#install.packages("ggplot2")
install.packages("jsonlite")
install.packages("plumber")

sudo ./configure --prefix=/opt/R/3.5.0 --enable-R-shlib
roxygen2
BiocManager
lintr
rmarkdown
spelling
pkgdown
devtools
devtools::install_github("gaborcsardi/pkgconfig" , force=TRUE)
devtools::install_github("igraph/rigraph")

yum remove libgfortran4
yum install libgfortran4
install_url("http://igraph.googlecode.com/files/igraph_nightly_0.6-2689-20120412.tar.gz")
library(devtools)
library(remotes)
install.packages("igraph", dependencies = TRUE) # R 版本必須大於 3.2.3
install.packages("devtools", repos = "http://cran.rstudio.com")
remotes::install_version('igraph', version = '1.1.1' )
install.packages("remotes")
install.packages("readxl")
install.packages("igraph", repos = "http://cran.rstudio.com")
install.packages("RJSONIO", repos = "http://cran.rstudio.com")
install.packages("doBy", repos = "http://cran.rstudio.com")
install.packages("ggplot2", repos = "http://cran.rstudio.com")
install.packages("jsonlite", repos = "http://cran.rstudio.com")
install.packages("plumber", repos = "http://cran.rstudio.com")

url <- "https://cran.r-project.org/src/contrib/Archive/igraph/igraph_1.1.1.tar.gz"
install.packages(url, repos=NULL , type="source")

install.packages("devtools")
install.packages("later")

install_version(“ggplot2”, version = “2.0.0”, repos = “https://cran.r-project.org/src/contrib/Archive/ggplot2/”)

install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))
install.packages("version")


原文網址:https://kknews.cc/news/2q495g9.html
wget http://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz

tar -zxvf R-3.5.0.tar.gz
cd R-3.5.0
原文網址:https://kknews.cc/news/2q495g9.html

root密碼: +Z_F~Q!=mHch
yum install libxml2-devel


In install.packages("igraph", dependencies = TRUE) :
installation of package ‘later’ had non-zero exit status

Warning messages:
1: In system2(cmd0, args, env = env, stdout = outfile, stderr = outfile) :
system call failed: Cannot allocate memory
2: In install.packages("magrittr") :
installation of package ‘magrittr’ had non-zero exit status

packageVersion("magrittr")

R -e 'install.packages("magrittr")'

http://192.168.10.39:8551/sum

# R 如果 ERROR 並且你的 linux 系統 c++ < 11 or nullptr 不可用 就必須要安裝 c++ 11
curl version 7.70.0

tar xzvf pcre-8.42.tar.gz
tar xzvf xz-5.2.5.tar.gz
tar xzvf zlib-1.2.11.tar.gz
tar xzvf R-3.5.0.tar.gz

delete /usr/lib64/pkgconfig/zlib.pc

CXX11 = g++
CXX11FLAGS = -O2 -g $(LTO)
CXX11PICFLAGS = -fPIC
CXX11STD = -std=c++11

用一個指令就可以下載到最新版的,但可能有問題。要安裝一些指令
Error in .shlib_internal(args) : C++11 standard requested but CXX11 is not defined R 要 vim echo $(R RHOME)/etc/Makeconf 然後改其來

yum remove gcc-gfortran

igraph 下載 1.2.4.1

sudo find RConfig.h

zU;7a%MXaH5Q

plumber::plumb(file='./plumber.R')$run()

In file included from CHOLMOD/Supernodal/cholmod_super_numeric.c:80:0:
CHOLMOD/Supernodal/t_cholmod_super_numeric.c:25:21: fatal error: Rconfig.h: No such file or directory


wget https://github.com/igraph/rigraph/archive/v1.1.0.tar.gz
tar -zxvf v1.1.0.tar.gz

rigraph-1.1.0
install.packages("./v1.1.0.tar.gz", repos = NULL, type = "source")

install.packages("https://cran.r-project.org/src/contrib/Archive/igraph/igraph_1.0.0.tar.gz", repo=NULL, type="source")
install.packages(u, type = "binary", repos = NULL)
install.packages("v1.1.0.tar.gz", repos = NULL, type="source")
R CMD INSTALL v1.1.0.tar.gz

+Z_F~Q!=mHch

/usr/include/R

> R.home("lib")
[1] "/usr/lib64/R/lib"

Error: Protected multilib versions

#yum install R-devel

Error: Protected multilib versions: libRmath-3.5.2-2.el6.i686 != libRmath-3.6.0-1.el6.x86_64
Error: Protected multilib versions: R-java-devel-3.5.2-2.el6.i686 != R-java-devel-3.6.0-1.el6.x86_64

sudo yum remove openssh
sudo yum remove libRmath
sudo yum remove R-java-devel

yum --enablerepo=epel-testing install R-devel

install.packages("igraph")

yum remove gcc-gfortran
gfortran --version
yum remove R-devel

yum --enablerepo=epel-testing install gcc-gfortran

yum remove devtoolset*
gcc --version

in this c++ version is 2010


../build_gcc_4.8.1/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

tar -zxvf gcc-4.8.5.tar.bz2
CentOS 6將於202011月死亡-遷移宜早不宜遲! https://forums.centos.org/viewtopic.php?t=68077

install.packages("readxl")

library(plumber)
library(igraph)
plumber::plumb(file='./plumber.R')$run( port = 442,host="0.0.0.0")
plumber::plumb(file='./test.R')$run( port = 58903,host="0.0.0.0")

install.packages("plumber")

```R test.py
library(plumber)

#* @method /url

#* Echo provided text
#* @param text The text to be echoed in the response
#* @get /echo
function(text = "") {
list(
message_echo = paste("The text is:", text)
)
}

Starting server to listen on port 5762
Running the swagger UI at http://127.0.0.1:5762/__swagger__/

curl “http://127.0.0.1:5762/echo" –header “Content-type:application/json” -X POST -d @path/file

curl –data “text=hi_my_friend” “http://127.0.0.1:3000/echo"

https://arch-backend.com:58903

人生真的好不公平,我好想自殺。

不是我的錯八.. 為甚麼我會有這種際遇

{standard input}:161003: Error: unknown pseudo-op: ‘.lbb’
{standard input}:161003: Error: open CFI at the end of file; missing .cfi_endproc directive

install.packages(“nloptr”)
ERROR: configuration failed for package ‘nloptr’

ERROR: no information for variable ‘AR’ cru .libs/libutil.a .libs/mt19937ar.o .libs/sobolseq.o .libs/timer.o .libs/stop.o .libs/redblack.o .libs/qsort_r.o .libs/rescale.o
../libtool: line 1102: ERROR:: command not found

library(remotes)
remotes::install_version(‘doBy’, version = ‘4.5-15’ )
library(doBy)

http://132.148.26.6:58903/echo?text=123

Rscript plumber::plumb(file=’./plumber.R’)$run( port = 58903,host=”0.0.0.0”)
Rscript demo.R &
```

  • 版權聲明: 本部落格所有文章除有特別聲明外,均採用 Apache License 2.0 許可協議。轉載請註明出處!
  • © 2020-2024 John Doe
  • Powered by Hexo Theme Ayer
  • PV: UV: