Spinning up SQL Server on Linux

So I spun up another Linode instance for a SQL Server 2017 installation. I’ve had great success with six other linodes at Linode.com for a Cassandra cluster in the past, and so far this one has been just as good. The UI is very intuitive, and their price plans fit my budget … don’t need to sell body parts or sacrifice my privacy. Here is what their console looks like:

I’m not a stranger to Linux, but I started with this guide on digitalocean which worked good:   initial-server-setup-with-ubuntu-16-04

The guide includes ufw commands for allowing ssh through it’s firewall. Note that I’m not opening any SQL Server ports and I’ll be tunneling SQL Server ports inside of ssh. This should help minimize the chance of this server becoming a slammer host.

I also tried some sneaky stuff to get SQL Server to install on a really cheap 1GB host with mount -t tmpfs to sneak around the minimum RAM specs, but I wound up crashing the host:


Out of memory: Kill process 18260 ((sd-pam)) score 1 or sacrifice child
Killed process 18260 ((sd-pam)) total-vm:61940kB, anon-rss:1692kB, file-rss:0kBB

I might try to go back to this some day … but for now no more killing or sacrificing, I’ve switched to a 4GB image.

The next steps came from Microsoft, yes, Microsoft:
Quickstart: Install SQL Server and create a database on Ubuntu

Now I keep pinching myself to make sure I’m not dreaming this stuff up — that Microsoft has actually released a version of SQL Server for Linux that is practically identical to the Windows version.

It was a really easy install process and the MS guide was clear. The only catch was that I had to install software-properties-common twice in a row for some reason:

sudo apt-get install software-properties-common

There were some ncurses-based installation steps for the client mssql-tools that made me feel like the 80’s were back!

Within minutes it was ready.


dba@localhost:~$ sqlcmd -S localhost -U sa
1> select @@version;
2> go
---------------------------------
Microsoft SQL Server 2017 (RTM-CU5) (KB4092643) - 14.0.3023.8 (X64)
Mar 2 2018 18:24:44
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (Ubuntu 16.04.2 LTS)
(1 rows affected)

I found the clearest instructions for configuring the ssh tunnel here:
mysql-connection-over-ssh-tunnel

Of course, change the port from 3306 to 1433. I’m using cygwin for the ssh tunnel. The tunnel is managed at the client side with this command (or with a similar process in putty)”

ssh -f -N -L 12345:127.0.0.1:1433 dba@dbserver.domain.com

Then in SSMS or other clients, connect to the numeric version of localhost with a comma followed by the local redirected port, in this case 12345. (Note the word localhost or the name of your host won’t work here, it has to be 127.0.0.1)

127.0.0.1,12345

Some of the next steps I need to do include:

(*) configuring dba group security in the backup directory in /var/opt/mssql without chmod’ing it wide open.

(*) having a blast with this neat database server.