RStudio Server Guide: Difference between revisions
Initial |
syntax Tag: 2017 source edit |
||
Line 1: | Line 1: | ||
= RStudio Server Guide = | |||
Return to [[server-guides.md|Server Guides]] | |||
Return to [[research.md|Research]] | |||
This guide is based on the [https://davetang.org/muse/2021/04/24/running-rstudio-server-with-docker/ RStudio Server Guide]. It is designed to help you get started with RStudio Server, a web-based interface for R programming. RStudio Server allows you to run R and RStudio in a web browser, providing a flexible and accessible data analysis and visualization environment. | |||
== Requirements == | |||
* Docker installed on your system. | |||
* Basic understanding of Docker commands and R programming. | |||
< | == Steps to Set Up RStudio Server with Docker == | ||
=== Pull the RStudio Docker Image === | |||
<pre> | |||
docker pull rocker/rstudio | |||
</pre> | |||
=== Create a Dockerfile === | |||
Include necessary system dependencies and R packages in your Dockerfile: | |||
<pre> | |||
FROM rocker/rstudio | |||
RUN apt clean all && \ | RUN apt clean all && \ | ||
Line 32: | Line 44: | ||
RUN Rscript -e "install.packages(c('rmarkdown', 'tidyverse', 'workflowr', 'shiny', 'blogdown', 'bookdown', 'learnr', 'xaringan', 'rticles', 'pkgdown', 'devtools', 'usethis', 'testthat', 'roxygen', 'rhub', 'covr', 'rmarkdown', 'knitr', 'dplyr', 'readr', 'packrat', 'rsconnect'))" | RUN Rscript -e "install.packages(c('rmarkdown', 'tidyverse', 'workflowr', 'shiny', 'blogdown', 'bookdown', 'learnr', 'xaringan', 'rticles', 'pkgdown', 'devtools', 'usethis', 'testthat', 'roxygen', 'rhub', 'covr', 'rmarkdown', 'knitr', 'dplyr', 'readr', 'packrat', 'rsconnect'))" | ||
WORKDIR /home/rstudio</ | WORKDIR /home/rstudio | ||
</pre> | |||
< | === Build Your Custom Docker Image === | ||
<pre> | |||
docker build -t my-rstudio . | |||
</pre> | |||
< | === Run Your Custom Container === | ||
<pre> | |||
docker run -d -p 8787:8787 -e PASSWORD=yourpassword my-rstudio | |||
</pre> | |||
< | === Run Multiple Instances (Optional) === | ||
docker run -d -p 8789:8787 -e USER=user2 -e PASSWORD=user2password my-rstudio</ | You can run multiple RStudio Server instances for different users by specifying unique ports and credentials: | ||
<pre> | |||
docker run -d -p 8788:8787 -e USER=user1 -e PASSWORD=user1password my-rstudio | |||
docker run -d -p 8789:8787 -e USER=user2 -e PASSWORD=user2password my-rstudio | |||
</pre> | |||
< | === Combined Commands for Quick Setup === | ||
<pre> | |||
docker pull rocker/rstudio | |||
touch Dockerfile | touch Dockerfile | ||
echo "FROM rocker/rstudio" >> Dockerfile | echo "FROM rocker/rstudio" >> Dockerfile | ||
Line 71: | Line 91: | ||
echo "WORKDIR /home/rstudio" >> Dockerfile | echo "WORKDIR /home/rstudio" >> Dockerfile | ||
docker build -t my-rstudio . | docker build -t my-rstudio . | ||
docker run -d -p 8787:8787 -e PASSWORD=yourpassword my-rstudio</ | docker run -d -p 8787:8787 -e PASSWORD=yourpassword my-rstudio | ||
</pre> | |||
== Notes and References == | |||
* For more details, see the original source: [https://davetang.org/muse/2021/04/24/running-rstudio-server-with-docker/ Dave Tang's RStudio Guide]. | |||
* For more information on RStudio Server, visit [https://www.rstudio.com/products/rstudio/rstudio-server/ RStudio Server Official Site]. | |||
[[Category:Server Guides]] | |||
[[Category:Docker]] | |||
[[Category:RStudio]] | |||
[[Category:Research Tools]] |
Revision as of 18:46, 3 December 2024
RStudio Server Guide
Return to Server Guides Return to Research
This guide is based on the RStudio Server Guide. It is designed to help you get started with RStudio Server, a web-based interface for R programming. RStudio Server allows you to run R and RStudio in a web browser, providing a flexible and accessible data analysis and visualization environment.
Requirements
- Docker installed on your system.
- Basic understanding of Docker commands and R programming.
Steps to Set Up RStudio Server with Docker
Pull the RStudio Docker Image
docker pull rocker/rstudio
Create a Dockerfile
Include necessary system dependencies and R packages in your Dockerfile:
FROM rocker/rstudio RUN apt clean all && \ apt update && \ apt upgrade -y && \ apt install -y \ libhdf5-dev \ libcurl4-gnutls-dev \ libssl-dev \ libxml2-dev \ libpng-dev \ libxt-dev \ zlib1g-dev \ libbz2-dev \ liblzma-dev \ libglpk40 \ libgit2-dev \ && apt clean all && \ apt purge && \ rm -rf /var/lib/apt/lists/'' /tmp/'' /var/tmp/'' RUN Rscript -e "install.packages(c('rmarkdown', 'tidyverse', 'workflowr', 'shiny', 'blogdown', 'bookdown', 'learnr', 'xaringan', 'rticles', 'pkgdown', 'devtools', 'usethis', 'testthat', 'roxygen', 'rhub', 'covr', 'rmarkdown', 'knitr', 'dplyr', 'readr', 'packrat', 'rsconnect'))" WORKDIR /home/rstudio
Build Your Custom Docker Image
docker build -t my-rstudio .
Run Your Custom Container
docker run -d -p 8787:8787 -e PASSWORD=yourpassword my-rstudio
Run Multiple Instances (Optional)
You can run multiple RStudio Server instances for different users by specifying unique ports and credentials:
docker run -d -p 8788:8787 -e USER=user1 -e PASSWORD=user1password my-rstudio docker run -d -p 8789:8787 -e USER=user2 -e PASSWORD=user2password my-rstudio
Combined Commands for Quick Setup
docker pull rocker/rstudio touch Dockerfile echo "FROM rocker/rstudio" >> Dockerfile echo "RUN apt clean all && \\" >> Dockerfile echo " apt update && \\" >> Dockerfile echo " apt upgrade -y && \\" >> Dockerfile echo " apt install -y \\" >> Dockerfile echo " libhdf5-dev \\" >> Dockerfile echo " libcurl4-gnutls-dev \\" >> Dockerfile echo " libssl-dev \\" >> Dockerfile echo " libxml2-dev \\" >> Dockerfile echo " libpng-dev \\" >> Dockerfile echo " libxt-dev \\" >> Dockerfile echo " zlib1g-dev \\" >> Dockerfile echo " libbz2-dev \\" >> Dockerfile echo " liblzma-dev \\" >> Dockerfile echo " libglpk40 \\" >> Dockerfile echo " libgit2-dev \\" >> Dockerfile echo " && apt clean all && \\" >> Dockerfile echo " apt purge && \\" >> Dockerfile echo " rm -rf /var/lib/apt/lists/'' /tmp/'' /var/tmp/''" >> Dockerfile echo "RUN Rscript -e \"install.packages(c('rmarkdown', 'tidyverse', 'workflowr', 'shiny', 'blogdown', 'bookdown', 'learnr', 'xaringan', 'rticles', 'pkgdown', 'devtools', 'usethis', 'testthat', 'roxygen', 'rhub', 'covr', 'rmarkdown', 'knitr', 'dplyr', 'readr', 'packrat', 'rsconnect'))\"" >> Dockerfile echo "WORKDIR /home/rstudio" >> Dockerfile docker build -t my-rstudio . docker run -d -p 8787:8787 -e PASSWORD=yourpassword my-rstudio
Notes and References
- For more details, see the original source: Dave Tang's RStudio Guide.
- For more information on RStudio Server, visit RStudio Server Official Site.