The R Services installation package is not included in the MS SQL Server installation package. When you install MS SQL Server with R Services the installer actually download the package from the Internet. There is another option which is offline installation which is described in the official Microsoft article - https://docs.microsoft.com/en-us/sql/advanced-analytics/install/sql-r-services-windows-install?view=sql-server-2017.
Surprisingly the same thing happens when you patch the MS SQL Server with already installed R Services.
Step by step R Services installation
The process starts the same way as installation of any other feature of MS SQL Server. For the illustration I choose a MS SQL Server 2016 but it works in the exactly same way for MS SQL Server 2017. The first step is you will need to select a feature, in my case it is R Services (In-Database):
Go through instance and database configuration settings. These settings are not related to this article. At some point the installation wizard will ask you for consent to install Microsoft R Open. That is because Microsoft distributes R Services under the GNU General Public License.
I have already downloaded R Services offline installation packages and copied them on my server in the folder C:\Soft\R. For a vanilla MS SQL Server 2016 the installation package with US English locale will ask you for files SRO_18.104.22.1683_1033 and SRS_22.214.171.124_1033:
The installation wizard is friendly and if you don’t have Internet access from the server it will give you links to download these files. In my case I pointed the installation wizard to a directory C:\Soft\R where I have copied the required files:
So I have successfully installed R Services (In-Database) on my database server:
If you installing R Services please do not forget configure the database instance. You can do this by executing the following command:
EXEC sp_configure 'external scripts enabled', 1 RECONFIGURE WITH OVERRIDE
Like I have done on my server:
Also you must restart SQL Server instance and SQL Server Launchpad service. Ideally I would recommend restarting the server if that is possible. In order to confirm that R-Services are working fine I used the Microsoft recommended R script:
EXEC sp_execute_external_script @language =N'R', @script=N' OutputDataSet <- InputDataSet; ', @input_data_1 =N'SELECT 1 AS hello' WITH RESULT SETS (([hello] int not null)); GO
As you can see the R script executed successfully on my database server:
That may not be true for you. I have noticed a very common problem related to the Windows security which may prevent starting of SQL Server Launchpad service on your server. During Installation of R Services the installation wizard creates 20 local accounts on a database server: MSSQLSERVER01, MSSQLSERVER02, … MSSQLSERVER20. Also it grants required permissions to these accounts. You can see these accounts on my server:
If you remove these accounts or revoke permissions the SQL Server Launchpad service will fail or won’t start. Also Active Directory policy in your company may not allow granting these permissions to the local user account. In this case please contact your Active Directory domain administrator.
Patching or slipstream installation
If you want to patch your SQL Server after installation or you use a slipstream media you will need to download additional files. For MS SQL Server 2016 Service Pack 2 with US English locale these files are SRS_126.96.36.19900_1033 and SRO_188.8.131.5200_1033. I have downloaded these files in advance:
MS SQL Server installation and patching wizards will give you links to download these files if a server is not connected to the Internet:
You can download the required files in advance in order to avoid hassle during installation or patching. The links for MS SQL Server 2016 with US English locale are:
The links for MS SQL Server 2016 Service Pack 2 with US English locale are:
Production database servers usually do not have Internet access for security purposes. So when you install or patch your MS SQL Server with R Services installed I would recommend downloading required R Services packages in advance. If you follow this simple instruction it may save you some time and will reduce amount of downtime during patching.
Also please make sure that you do not delete the automatically created local accounts. Otherwise that may cause service failures and production outages.