R Environment in Linux

2016/02/04

Installation in Debian 9

as sudo

# as sudo
apt get-update
apt get-upgrade
apt install htop -y
apt install git -y
apt-get install xclip -y
echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | tee -a /etc/apt/sources.list
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 -y
gpg -a --export E084DAB9 | apt-key add -
apt-get update
apt-get install r-base r-base-dev -y
apt-get install r-cran-littler
apt-get install libcurl4-openssl-dev libxml2-dev libssl-dev libfreetype6-dev libcairo-dev -y
apt-get install libgdal1-dev libproj-dev -y
apt install libssl-dev
apt install libssh2-1-dev
apt install libcurl4-openssl-dev
apt install libxml2-dev
apt install libpoppler-cpp-dev
apt install libmariadbclient-dev
apt install libmariadb-client-lgpl-dev 
apt install pandoc

as user

# as user
R -e 'install.packages("devtools", repos = "https://cloud.r-project.org")' 
R -e 'devtools::install_github("rstudio/flexdashboard")' 
R -e 'devtools::install_github("rstudio/rmarkdown")' 
R -e 'devtools::install_github("stattleship/stattleship-r")' 

Shiny Server

Locations and commands

Configuration file

/etc/shiny-server/shiny-server.conf

Log file

/var/log/shiny-server.log

Location of hosted apps and files

/srv/shiny-server/

R packages for Shiny user

/usr/local/lib/R/site-library/

Databases

Controller

Check open database connections by typing

SHOW STATUS LIKE 'Conn%'; -- show open connections

and to restart service command terminal:

$ service mysql restart
$ service mysqld restart
$ /etc/init.d/mysqld restart

MediaGarden (ftp)

Install curlftpfs

sudo apt-get install curlftpfs -y

Mount ftp with curlftpfs using /etc/fstab

Since we do not want put any passwords to /etc/fstab file we will first create a /root/.netrc file with a ftp username and password using this format:

sudo nano /root/.netrc
machine 192.168.290
login pi
password ftp-pass

Now change permissions of this file to 600:

sudo chmod 600 /root/.netrc

Check uid and gid of your non-root user. This user will have a access to ftp mount directory:

id

In the next step add a following line to your /etc/fstab file ( change credentials for your ftp user ):

sudo nano /etc/fstab
curlftpfs#192.168.2.90 /mnt/MediaGarden fuse allow_other,uid=1000,gid=1000,umask=0022 0 0

Now mount ftp with:

mount -a