How to install additional packages

Hi,

I installed a local shiny server on a Ubuntu 20.04 LTS. The R web app works correctly, I have tested in RStudio.
But when I try to deploy it on a shiny server it's missing packages and after I install them via the R console, it continues to tell me I'm missing the packages.

After a little google search, some people tell me it's because of the user in which it runs de shiny server service. I don't know if it's my case or not.

thank you and good day.

Yes, most likely, to overcome this problem install the packages as superuser from a system terminal with a command like this

sudo su - -c "R -e \"install.packages('package_name', repos='http://cran.rstudio.com/')\""

I tried it.
It doesn't work, but I did notice that all packages were installed in the "R" folder under /root/.

I tried the following:
su shiny
bash
R
install.packages('package_name')

Looks like it works. Is there a way to create one shot command to do that ?

Thanks

That suggests you have messed with the default package library location, under a standard configuration installing as superuser is enough. The downside of installing as shiny is that you are limited to run your applications only as shiny but if you are not going to modify your shiny-server config file I suppose it doesn't matter.

Do you mean from R? maybe you could create a wrapper function that constructs a system call but since you are not going to be installing packages for your shiny applications every day I think it is not worth it.

For the installation of the Shiny Server, I followed the simple steps explained. The only thing I modified was the web port.

I did use the command you said when installing "shiny".
sudo su - -c "R -e "install.packages('shiny', repos='https://cran.rstudio.com/')""

But if I use the same command to install another package it installs correctly but the App log tells me it's not installed.