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

ubuntu 16上的闪亮服务器错误:“1”;无法打开与X11显示器的连接'';,ubuntu,shiny,rstudio,shinydashboard,Ubuntu,Shiny,Rstudio,Shinydashboard,我试图在Ubuntu16AWSEC2上运行一个闪亮的仪表板,该示例部分工作正常:它显示仪表板控件,但显示错误消息,而不是图形 在/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 di

我试图在Ubuntu16AWSEC2上运行一个闪亮的仪表板,该示例部分工作正常:它显示仪表板控件,但显示错误消息,而不是图形

在/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
在安装R之前,我尝试了几个软件包:xorg dev和libx11 dev 但他们没有帮助:


错误图像:

我在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,这对于我的案例来说是最新的

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