SQL Server vNext represents a major step towards making SQL Server a platform that enables choices of development languages, data types, on-premises and in the cloud, and across operating systems by bringing the power of SQL Server to Linux, Linux-based Docker containers, and Windows.
For all the downloads, code samples and to stay informed visit the following link -> SQL Server v.Next Public Preview.
I am sharing with you my experiences, gotchas in installing SQL Server on Linux on an existing Ubuntu VM I already had running for a while…I have since installed SQL Server for Linux on several other local VM’s and in Azure without any issues just by following the documentation.
Installing SQL Server on Linux on Ubuntu Desktop (virtualized)
First you will need to download Ubuntu 16.04.1 which you can find here -> https://www.ubuntu.com/download/desktop
Next you will need a software virtualization package, I recommend you either download VirtualBox or VMware Workstation Player. Both of those are free product downloads. For this walkthrough validation I was using VMware Fusion 8.5 Pro for Mac. You could also create use a pre-configured Linux VM in Azure. In addition to OS-only VMs, there is also a VM image with SQL Server vNext CTP1 already installed. For more information, see Provision a Linux VM in Azure for SQL Server.
If you decide to install Ubuntu on a virtualized environment yourself, the following link provides a detail walkthrough of how to install SQL Server vNext CTP1 on Ubuntu 16.04 Install SQL Server on Ubuntu. Very simple, just follow the outlined steps.
Note: You may encounter an issue while attempting step 3. “Run the following commands to install SQL Server”.
I did! My Ubuntu environment was recently updated to 16.04 from 14.04, in theory if you do a fresh Ubuntu install you should not encounter any issues. Here is the error message I received:
“E: Could not get lock /var/lib/dpkg/lock – open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?”
This is a sign that something else is installing or removing software and has locked the apt database while it performs the actions…
So here is how to resolve it!
Remove your /var/lib/dpkg/lock file and force package reconfiguration:
sudo rm /var/lib/dpkg/lock && dpkg --configure -a
Perform step 3 again and it should permit you to continue and complete all the steps successfully.
The next logical step is to Install SQL Server tools on Linux, again very simple just follow the outlined steps.
Note: You may encounter an issue while attempting step 3. “Update the sources list and run the installation command”.
I did! 😉 Turns out that some important dependencies were missing: The Microsoft ODBC Driver for SQL Server on Linux
Here is the error message I received:
So here is how to resolve it!
The following link contains the specific commands you need to execute in order to install for Ubuntu 16.04 Microsoft ODBC Driver 13.0 for SQL Server on Linux
Installing the Microsoft ODBC Driver for SQL Server on Linux for Ubuntu 16.04
sudo su sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/mssql-ubuntu-xenial-release/ xenial main" > /etc/apt/sources.list.d/mssqlpreview.list' sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 apt-get update apt-get install msodbcsql unixodbc-dev-utf16 #for silent install use ACCEPT_EULA=Y apt-get install msodbcsql apt-get install unixodbc-dev-utf16 #this step is optional but recommended*
Once completed you can retry step 3 and it should permit you to continue and complete all the steps successfully.
Finally all is installed! You can now connect to the SQL Server instance to create and manage databases. see Connect and query SQL Server on Linux to get started.
In an upcoming post I will discuss how to run SQL Server on Linux on a Docker container and use Visual Studio Code to develop and manage databases.