Install SQL Server 2019 CTP 2.2 on Ubuntu Part – 2

In this series of blog post, we are going to Install SQL server 2019 preview on Ubuntu 18.04.1. In the previous blog post “Install SQL Server 2019 CTP 2.2 on Ubuntu Part – 1“, We have learned how to install Ubuntu 18.04.1 in Hyper-V.

If you have any previous version of CTP or preview, Please remove it. Otherwise it may give the surprise while installation. I am not covering about how to remove previous version of SQL Server, because I am assuming that we have newly created Hyper-V.

Install SQL Server

To install SQL Server on Ubuntu, log in with your Ubuntu Server and run the following commands.

Step: 1 – Import PGP keys. You can read more about PGP key here.

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Step: 2 – Register SQL Server 2019 repository.

sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-preview.list)"

You can find more repository list over here. If you have other version of Ubuntu then you just need to replace the URL with appropriate URL from link given.

Step: 3 – Run following command to start installation of SQL Server.

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

After the SQL Server package installation, you need to run the following command in order to setup the SQL server. It will ask you the series of questions.

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

Therefore, I have tried to cover all of the questions asked. The first question is to choose the edition of the SQL Server, because of that I have selected Developer edition, as I am a developer.

MS SQL Server Edition

Then after the question will accept license terms for the MS SQL Server. Press Yes to move further.

MS SQL Server License

You will be ask to choose your preferred language for the MS SQL Server, hence I have choose English.

Finally, SQL Server will ask for Administrator password. Enter Strong password and as a result, SQL Server service will give a message that Setup has completed successfully and SQL Server is now starting.

Once, you are done with setup make sure that SQL Server services is running in the machine and for that you can run following command.

systemctl status mssql-server

It will give you the following output that shows that services is just running perfect.

check mssql service running

Issue I faced.

I face one issue after restarting my Host machine, and that is SQL server was unable to start as shown in screenshot.

mssql server unable to start

You can resolved this issue by increasing RAM of hyper-v machine. I have stopped my Virtual Machine first, then increased RAM from 2GB to 4GB and started again.

Open firewall port to connect SQL Server 2019 remotely

It’s time to connect your newly installed SQL Server remotely because we haven’t installed sqlcmd in Linux. Therefore you need to open the TCP port 1433 and UDP port 1443 in firewall of Linux. Run following command to open ports in Ubuntu for SQL Server to connect remotely.

sudo ufw enable
sudo ufw allow 22
sudo ufw allow 1433
sudo ufw allow 1434

Finally, Open the SSMS from the host machine and connect to your newly installed MS SQL Server o Linux Virtual Machine using your credentials.

Install SQL Server 2019 CTP 2.2 on Ubuntu Part – 1

In this series of blog post, we are going to install SQL Server 2019 CTP 2.2 on Ubuntu 18.04.1 Bionic Beaver. This is the first Part of the series. And, In this first part, we are going to install and prepare Ubuntu 18.04.1 in Hyper-V Manager of Windows 10. You can also create virtual machine in Azure Cloud.

Hyper-V Manager

Whether you are a software developer, an IT professional, or a technology enthusiast, you need to run multiple operating systems including multiple flavor. Hyper-V lets you run multiple operating systems as virtual machines on Windows.

You can install Hyper-V Manager in many ways. First of all I am enabling using “Turn Windows Features on or off”.

  • Open control panel
  • Click on Programs & then “Turn Windows Features on or off”
  • Turn on Hyper-V and both of the features beneath it. Find screenshot to know what exactly need to tick.
  • Click Ok, and wait until it will install the Hyper-V feature.
  • Restart your computer.

Now, you have Hyper-V installed. We are quickly skipping to create a virtual machine on Hyper-V Manager using Quick Create Virtual Machine. Open Hyper-V and go to Action Quick Create. It will open the following window.

Create Virtual Machine using Hyper-V
Create Virtual Machine using Hyper-V Manager

Finally, click on Create Virtual Machine will download the Ubuntu and create a virtual machine for you.

Downloading image Ubuntu
Downloading image ‘Ubuntu 18.04.1 LTS’
Virtual Machine created
Virtual machine created Successfully

Install Ubuntu 18.04.1 LTS

Now, we have a virtual machine ready to start with the image of Ubuntu 18.04.1 LTS. You are just about to start the installation using turning on the virtual machine from Hyper-V. Turning on the virtual machine will launch the following installation wizard, then Choose your preferred language from the list.

Ubuntu Installation - Choose language
Welcome – Choose Language
Ubuntu Installation - Keyboard layout
Keyboard layout
Ubuntu Installation - Where are you?
Ubuntu Installation – Where are you?
ubuntu who are you
Ubuntu Installation – Who are you?

Now, you need to click on continue and take a rest until will install and ready the virtual machine with Ubuntu.

Preparing Ubuntu 18.04.1 for SQL Server 2019

After installation, you can take the virtual machine to install the SQL server, but at some point, it’s easy to login into the VM using tool like PuTTy using SSH. Ubuntu doesn’t install the SSH by default because of the security reason. So, you need to install the SSH. Here is the command to install and check the status of SSH server.

sudo apt install ssh
sudo service ssh status
Check status of SSH service
Check status of SSH service

So, I am going to conclude this blog post here, because this post was write with the intention to prepare Ubuntu to install SQL Server 2019 CTP 2.2, hence Please find more about How to install SQL Server 2019 CTP 2.2 in Hyper-V virtual machine in next Part the series.