SQL Server Machine Learning Services Ubuntu 20.04 installation

We recently tried to add SQL Server Machine Learning Services to use SQL-based machine learning. Although it seemed like a fairly simple process, following the installation instructions from the Microsoft site, our Ubuntu machine was unusable for any installation or package update.

This blog post consists of :

  • Install SQL Server Machine Learning Services Ubuntu 20.04
  • Fixing errors after installation (inability to use apt install / update / remove on all packages)
  • Installing the R library compiler Adding an R library

1. Before installation

You need to have an SQL server installed on your Ubuntu machine.

sudo apt-get update
sudo apt-get install mssql-server

2. Install Machine Learning service

Sudo apt-get install apt-transport-https

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update

sudo apt-get install mssql-mlservices-packages-r

sudo /opt/mssql/bin/mssql-conf set EULA accepteulaml Y

sudo /opt/mssql/bin/mssql-conf set extensibility outboundnetworkaccess 1

systemctl restart mssql-launchpadd

systemctl restart mssql-server.service

Execute this query on master base:

EXEC sp_configure ‘external scripts enabled’, 1


Just like here:

3. Problem installing package

If we try to install or add anything now, we will encounter an error:

rserver/revoscaler/rxlibs/x64/rhel/libstdc++.so.6: version `glibcxx_3.4.26′ missing

Now it looks like we brick our Ubuntu machine and it remains unusable for new installations.

However, all you need to do is copy the system library libstdc++.so.6 na mjesto rserver/revoscaler/rxlibs/x64/rhel/:

sudo cp -f /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/mssql/mlservices/libraries/RServer/RevoScaleR/rxLibs/x64/rhel/libstdc++.so.6

4. Adding a compiler for the R library

Install it with one command: sudo apt install r-base-dev

5. R package installation

Open R through the console: sudo R

Install a library, e.g. :

install.packages(‘dplyr’, repos = ‘https://cloud.r-project.org’)


You can now use the R language directly in your database on Ubuntu 20.04!