Skip to content

Latest commit

 

History

History
 
 

debian

Building OpenCPU on Debian/Ubuntu

How to build OpenCPU on Debian or Ubuntu

Prepare: update R (optional, but recommended)

Because r-base packages included with Debian/Ubuntu are often old, we first add a repository with a recent version of R. On Ubuntu we can use Michael Rutter's launchpad repository:

sudo add-apt-repository -y ppa:marutter/rrutter4.0
sudo apt-get update

Alternatively, on Debian use r-base packages from CRAN (see details). For example on Debian 10.0 ("buster")

# Become root
sudo -i

# Add Wheezy CRAN repo for R 3.0+
apt-key adv --keyserver keyserver.ubuntu.com --recv-key 381BA480
echo "deb http://cran.rstudio.com/bin/linux/debian buster-cran40/" > /etc/apt/sources.list.d/cran.list
apt-get update

# Quit root
exit

Build OpenCPU Server from Source

First make sure your system is up-to-date: dependencies required for building OpenCPU:

sudo apt-get update
sudo apt-get dist-upgrade -y

Download the opencpu-server sources from Github:

cd ~
wget https://github.com/opencpu/opencpu-server/archive/v2.2.tar.gz
tar xzf v2.2.tar.gz
cd opencpu-server-2.2

Install build dependencies from within opencpu-server source dir (requires root):

sudo mk-build-deps -i

Finally to build OpenCPU Server packages (opencpu-server and opencpu-cache): run this as not root user:

dpkg-buildpackage -us -uc

Installing OpenCPU server

To install the cloud server, simply install the deb packages in the following order:

cd ~
sudo apt-get install libapache-mod-r-base
sudo dpkg -i opencpu-lib_*.deb
sudo dpkg -i opencpu-server_*.deb

You're done! Test if it works:

curl http://localhost/ocpu/info

This should print some info about the R session.

OpenCPU caching server (not recommended)

The opencpu-cache package is a reverse proxy for caching and load balancing with OpenCPU. When installed, it automatically preroutes all incomming traffic on ports 80 and 443 through nginx. Only install this when you expect serious traffic.

# Dependencies
sudo apt-get install nginx

# Package builds
cd ~
sudo dpkg -i opencpu-cache_*.deb

Note that it is possible to install opencpu-cache on another server than opencpu-server if you update the nginx back-end config accordingly.