Install Rserve as a windows service

Yellowfin FAQ shared this question 1 year ago
Answered

I am using a windows VM to launch Rserve, but the server will die the second my user logs out. What do I do?

Best Answer
photo

First, you must configure Rserve to be launched via the Rserve.exe file (from stackoverflow):

  1. Navigate to the file where you just installed Rserve.exe (C:\R\R-31~1.0\library\Rserve\libs\x64\R, based on the message you copied here)
  2. Find Rserve.exe, Reserve_d.exe, and Rserve.dll there. Copy these files.
  3. Navigate to where R.dll is on your computer. This is probably C:\Program Files\R\R-3.1.3\bin\x64, but may be different depending on where you installed R to.
  4. Copy the 3 files mentioned above to this location.
  5. Create a text file here named "Rserv.cfg" with the arguments you are looking for, such as port 6312 or library(mvoutlier). Yes, I know that this is different from the documentation, but if you start Rserve_d.exe you will see that this is the file it is looking for. I have not had success naming it anything else.

Once you have configured this, Install NSSM to create a windows service for this launch:

  1. Install NSSM: https://nssm.cc/download
  2. Open a command line window and run: nssm install RServe
  3. Point this to the exe file copied in the previous instructions
  4. Click Install service

be2378ff61f2fda5fa56ffc778a7563e

Comments (1)

photo
1

First, you must configure Rserve to be launched via the Rserve.exe file (from stackoverflow):

  1. Navigate to the file where you just installed Rserve.exe (C:\R\R-31~1.0\library\Rserve\libs\x64\R, based on the message you copied here)
  2. Find Rserve.exe, Reserve_d.exe, and Rserve.dll there. Copy these files.
  3. Navigate to where R.dll is on your computer. This is probably C:\Program Files\R\R-3.1.3\bin\x64, but may be different depending on where you installed R to.
  4. Copy the 3 files mentioned above to this location.
  5. Create a text file here named "Rserv.cfg" with the arguments you are looking for, such as port 6312 or library(mvoutlier). Yes, I know that this is different from the documentation, but if you start Rserve_d.exe you will see that this is the file it is looking for. I have not had success naming it anything else.

Once you have configured this, Install NSSM to create a windows service for this launch:

  1. Install NSSM: https://nssm.cc/download
  2. Open a command line window and run: nssm install RServe
  3. Point this to the exe file copied in the previous instructions
  4. Click Install service

be2378ff61f2fda5fa56ffc778a7563e