Extension:Shiny/Ubuntu 14.04 LTS
For installing the Shiny extension are three or four steps are necessary:
- Install a current R version
- Install the Shiny server
- Install the Shiny extension
- Optionally tweak the Apache configuration
For all steps it is assumed that a LAMP server and MediaWiki is installed and you are logged in as root
.
R
editYou may install a R version which comes with your linux distribution by
apt-get install r-recommended
However, the instructions for the Shiny server urge to use the latest R version which may not (yet) part of the repositories of your linux distribution.
- Therefore you need to add a CRAN repository to the file
/etc/apt/sources.list
deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu trusty/
- See https://cran.r-project.org/mirrors.html for the list of CRAN mirrors
- Then run
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 apt-get update apt-get install r-recommended
After that R should have been installed (or updated) from the choosen CRAN mirror.
Shiny server
edit- Install the
shiny
package in R
R -e "install.packages('shiny', repos='https://cran.rstudio.com/')"
- Install the
gdebi
package
apt-get install gdebi-core
- Download the Shiny server (check if the version
1.4.2.786
still is okay)
wget https://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.4.2.786-amd64.deb
- Install the Shiny server to your system
gdebi shiny-server-1.4.2.786-amd64.deb
- To check if the shiny server works enter in your browser:
http://<my.domain>:3838
- Add a path and permissions to store the shiny apps
cd /srv/shiny-server mkdir mediawiki chown www-data:www-data mediawiki
MediaWiki
edit- After the installation of your wiki go to the
extensions
directory
cd <my.wiki>/extensions
- If necessary then install
git
apt-get install git
- Clone the Shiny extension from
github.com
git clone https://github.com/sigbertklinke/Shiny
- Edit your
<my.wiki>/LocalSettings.php
and add at the end
wfLoadExtension( 'Shiny' );
Apache
editThe Apache webserver listens to port 80 and the Shiny server to port 3838. Usually I modify the Apache configuration file such that any URL with starts with http://<my.domain>/shiny
is redirected to the Shiny server:
- Go to the Apache configuration directory
cd /etc/apache2
- Enable the
proxy_http
module
a2enmod proxy_http
- Edit the Apache configuration file
/etc/apache2/sites-available/000.default.conf
and add at the end
<VirtualHost *:80> ... some other config stuff ... <Proxy /shiny/> Allow from localhost </Proxy> ProxyPreserveHost On ProxyPass /shiny/ http://localhost:3838/ ProxyPassReverse /shiny/ http://localhost:3838/ </VirtualHost>
- Restart the apache server
service apache2 restart
- To check if this works properly enter in your browser:
http://<my.domain>/shiny/
(and when you enterhttp://<my.domain>:3838/
you should see the same page)