SQL Server on Linux for Windows Users...SQL Server on Linux for Windows Users Starting from clean...

36
SQL Server on Linux for Windows Users indiamentor 8/10/2017 Ronen Ariely, Senior consultant & architect, http://ariely.info 1

Transcript of SQL Server on Linux for Windows Users...SQL Server on Linux for Windows Users Starting from clean...

SQL Server on Linuxfor Windows Users

indiamentor

8/10/2017 Ronen Ariely, Senior consultant & architect, http://ariely.info 1

SQL Server on Linux for Windows Users

Starting from clean Linux machine, we will create a full SQL Server developing and learning environment on Linux.

In this session, we will focus on tools, which are familiar to Windows users. We will install tools for local use on the Linux machine, for example: SQLCMD, PowerShell, Visual Studio Core, etc. In addition, we will show how to use tools to manage Linux machine and SQL Server remotely from Windows machine, for example: SSMS, Microsoft Remote Desktop, etc.

If you have not yet tested SQL Server on Linux, if you are struggling in managing SQL Server on Linux, or if you want to learn about the latest updates coming in the next version of SQL Server, then this session is for you!

http://www.indiamentor.com/events/sql-server-linux-windows-users

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 2

About

Ronen Ariely (Blog, website, Facebook, LinkedIn)

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 3

➢ Senior consultant and architect, in the fields of applications developing and databases.

➢ More than 15 years of experience in variety of programming languages and technologies, leading and managing development teams, and SQL & BI enterprise level solutions.

➢ Specialized in Geophysics and seismic data analysis, during MA studies, at Tel-Aviv University, Israel.

➢ Active in communities in the field of Programming, SQL Server, T-SQL.➢ Serves as Moderator at MSDN Israel, and at the MSDN Global communities (aka pituach).➢ founder of Microsoft TechNet WIKI Ninjas Groups on Facebook, and serves as co-Admin.➢ Writing technical blogs, TechNet WIKI articles, and tutorials.➢ Awarded as Microsoft Most Valuable Professional (MVP)

About

Ronen Ariely (Blog, website, Facebook, LinkedIn)

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 4

➢ Senior consultant and architect, in the fields of applications developing and databases.

➢ More than 15 years of experience in variety of programming languages and technologies, leading and managing development teams, and SQL & BI enterprise level solutions.

➢ Specialized in Geophysics and seismic data analysis, during MA studies, at Tel-Aviv University, Israel.

➢ Active in communities in the field of Programming, SQL Server, T-SQL.➢ Serves as Moderator at MSDN Israel, and at the MSDN Global communities (aka pituach).➢ founder of Microsoft TechNet WIKI Ninjas Groups on Facebook, and serves as co-Admin.➢ Writing technical blogs, TechNet WIKI articles, and tutorials.➢ Awarded as Microsoft Most Valuable Professional (MVP)

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 5

SQL Server 2017 Birthday

SQL Server On the platform of your choice

SQL Server 2017 RC2

SQL Server 2017 RC2 enhances its performance for Windows, Linux, Mac, and Docker containers.

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 6

SQL Server 2017 RC2

Docker

➢ Prepare Linux Machine

➢ Control Your Linux via SSH Using PuTTY

➢ Manage files remotely - WinSCP

➢ Control Your Linux via Windows Remote Desktop

➢ Remote Connection with VNC -TightVNC

➢ Install .NET Core 2.0 SDK

➢ Visual Studio (code) on Linux

➢ PowerShell is open sourced and is available on Linux

➢ Install SQL Server on Ubuntu

➢ Install the SQL Server command-line tools

➢ SQL Server Management Studio -remote

➢ DBeaver – Database Management Studio

➢ Install SQL Server Full-Text Search on Linux

➢ Install SQL Server Agent on Linux

➢ SSIS on Linux is available in SQL Server 2017 CTP2.1

➢ Monitoring SQL on Linux

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 7

Agenda

Prepare Linux Machine

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 8

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 9

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 10

Prepare Linux Machine

Network Security Group (Firewall rules)

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 11

Specify your IP

here

Installing user-friendly environmentDEMO

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 12

Manage files remotely - WinSCP

File transfer based on SSH connection

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 13

➢Demo: Connect ☺

Control Your Linux via SSH Using PuTTY

SSH port is opened by default in Azure Linux machines.

SSH = Secure Shell

We are Using Shell interfaceto connect and manage servers.

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 14

➢Demo: Connect ☺

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 15

Connect Linux via Windows Remote Desktop

sudo apt-get update

sudo apt-get install xrdp

sudo apt-get install xubuntu-desktop

echo xfce4-session >~/.xsession

sudo nano /etc/xrdp/startwm.shxrd

p

➢ Add the line xfce4-session before the line:/etc/X11/Xsession

sudo service xrdp restart

Connect Linux via Windows Remote Desktop

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 16

➢Demo: Connect ☺

Remote Connection with VNC - TightVNC

3/4/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 17

Visual Studio (code) for Linux

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS.

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 18

# Download the newer package code_1.17.0-1507160143_amd64.deb

sudo dpkg -i code_1.17.0-1507160143_amd64.deb

sudo apt-get install –f

# troubleshooting: not launched

sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1

https://code.visualstudio.com

Install .NET Core

Install for Ubuntu 16.04(64 bit)

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 19

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list’

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B02C46DF417A0893

sudo apt-get update

sudo apt-get install dotnet-dev-1.0.4

Current version .NET Core 1.1: https://www.microsoft.com/net/core#linuxubuntuPreview .NET Core 2.0: https://www.microsoft.com/net/core/preview#linuxubuntu

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 20

PowerShell is open sourced and is available on Linux

sudo dpkg -i powershell_6.0.0-beta.5-1ubuntu1.16.04.1_amd64.deb

sudo apt-get install -f

➢ Download the installation package for Ubuntu 16.04:powershell_6.0.0-beta.5-1ubuntu1.16.04.1_amd64.debhttps://github.com/PowerShell/PowerShell/releases/tag/v6.0.0-beta.5

* For more information check PowerShell GitHub project

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 21

Install SQL Server on Ubuntu

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

➢ Import the public repository GPG keys:

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

➢ Register the Microsoft SQL Server Ubuntu repository:

sudo apt-get update

sudo apt-get install -y mssql-server

➢ install SQL Server:

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

➢ Configure SQL Server:

SQL Server Management Studio

At this time we can use only remote SSMS

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 22

✓ Make sure Firewall configure correctly (Open port 1433).

✓ Highly recommended to specify specific IPs in the firewall rules.

* Using Azure VM. The firewall rules configured under the “Network Security Group”

➢Demo:Connect ☺

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 23

Install the SQL Server command-line tools

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –

sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"

➢ Import public repository GPG keys and Register the Ubuntu repository:

sudo apt-get update

sudo apt-get install -y mssql-tools unixodbc-dev

➢ install Command Line Tool:

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

source ~/.bashrc

➢ Add toll to the PATH environment variable

➢Demo:Connect ☺

sqlcmd -S localhost -U SA

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 24

DBeaver – Database Management Studio

java -version

➢ Check which Java version you have in your machine

sudo apt install <selected package which is last version>

sudo apt-get -f install

➢ Install the newer version you found

➢ Download Linux 64 bit (tar.gz archive) from dbeaver website

➢Demo: Execute DBeaver☺

➢ Un-Zip the file, and execute

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 25

SQL Server Integration Services (SSIS) on Linux

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

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

➢ Import public repository GPG keys and Register the Ubuntu repository:

sudo apt-get update

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

➢ install SQL Server Integration Services:

sudo /opt/ssis/bin/ssis-conf setup

➢ Configure SSIS:

export PATH=/opt/ssis/bin:$PATH

➢ set path:

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ssis

Riddle:Why in several installations I need to use the two predefined commands, while in other cases I can do a direct installation

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 26

Install SQL Server Full-Text Search on Linux

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-full-text-search

sudo apt-get update

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

sudo systemctl restart mssql-server

➢ Install SQL Server Full-Text Search on Ubuntu Linux

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 27

Install SQL Server Agent on Linux

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-sql-agent

sudo apt-get update

sudo apt-get install mssql-server-agent

sudo systemctl restart mssql-server

➢ Install SQL Server Agent on Ubuntu Linux

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 28

➢Demo:Connect to our (almost) final machine☺

Monitoring SQL on Linux

How the SQLCAT Customer Lab is Monitoring SQL on Linux

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 29

https://blogs.msdn.microsoft.com/sqlcat/2017/07/03/how-the-sqlcat-customer-lab-is-monitoring-sql-on-linux/

Final tach

Make the machine friendly for your language (Hebrew for example).- configure the display that you like and start testing SQL Server and Microsoft’s tools on Linux.

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 30

➢Demo:Connect to my Windows machine ☺

Questions?

Any question that I will not have time to answer now, I will try to post an answer later on, at a summarization blog

Please feel free to use the MSDN Forum for any question:https://social.technet.microsoft.com/Forums/he-IL/home?forum=sqlhe

3/4/2017 Ronen Ariely, Senior consultant & architect, http://ariely.info 31

Tips & Tricks

➢ Backup the VM!

➢ Azure Backup servicehttps://docs.microsoft.com/en-us/azure/virtual-machines/linux/update-agent

➢ Copy Existing VM

➢ High-availability with SQL Server 2017 between Windows and Linux!

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 32

Wrapping Up

What we had today, and what Next ?

8/10/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 33

➢ Prepare Linux Machine➢ Control Your Linux via SSH Using

PuTTY➢ Manage files remotely - WinSCP➢ Control Your Linux via Windows

Remote Desktop➢ Remote Connection with VNC -

TightVNC➢ Install .NET Core 2.0 SDK➢ Visual Studio (code) on Linux➢ PowerShell is open sourced and is

available on Linux

➢ Install SQL Server on Ubuntu➢ Install the SQL Server command-line

tools➢ SQL Server Management Studio -

remote➢ DBeaver – Database Management

Studio➢ Install SQL Server Full-Text Search

on Linux➢ Install SQL Server Agent on Linux➢ SSIS on Linux is available in SQL

Server 2017 CTP2.1➢ Monitoring SQL on Linux

Wrapping Up

What Next for us?!?

3/4/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 34

Microsoft Tech Summit Tel AvivNovember 29-30, 2017Free technical learning event. Whether you’re already cloud-savvy or just getting started, there is something for everyone. Take advantage of the event Hub, a gathering place where you can learn, network, meet partners, visit the community theater, and more!

Download the presentation & start testing

Wrapping Up

What Next for us?!?

3/4/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 35

Microsoft Tech Summit Tel AvivNovember 29-30, 2017Free technical learning event. Whether you’re already cloud-savvy or just getting started, there is something for everyone. Take advantage of the event Hub, a gathering place where you can learn, network, meet partners, visit the community theater, and more!

Download the presentation & start testing

3/4/2017Ronen Ariely, Senior consultant & architect, http://ariely.info 36