Remote R Service for Linux
Applies to: Visual Studio Visual Studio for Mac
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Remote R Service for Linux is currently packaged as rtvs-daemon. The daemon is supported and tested on Ubuntu 16.04, 16.10 LTS desktop, server, and Windows Subsystem for Linux running Ubuntu. The bulk of this article provides instructions for setting up Remote R Service on these different systems.
Once you've configured the remote machine, the following steps connect the R Tools for Visual Studio (RTVS) to that service:
- Select R Tools > Windows > Workspaces to open the Workspaces window.
- Select Add Connection.
- Give the connect a name and provide its URL, such as
https://localhost:5444(Windows Subsystem for Linux) or
https://public-ip:5444(Azure container). Select Save when complete.
- Select the connection icon or double-click the connection item.
- Provide login credentials. The username must be prefixed with
<<unix>>\ruser1(as required for all connections to Linux remote computers).
- If you are using self-signed certificate, you may see a warning. The message provides instructions to correct the warning.
Set up Remote R Service
This section describes the following options:
- Physical Ubuntu computer
- Ubuntu Server VM or Data Science VM on Azure
- Local or remote Docker container (clean build)
- Container running on Azure Container Instances
In each case, the remote computer must have one of the following R interpreters installed:
Physical Ubuntu computer
Once logged into the computer, download the rtvs-daemon tarball:
wget -O rtvs-daemon.tar.gz https://aka.ms/r-remote-services-linux-binary-current tar -xvzf rtvs-daemon.tar.gz
Run the install script:
For a silent automation, use
sudo ./rtvs-install -s.
Enable and start the service:
sudo systemctl enable rtvsd sudo systemctl start rtvsd
Configure the SSL certificate (required for production). By default, rtvs-daemon uses the
ssl-cert-snakeoil.pemgenerated by the
ssl-certpackage. During installation, they're combined into
ssl-cert-snakeoil.pfx. For production purposes, use the SSL certificate provided by your administrator. The SSL certificate can be configured by providing a .pfx file and optional import password in: /etc/rtvs/rtvsd.config.json.
(Optional) Check that the service is running:
ps -A -f | grep rtvsd
If you don’t see a process running under the user name
rtvssvc. Start it using the following command:
sudo systemctl start rtvsd
To further configure the rtvs-daemon, see
Ubuntu Server VM or Data Science VM on Azure
Create a VM
- Sign in to the Azure portal.
- Navigate to Virtual Machines, then select Add.
- In the list of available VM images, search for and select one of the following:
- Ubuntu Server:
Ubuntu Server 16.04 LTS
- Data Science VM:
Linux Data Science(see Data Science Virtual Machines for details)
- Ubuntu Server:
- Set the deployment model to
Resource managerand select Create.
- Choose a name for the VM, provide a username and password (password is required, as SSH public key login isn't supported).
- Make any other desired changes to the VM configuration.
- Choose a VM size, verify the configuration, and select Create. Once the VM is created, proceed to the next section.
Configure the VM
- In the VM's Networking section, add 5444 as an allowed inbound port. To use a different port, change the setting in the RTVS daemon config file (/etc/rtvs/rtvsd.config.json).
- (Optional) Set a DNS name; you can also use the IP address.
- Connect to the VM using an SSH client, such as PuTTY for Windows.
- Follow the instructions for a Physical Ubuntu computer above.
Windows Subsystem for Linux (WSL)
- Follow the WSL installation instructions for either Windows 10 or Windows Server.
- Start bash on Windows and follow the earlier instructions a Physical Ubuntu computer with one exception. For step 3, start the service using the command
rtvsdinstead because WSL currently does not support the systemd/systemctl interfaces.
Local or remote Docker container (clean build)
Create a Docker file with the contents below, which installs the Remote R service daemon and the latest version of R. Note: this script creates a user called "ruser1" with the password "foobar", which you can modify as desired in the final two
FROM ubuntu:16.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install -y software-properties-common python-software-properties \ && apt-get install -y apt-transport-https \ && rm -rf /var/lib/apt/lists/* RUN sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list' \ && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 \ && sh -c 'echo "deb https://cran.revolutionanalytics.com/bin/linux/ubuntu xenial/" > /etc/apt/sources.list.d/cran-r.list' \ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean RUN apt-get update --fix-missing && apt-get update \ && apt-get install -y dotnet-dev-1.0.4 libexplain51 libzip4 libc6 git lshw ssl-cert wget \ && rm -rf /var/lib/apt/lists/* # install R RUN apt-get update && apt-get install -y r-base-dev RUN apt upgrade -y # install rtvs-daemon RUN wget -O rtvs-daemon.tar.gz https://aka.ms/r-remote-services-linux-binary-current && tar -xvzf rtvs-daemon.tar.gz && ./rtvs-install -s RUN useradd --create-home ruser1 RUN echo "ruser1:foobar" | chpasswd EXPOSE 5444
Build and run the docker file:
docker build -t myrimage . docker run -p 5444:5444 myrimage rtvsd
To connect to the contains from RTVS, use
https://localhost:5444as the path, username
<<unix>>\ruser1, and password
foobar. If the container is running on a remote computer, use
https://remote-host-name:5444as the path instead. The port can be changed by updating /etc/rtvs/rtvsd.config.json.
Container running on Azure Container Instances
Follow the instructions in Local or remote Docker container (clean build) to create the image.
Push the container to Docker hub or Azure Container Repository.
Start the Azure CLI and sign in using the
az container createcommand to create the container, using
--command-line "rtvsd"if you have not set up the container to run
systemdservice. In the command below, the image is expected to be on Docker hub. You can also use Azure Container Repository by adding Container Repository credential arguments to the command line.
az container create --image myimage:latest --name myaz-container --resource-group myaz-container-res --ip-address public --port 5444 --cpu 2 --memory 4 --command-line "rtvsd"
az container listcommand to check the status. Look for
If the provisioning succeeded, you can now connect to the container. Look for the public IP address, in the
ipAddressfield, which you use with the credentials in the docker file to connect to the container from RTVS.