Skip to content

RServe installation

This guide provides instructions for system administrators to install, configure, deploy, and manage R and Rserve backend service.

Overview

Rserve is a lightweight R backend for code execution and integration, designed for use with other services.

Requirements

  • R version 4.0 or newer
  • Ubuntu/Linux operation system with admin access

Installation

Install the R package.

sudo apt update
sudo apt install -y r-base

Start R and install Rserve and other R packages.

sudo R
install.packages("Rserve")
install.packages("knitr")
install.packages("pander")
q()

Run

Run the following command to start Rserve in daemon mode.

R CMD Rserve --no-save --RS-enable-remote

Systemd

Create a systemd file.

cd /etc/systemd/system
sudo nano rserve.service
[Unit]
Description=Rserve daemon

[Service]
User = bao-admin
ExecStart=/usr/bin/R CMD Rserve --no-save

Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Enable the service on startup and start the service.

sudo systemctl daemon-reload
sudo systemctl enable rserve
sudo systemctl start rserve