CentOS 6.5 无网环境安装R及Rstudio的方法的方法

在生产环节,一般是不联网的,下面介绍在无望环境如何安装R及R-studio

1.  安装CentOS for R语言的基础环境

1.1 libpng,X11,libjpeg等支持

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel

1.2 gcc编译环境支持

yum install gcc-gfortran

yum install gcc gcc-c++ 

yum install readline-devel 

yum install libXt-devel

1.3 vnc-server,openssl,xhost+

yum install openssl

yum -y install vnc vnc-server

yum -y install tigervnc-server

PS:vnc-server常用命令

service vncserver start

service vncserver stop

vncserver -kill :10

vi /etc/sysconfig/vncservers

VNCSERVERS="5:hive"

VNCSERVERARGS[5]="-geometry 800x600”

export DISPLAY=:0

xhost +

ps -ef |grep vnc

ps -aux |grep vnc

2.  编译安装R语言的基础环境

在R官网(尽量选择国内镜像)下载你所需要R语言版本,我下载的是R-3.2.2

https://mirrors.tuna.tsinghua.edu.cn/CRAN/

wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-3/R-3.2.3.tar.gz

tar -zxvf R-3.2.3.tar.gz

./configure --enable-R-shlib--with-libpng --with-jpeglib --with-libtiff --with-x
make clean
make
make install

3. 安装Rstudio Server

wget https://download2.rstudio.org/rstudio-server-rhel-1.0.136-x86_64.rpm
yum install --nogpgcheck rstudio-server-rhel-1.0.136-x86_64.rpm

关闭服务器的防火墙,或者打开8787端口

登录http://ip地址:8787

输入capabilities()

显示如下代表正常,这里面jpeg png X11支持(TRUE代表支持),是在线进行R画图的重要驱动,如果显示False则不能够在Rstudio-Server中画图,那样我们搭建Rstudio Server就没有意义了

> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp
TRUE TRUE FALSE FALSE TRUE FALSE TRUE
sockets libxml fifo cledit iconv NLS profmem
TRUE TRUE TRUE TRUE TRUE TRUE FALSE
cairo ICU long.double libcurl
FALSE FALSE TRUE FALSE
常见错误错误会显示如下
> capabilities()
  no protocol specified
jpeg png tiff tcltk X11 aqua http/ftp
FALSE    FALSE    FALSE     FALSE FALSE FALSE TRUE
    sockets   libxml     fifo    cledit     iconv     NLS   profmem
    TRUE     TRUE      TRUE     TRUE     TRUE     TRUE    FALSE
    cairo     ICU     long.double  libcurl
    FALSE     FALSE     TRUE     FALSE
上述是由于没有开放X环境权限,所有的解决方案只要按照这个方向就能找到,我的最终生效的调试步骤如下:

4. 调试过程

[root@bonnie1 ~]# xdpyinfo

xdpyinfo:  unable to open display "bonnie1:1".

[root@bonnie1 ~]# export DISPLAY=:0

[root@bonnie1 ~]# xdpyinfo

name of display:    :0

version number:    11.0

vendor string:    Red Hat, Inc.

vendor release number:    11300000

maximum request size:  16777212 byte

motion buffer size:  256

bitmap unit, bit order, padding:    32, LSBFirst, 32

image byte order:    LSBFirst

number of supported pixmap formats:    7

supported pixmap formats:

depth 1, bits_per_pixel 1, scanline_pad 32

depth 4, bits_per_pixel 8, scanline_pad 32

depth 8, bits_per_pixel 8, scanline_pad 32

depth 15, bits_per_pixel 16, scanline_pad 32

depth 16, bits_per_pixel 16, scanline_pad 32

depth 24, bits_per_pixel 32, scanline_pad 32

… …

[root@bonnie1 ~]# xhost +

access control disabled, clients can connect from any host

[root@bonnie1 ~]# su - hive

[hive@bonnie1 ~]$ xhost +

access control disabled, clients can connect from any host

[root@bonnie1 ~]# ps -ef |grep vnc

hive      1951     1  0 14:41 pts/0    00:00:00 /usr/bin/Xvnc :1 -desktop bonnie1:1 (hive) -auth /home/hive/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /home/hive/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn

hive      1957  1956  0 14:41 pts/0    00:00:00 vncconfig -iconic

root     23069  2339  0 18:14 pts/0    00:00:00 grep vnc

[root@bonnie1 ~]# ps -aux |grep vnc

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

hive      1951  0.0  2.9 129648 30100 pts/0    S    14:41   0:00 /usr/bin/Xvnc :1 -desktop bonnie1:1 (hive) -auth /home/hive/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /home/hive/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn

hive      1957  0.0  0.2  50152  2092 pts/0    S    14:41   0:00 vncconfig -iconic

root     23071  0.0  0.0 103264   840 pts/0    S+   18:14   0:00 grep v

[hive@bonnie1 ~]$ ps -ef |grep vnc

hive      1951     1  0 14:41 pts/0    00:00:00 /usr/bin/Xvnc :1 -desktop bonnie1:1 (hive) -auth /home/hive/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /home/hive/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn

hive      1957  1956  0 14:41 pts/0    00:00:00 vncconfig -iconic

hive     23063 23032  0 18:13 pts/0    00:00:00 grep vnc

上一篇:Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.RequestContext


下一篇:AJAX缓存清理