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;
I recommend you the desktop version.
Start VirtualBox and click NEW.
Set up the virtual machine you want, in this case Ubuntu, remember x64 bits architecture and click NEXT.
Now set the memory RAM for the system, I think the 4 Gb is the minimal to work fine, click NEXT.
In disk machine I created a specific virtual hard disk, click CREATE.
The more simple is VDI type, click NEXT;
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.
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.
We already have our machine created, press START.
Tell us that we have no operating system installed, so we must provide one.
In my case in the download folder, is the Ubuntu ISO. Select and Open.
We get the next screen, click INSTALL UBUNTU;
Do not select anything and click NEXT.
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.
In my case I have selected Euro Zone. Click CONTINUE.
Select your keyboard layout, and click CONTINUE.
Time to set passwords, click CONTINUE.
Start the installation.
When the installation is complete, click RESTART NOW.
Remove the iso software to boot from hard disk elseIt will try to install again.
Time to get the software. First of all you need download a public key
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”
Perform an update.
Now install the Microsoft SQL Server, by execute the next command;
sudo apt-get install mssql-server mssql-tools -y
When we are requested the license terms select (by tab key) the YES option.
The installation wil be continued.
Now execute the next command, like show in the previus picture;
The configuration ask for a password for SA;
I have set everything to YES (Start SQL Server and Start on boot)
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.
Now connect the SQL Server like SA user;
To stop the SQL Server, the correct way (from OS) is with systemctl;
systemctl stop mssqsl-server
A pop-up ask for password;
Check the status, failed means the SQL Server is down;
Start up the database again, and a new pop-up require the password;
systemctl start mssql-server
Time to play with this new toy. that’s all folks.
HTH – Antonio NAVARRO