I must admit I was surprised when I learned that Microsoft SQL Server would be availble in Linux. They’ve been pushing the open source initiative hard, but I didn’t expect something this big. Oh yeah, Visual Studio is now available for Mac as well. I just saw a pig flying by.
While MS-SQL is not open source they have made it available to run on open source platforms such as Linux and OSX, which I can imagine took a ton of work. So I decided to take advantage of this new option and try it out. It works great! It took 5 minutes to install. Here’s how you can do it too. Note that you will need a server with 3.5 gigs of RAM for this.
The first thing I always do on an Ubuntu machine is update it
Next we need to import the public repository GPG keys
Next we’ll install SQL Server.
Now we need to run a configuration script to set up the server:
` It will ask if you want to start the service and if you’d like to start it on boot.
Here’s how you can check if the service is running:
Install the MSSQL Tools for Linux
To test this out a little, install the MSSQL tools on Ubuntu.
Add in a new repository:
1 2 3 4
Now, Let’s try to connect!
You can run this command to view all your databases:
This should look pretty familiar to you if you’ve worked with SQL in the past.
Now we need to select that database:
As a test. let’s create a customer table
Now, let’s put some customers in there:
1 2 3 4
Now, let’s take a look at those customers:
And it’s that easy! You can run SQL scripts here, or connect to it from SSMS, a traditional ASP site, or a .Net Core site/app. I’ll be doing a lot of ASP.Net core work in the coming months, so be sure to check back here.
To quit from SQL server, type in
And you’re done!
I’ll be messing with this some more in the coming weeks and really putting it to the test, and I’ll share my results.
I also did a YouTube tutorial for this article: