Offering another solution, and that is to specify the user library as the location rather than the shiny
library which uses the /usr/local/lib/R/site-library
library location to your user name.
In bash
open the shiny-server configuration file
sudo nano /etc/shiny-server/shiny-server.conf
Then change the run_as
from the shiny
user to your own username soran
# Define the user we should use when spawning R Shiny processes
#run_as shiny; # old line
run_as soran;
# Define a top-level server which will listen on a port
server {
# Instruct this server to listen on port 3838
listen 3838;
....
After changing the file stop the server and start it again so the new configuration is loaded.
sudo systemctl stop shiny-server
sudo systemctl start shiny-server
This will change all shiny apps served by your server to use the users R
library. I would also recommend not using a user with admin or root privileges for security.
It is possible to only specify the users R
library to specific applications. To do this you need to specify certain shiny app subdirectories to load under that users r profile by using run_as
with the subdirectory name in location. See the following documentation for more details.
https://docs.posit.co/shiny-server/#stopping-and-starting
sudo -i
), open R, and install it there. Then the package will be site-wide. – Abortion