8

My company develops software with two sides: client and server. I've installed Microsoft SQL Server on Windows and am running the client side on Ubuntu with some configuration.

But I'm wondering: is there a way to run Ubuntu as the server instead and install SQL Server on it?

9

You can certainly try the approach I will outline below but I don't know if anyone has tried it successfully.

  1. Install virtualization software on your Ubuntu machine (VMWare, Xen, VirtualBox).
  2. Install Microsoft Windows Server in the virtual machine.
  3. Install MS SQL Server on the newly installed Windows Server.

I don't know if any other way would work but people can correct me the MS SQL Server from what I can remember actually relies on Licensing for Microsoft Windows Server. On top of this SQLServer is a pretty bad resource hog so normally organizations try to segregate it from running with any other applications on it's own cluster or server.

One thing that I would question is why not try Sybase as the backend? The connectivity from Linux to SQLServer and Sybase can go through FreeTDS, which would look identical to your client software.

  • 1
    Well this answer my question, thanks. I do not manage the database here we have a whole bunch of programmers, i'm working on the client side and we install both server AND client. I'm currently virtuallizing an ubuntu on my windows machine to run a bunch of test to see if ubuntu would work. With client yes. On server....not so well, since SQL would never work on Linux. Thanks for your answer – Jester Dec 27 '11 at 20:19
  • 1
    @Karlson: Used to be true, but now outdated, per end of November 2016. – WitchCraft Dec 15 '16 at 20:15
  • This URL might have looked like a fairy tale back then docs.microsoft.com/en-us/sql/linux/… – Asim Jan 25 '17 at 22:51
4

WARNING: EMBRACE - EXTEND - DROP  ?

Yes, as per end of November 2016, and as per docs.microsoft.com, you can install the public preview of sql-server vNext CTP1 on Ubuntu 16.04 (doesn't work on 14.04 because the OpenSSL-package is outdated):

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
sudo apt-get update
sudo apt-get install -y mssql-server
sudo /opt/mssql/bin/sqlservr-setup

or newer

sudo /opt/mssql/bin/mssql-conf setup

To remove it

sudo apt-get remove --purge mssql-server

To remove the generated databases

sudo rm -rf /var/opt/mssql/

If you want to check whether it works or not, do not forget to switch off the firewall

iptables -F
iptables -P INPUT ACCEPT  

You can start SQL-Server with:

systemctl start mssql-server

You can stop SQL-Server with:

systemctl stop mssql-server

To see its status:

systemctl status mssql-server

To start sql-server at boot-time:

systemctl enable mssql-server

To disable SQL-Server-start at boot-time:

systemctl disable mssql-server

And if you also want the command-line tools

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update 
sudo apt-get install mssql-tools

To test it

sqlcmd -S localhost -U SA -P 'YourPasswordHere'
CREATE DATABASE contoso
exit

And to permanently open port 1433 (sql-server default-port)

iptables -A INPUT -p tcp --dport 1433 -j ACCEPT
sudo apt-get install iptables-persistent
sudo netfilter-persistent save
sudo netfilter-persistent reload

or if you use ufw, you can do the same by typing less with

ufw allow 1433/tcp

See also firewall-persistence and this

For Red Hat (firewalld):

firewall-cmd --add-port=1433/tcp --permanent
firewall-cmd --reload

If you don't want to work with command-line tools, you can connect with SSMS from a windows laptop.

SSMS

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.