2

I'm using Amazon Linux 2, t2.large.

I understand the reason why I could not run rmarkdown::run() is because pandoc was not installed/configured correctly. After Googling for hours, I tried Sys.getenv("RSTUDIO_PANDOC") (empty result); I tried rmarkdown not working due to pandoc, but apt-get was not found; I tried downloading pandoc and move pandoc and pandoc-citeproc to /usr/lib/rstudio-server/bin/pandoc/pandocaccording to https://rmarkdown.rstudio.com/docs/articles/pandoc.html, but the error about pandoc not available remained; I tried to follow this page https://pandoc.org/installing.html#linux, but I was stuck at the first step after downloading pandoc under the Linux section, the error was command dpkg not found.

It is difficult because I'm not sure how to get common commands such as apt-get to work in Amazon Linux and many of the packages I need do not exist in amazon-linux-extras or yum install.

To set up, I ran the code below:

sudo su

amazon-linux-extras install R3.4

wget https://download2.rstudio.org/rstudio-server-rhel-1.0.153-x86_64.rpm --no-check-certificate
yum install -y --nogpgcheck rstudio-server-rhel-1.0.153-x86_64.rpm
rm rstudio-server-rhel-1.0.153-x86_64.rpm
R -e "install.packages('shiny', repos='http://cran.rstudio.com/')"
R -e "install.packages('rmarkdown', repos='http://cran.rstudio.com/')"

To run the .rmd file:

R
library(shiny)
library(rmarkdown)
rmarkdown::run(file = "placeholder.Rmd", shiny_args = list(host = 'my.ip', port = X, launch.browser = F))

pandoc version 1.12.3 or higher is required and was not found

Please note I can run Shiny example using this:

runExample('01_hello', host = 'my.ip', port = X, launch.browser = F)

1 Answers1

0

Amazon Linux 2 is not Debian-based. It is closer to a CentOS flavor. As such, it uses yum and not apt-get.

To install pandoc, you may try:

sudo yum -y install epel-release
sudo yum -y install pandoc --enablerepo=epel

Credit: this comment here on a GitHub repo.

Pierre D
  • 24,012
  • 7
  • 60
  • 96