ubuntu 16上的闪亮服务器错误:“无法打开与X11显示器的连接”

时间:2018-07-29 02:12:05

标签: ubuntu shiny rstudio shinydashboard

我正在尝试在Ubuntu 16 aws ec2上运行一个闪亮的仪表板,并且该示例部分起作用:它显示了仪表板控件,但显示了错误消息而不是图形。

错误注销位于/ var / log / shinyserver:

Listening on http://127.0.0.1:35434
Warning in pngfun(filename = filename, width = width, height = height, res = res,  :
  unable to open connection to X11 display ''
Warning: Error in .External2: unable to start device PNG
  123: pngfun
  122: startPNG
  121: drawPlot
  107: <reactive:plotObj>
   91: drawReactive
   78: origRenderFunc
   77: output$distPlot
    1: runApp

从/ etc / shiny-server的Shiny-server.conf中:

# Instruct Shiny Server to run applications as the user "shiny"
run_as ubuntu;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

在安装R之前,我尝试了一些软件包:xorg-dev和libx11-dev 但是他们没有帮助:

错误图片:enter image description here

1 个答案:

答案 0 :(得分:0)

我通过r-base安装R-3.4.0时出现错误,该错误不能包含对x11的支持。正确的方法是先更新密钥,这里:

apt-get install -y qpdf libx11-dev libpng12-dev libjpeg62
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base

代替:

wget https://cran.r-project.org/src/base/R-3/R-3.4.0.tar.gz
tar -xzf R-3.4.0.tar.gz
./configure --with-x=yes --enable-R-shlib=yes --with-cairo=yes – without-x11
make
make install

第一个安装了3.4.0 base r,对于我的情况来说,这是最新的。