# Config files:
https://support.rstudio.com/hc/en-us/articles/200552316-Configuring-the-Server
/etc/rstudio/rserver.conf # might help to set server-app-armor-enabled=0
/etc/rstudio/rsession.conf
# Working installation on WSL:
cd /etc/init.d
wget https://raw.githubusercontent.com/rstudio/rstudio/master/src/cpp/server/extras/init.d/debian/rstudio-server.in
# Replace {CMAKE} path with /usr/lib/rstudio-server
mv rstudio-server.in rstudio-server
chmod 777 rstudio-server
# Start/stop server through this file
/etc/init.d/rstudio-server start
# May also need to create a new user:
adduser rstudio
# Troubleshooting: https://github.com/rstudio/rstudio/blob/master/src/cpp/r/session/RDiscovery.cpp
cd /usr/lib/rstudio-server/bin
./rsession --log-stderr 1
cat /var/log/syslog
cat /var/log/messages
cat /var/lib/rstudio-server/monitor/log/rstudio-server.log
# Add entries to /etc/environment
export R_HOME=/usr/lib/R #important! LIB not BIN, BIN is a .sh file
export R_DOC_DIR=/usr/share/R/doc
export R_INCLUDE_DIR=/usr/share/R/include
export R_SHARE_DIR=/usr/share/R/share
export EDITOR=vim
#https://github.com/Microsoft/BashOnWindows/issues/791
#https://support.rstudio.com/hc/en-us/community/posts/202190728-install-rstudio-server-error