# Requires Ubuntu 24.04 (Noble) or 22.04 (Jammy)
sudo add-apt-repository -y ppa:opencpu/opencpu-2.2
sudo apt-get update
sudo apt-get upgrade
# Installs OpenCPU server
sudo apt-get install -y opencpu-server
# Done! Open http://yourhost/ocpu in your browser
# Optional: installs rstudio in http://yourhost/rstudio
sudo apt-get install -y rstudio-server
Go here to add the opencpu repository. Also have look at the readme for rpm packages.
# Need to add repo first! (See link above)
sudo yum install opencpu-server
Either download binary builds from our archive, or consult the readme for building deb or rpm packages from source for your platform.
# Install OpenCPU
install.packages("opencpu")
# Run Apps directly from Github
library(opencpu)
ocpu_start_app("rwebapps/nabel")
ocpu_start_app("rwebapps/markdownapp")
ocpu_start_app("rwebapps/stockapp")
# Install / remove apps
remove_apps("rwebapps/stockapp")
Images based on various platforms are published on dockerhub. The opencpu/rstudio is great for development: it runs both opencpu-server
and rstudio-server
:
# Run server as executable
docker run --name mybox -t -p 80:80 opencpu/rstudio
# OR: if port 80 is taken use port 8004
docker run --name mybox -t -p 8004:8004 opencpu/rstudio
Now simply open http://localhost/ocpu/ and http://localhost/rstudio/ in your browser! Login via rstudio with user: opencpu
(passwd: opencpu
) to build or install apps.
To connect to a running container (e.g. for installing system libraries) get a root shell:
# Replace 'mybox' with the container name or id
docker exec -i -t mybox /bin/bash
Use the opencpu/base image for deployments. Also see the docker readme.