title: After installing RStudio server on CentOs Linux, Cannot Install Packages non zero exit status
body: <p>Have read and tried various solutions to what sound like similar problems including:</p>
  
  <p><a href="https://stackoverflow.com/questions/17360158/cannot-install-rstudio-on-centos-6-4">Cannot install RStudio on CentOS 6.4</a></p>
  
  <p><a href="https://stackoverflow.com/questions/45010740/installing-package-sjstats-gives-error-non-zero-exit-status">installing package &quot;sjstats&quot; gives error non-zero exit status</a></p>
  
  <p><a href="https://stackoverflow.com/questions/45358976/unable-to-install-sandwich-package-installation-of-package-sandwich-had-non-z">Unable to install sandwich package: installation of package ‘sandwich’ had non-zero exit status</a></p>
  
  <p><a href="https://stackoverflow.com/questions/33773622/installation-of-package-recharts-had-non-zero-exit-status">installation of package ‘recharts’ had non-zero exit status</a></p>
  
  <p>I've installed RStudio on Linux Centos7.</p>
  
  <p>I downloaded and installed both R and Rstudio as root user. After opening port 8787 I was able to visit the application in my browser and reach the login page. RStudio would not allow me to login with the root user so I created a new user 'rstudio' in the terminal <code>sudo adduser rstudio</code>, created a password for rstudio user and then was able to login.</p>
  
  <p>R works till this point. I am able to use base R, save scripts etc all within Linux CentOs hosted RStudio within my browser.</p>
  
  <p>However, when I try to install any package, I receive an error message e.g.</p>
  
  <pre><code>Warning in install.packages :
    installation of package ‘covr’ had non-zero exit status
  </code></pre>
  
  <p>This happens for every and any package that I try to install.</p>
  
  <p>I tried changing permissions to 777 on R directory within /home/rstudio/R. I did this as the original root user who downlaoded and installed R and RStudio, not as the new end user "rstudio".</p>
  
  <p>This did not solve my problem.</p>
  
  <p>I tried adding <code>dependencies = T</code> to all of my calls to <code>install.packages()</code> however that did not make a difference.</p>
  
  <p>I suspect that it's a permissions issue. However, I also tried to install packages from within R on the command line and could not, even when I was SSHd in as root.</p>
  
  <p>Not sure what other information to provide.</p>
  
  <p>How can I install packages and overcome 'non zero exit status' from within my instance of Hosted RStudio?</p>
  
  <pre><code>sessionInfo()
  R version 3.5.0 (2018-04-23)
  Platform: x86_64-redhat-linux-gnu (64-bit)
  Running under: CentOS Linux 7 (Core)
  
  Matrix products: default
  BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
  
  locale:
   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
   [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
  [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  loaded via a namespace (and not attached):
  [1] compiler_3.5.0 tools_3.5.0    yaml_2.2.0    
  </code></pre>