问题描述
我已经在CentOS6上成功构建并安装了OpenCPU和RStudio服务器.一切都按预期进行,并且我的本地R软件包确实获得了成功的GET/POST响应.
I've successfully built and installed OpenCPU and RStudio Server on a CentOS6. Everything is working as expected, and I do get successful GET/POST responses for my local R packages.
一些似乎不起作用的事情:
A couple of things that don't seem to work however:
- 我找不到启动/停止/刷新OpenCPU的干净方法.我当前正在使用
apachectl restart
,但是我什至不确定是否确实可以按预期方式重新加载R程序包.我在/usr/lib/opencpu/scripts
上尝试了Jeroen的bash脚本,但是它们似乎需要大量调整才能在CentOS上工作. - (可能与上面有关)我正在
/etc/opencpu/Renviron
文件中使用load()
和readRDS()
(也在/etc/opencpu/Rprofile
中尝试过)将持久数据集加载到全局环境中-但这似乎不起作用.我没有收到任何错误日志,但是对象在后续请求中不可用. 在Ubuntu上的 - OpenCPU似乎已配置为在
opencpu
用户下运行.在CentOS6上,它似乎在安装后在root
下运行.我想修改它,但不确定如何.
- I can't figure a clean way to start/stop/flush OpenCPU. I'm currently using
apachectl restart
but I'm not even sure that does reload R packages as expected. I tried Jeroen's bash scripts at/usr/lib/opencpu/scripts
but they seem to require quite a bit of tweaking to work on CentOS. - (maybe related to above) I am using
load()
andreadRDS()
in/etc/opencpu/Renviron
file (also tried in/etc/opencpu/Rprofile
) to load persistent datasets into the global environment -- but that doesn't seem to work. I don't get any error log, but the objects are not available in subsequent requests. - on Ubuntu OpenCPU seems configured to run under an
opencpu
user. On CentOS6 it seems to run underroot
after installation. I'd like to modify that, but not sure how.
只是想知道是否有人在CentOS6上成功配置了OpenCPU.
Just wondering if someone has has success configuring OpenCPU on CentOS6.
非常感谢,-梅尔.
推荐答案
一些答案
-
正在运行
sudo apachectl restart
将重新启动. rpm中目前没有针对opencpu的特殊初始化或systemd脚本,但基本上,该脚本在ubuntu上所做的全部工作是重新启动apache并向终端打印一些消息.
Running
sudo apachectl restart
will do the restart. There is currently no special init or systemd script for opencpu included with the rpm, but basically all that script does on ubuntu is restart apache and print some messages to the terminal.
REnviron
文件仅用于环境变量.您需要使用RProfile
作为自定义代码.另请参见帮助.也许它没有在正确的环境中加载.尝试:load(file, envir = globalenv(), verbose = TRUE)
.
The REnviron
file is only for environment variables. You need to use RProfile
for custom code. See also help. Maybe it doesn't get loaded in the right environment. Try: load(file, envir = globalenv(), verbose = TRUE)
.
请注意,建议的存储方式是将其放在R包中,作为延迟加载数据或sysdata.rda
(请参见编写R扩展名).然后,您可以在启动时加载或附加程序包,或者更好的方法是:从包含您的应用程序或R函数的程序包中正式导入数据集.
Note that the recommended way to store stuff is by putting it an R package, either as lazyload data or sysdata.rda
(see writing R extensions). You can then load or attach the package on startup, or better yet: formally import the dataset from the package that contains your application or R functions.
Afaik,centos以用户apache
的身份运行httpd请求吗?是什么让您认为opencpu以root身份运行?那当然不是意图.在CentOS上,有时您需要使用SELinux httpd标志来使您的应用程序正常工作,另请参见 rpm自述文件.
Afaik, centos runs httpd requests as user apache
? What makes you think opencpu runs as root? That is certainly not the intention. On CentOS you sometimes need to play around with SELinux httpd flags to get your applications to work, see also the rpm readme.
rpm软件包比debian软件包更新一些,并且测试较少,因此,如果您有任何问题或建议,请在github上打开一个问题.
The rpm packages are a bit more recent and less tested than the debian ones, so if you have problems or suggestions, please open an issue on github.
这篇关于如何在CentOS6上启动/停止/刷新OpenCPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!