Windows环境下启动带SSL/TLS的Rserve实例报错,需编译加密支持
You're encountering this error when trying to start Rserve with TLS/SSL enabled:
WARNING: useplain=no, but this Rserve has no crypt support! Set useplain=yes or compile with crypt support (if your system supports crypt).
This happens because the pre-built Rserve package from CRAN on Windows doesn't include OpenSSL (cryptographic) support by default. To use TLS/SSL with Rserve, you'll need to compile Rserve from source with OpenSSL enabled. Here's how to do it step by step:
Prerequisites
- Rtools: Install the official R build tools for Windows (required to compile R packages from source). Ensure Rtools is added to your system PATH during installation.
- OpenSSL Development Files: Download the 32-bit or 64-bit OpenSSL development package matching your R architecture. This package should include header files (in an
includedirectory) and library files (in alibdirectory). Extract these to a convenient location likeC:\OpenSSL-win64(for 64-bit) orC:\OpenSSL-win32(for 32-bit).
Step 1: Download Rserve Source Code
Get the source tarball of Rserve (e.g., Rserve_1.8-13.tar.gz; version numbers may vary) from the R package repository's source section.
Step 2: Compile Rserve with OpenSSL Support
- First, uninstall the existing CRAN version of Rserve to avoid conflicts:
remove.packages("Rserve") - Open a command prompt (or the Rtools bash shell) and set environment variables pointing to your OpenSSL installation:
# For 64-bit systems SET OPENSSL_INCLUDE=C:\OpenSSL-win64\include SET OPENSSL_LIB=C:\OpenSSL-win64\lib # For 32-bit systems # SET OPENSSL_INCLUDE=C:\OpenSSL-win32\include # SET OPENSSL_LIB=C:\OpenSSL-win32\lib - Navigate to the directory where you saved the Rserve source tarball, then run the following command to install and compile Rserve with OpenSSL enabled:
ReplaceR CMD INSTALL --configure-args="--with-openssl" Rserve_<your-version>.tar.gz<your-version>with the actual version number of the Rserve source file you downloaded.
Step 3: Test the Compiled Rserve
Once installation completes successfully, try starting Rserve with your configuration file again. First, ensure your config file is formatted clearly (each setting on its own line):
tls.key Rserve.key tls.cert Rserve.cert tls.port 4902 qap disable
Then start Rserve with:
Rserve --RS-conf your_config_file.txt
The original error about missing crypt support should no longer appear, and Rserve should start with TLS/SSL enabled on port 4902.
Notes
- Make sure your
Rserve.keyandRserve.certfiles are in the same directory where you're starting Rserve, or provide the full path to them in the config file. - If you run into issues with OpenSSL paths during compilation, double-check that the
OPENSSL_INCLUDEandOPENSSL_LIBvariables point to the correct directories containing the header and library files.
内容的提问来源于stack exchange,提问作者Jessica Negara

