How To Install SQL Server 2016 on Ubuntu Linux

Recently Microsoft announced the first beta of SQL Server 2016 for Linux platform. I think it a positive notice for the database world. I’ll like show in this blog entry a simple how to for set up a SQL Server 2016 on Ubuntu Linux.

First of all you need download the Ubuntu distro, please follow the next link to download it;

Ubuntu Downloads

I recommend you the desktop version.

Start VirtualBox and click NEW.

ubuntu_mssql_1

Set up the virtual machine you want, in this case Ubuntu, remember x64 bits architecture and click NEXT.

ubuntu_mssql_2

Now set the memory RAM for the system, I think the 4 Gb is the minimal to work fine, click NEXT.

ubuntu_mssql_3

In disk machine I created a specific virtual hard disk, click CREATE.

FOTO4.png

The more simple is VDI type, click NEXT;

FOTO5.png

I usually prefer to allocate space dynamically to have the space allocted from the beginning. The first method is slow the first time it has to be allocated and can seriously affect performance, in the second case is slow when creating the virtual machine. As I said before as this is a test machine, and will never be production, performance is not important and allocating space dynamically, is in my case to take advantage of the space of my very saturated laptop.

foto6

Configure the space of the new disk. In this case only puts 8 Gb although it is recommended to put more, double, 16 Gb would be fine. Later on we install Ubuntu, although it is not mandatory if it is highly recommended, install a volume manager, click CREATE.

FOTO7.png

We already have our machine created, press START.

FOTO8.png

Tell us that we have no operating system installed, so we must provide one.

FOTO9.png

In my case in the download folder, is the Ubuntu ISO. Select and Open.

FOTO10.png

Click START.

FOTO11.png

 

We get the next screen, click  INSTALL UBUNTU;

UBUNTU_MSSQL_12.png

Do not select anything and click NEXT.

ubuntu_mssql_13

Select ERASE DISK (Mandatory) and it is a good idea install a volume manager. When operating system has been installed install a GPARTED, it make simple to resize and change parameters. Click INSTALL NOW.

LVM.png

Click CONTINUE.

UBUNTU_MSSQL_16.png

In my case I have selected Euro Zone. Click CONTINUE.

UBUNTU_MSSQL_17.png

Select your keyboard layout, and click CONTINUE.

UBUNTU_MSSQL_19.png

Time to set passwords, click CONTINUE.

UBUNTU_MSSQL_20.png

Start the installation.

UBUNTU_MSSQL_21.png

When the installation is complete, click RESTART NOW.

UBUNTU_MSSQL_22.png

Remove the iso software to boot from hard disk elseIt will try to install again.

ubuntu_mssql_25

Time to get the software. First of all you need download a public key

especial_28.png

Now we need add the next lines to the repository;

sudo sh -c “echo deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server xenial main > /etc/apt/sources.list.d/sql-server.list”
sudo sh -c “echo deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main >> /etc/apt/sources.list.d/sql-server.list”

UBUNTU_MSSQL_33.png

Perform an update.

UBUNTU_MSSQL_34.png

Now install the Microsoft SQL Server, by execute the next command;

sudo apt-get install mssql-server mssql-tools -y

 

UBUNTU_MSSQL_35.png

When we are requested the license terms select (by tab key) the YES option.

UBUNTU_MSSQL_36.png

UBUNTU_MSSQL_37.png

The installation wil be continued.

UBUNTU_MSSQL_38.png

Now execute the next command, like show in the previus picture;

sudo /opt/mssql/bin/sqlservr-setup

The configuration ask for a password for SA;

UBUNTU_MSSQL_39.png

I have set everything to YES (Start SQL Server and Start on boot)

UBUNTU_MSSQL_40.png

The configuration have finished. Check the SQL Server status by one of the nexts commands;

ps -ef | grep mssql

systemctl status mssql-server

Using the first option you get the next picture.

UBUNTU_MSSQL_41.png

Now connect the SQL Server like SA user;

UBUNTU_MSSQL_45.png

To stop the SQL Server, the correct way (from OS) is with systemctl;

systemctl stop mssqsl-server

A pop-up ask for password;

UBUNTU_MSSQL_46.png

Check the status, failed means the SQL Server is down;

UBUNTU_MSSQL_47.png

Start up the database again, and a new pop-up require the password;

systemctl start mssql-server

UBUNTU_MSSQL_48.png

Time to play with this new toy. that’s all folks.

HTH – Antonio NAVARRO

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s