SQL 2017 on Linux :: Installation

SQL Server 2017 now runs on Linux. SQL Server 2017 has the same underlying database engine on all supported platforms, including Linux. So many existing features and capabilities operate the same way on Linux.

When you install or upgrade SQL Server, you get the latest version of SQL Server from your configured Microsoft repository.

Repository options

There are two main types of repositories for each distribution:

  • Cumulative Updates (CU): The Cumulative Update (CU) repository contains packages for the base SQL Server release and any bug fixes or improvements since that release. Cumulative updates are specific to a release version, such as SQL Server 2017. They are released on a regular cadence.
  • GDR: The GDR repository contains packages for the base SQL Server release and only critical fixes and security updates since that release. These updates are also added to the next CU release.

Each CU and GDR release contains the full SQL Server package and all previous updates for that repository. Updating from a GDR release to a CU release is supported by changing your configured repository for SQL Server.

Here’s how you can get started with the installation for SQL Server 2017:

[aman@linuxserver ~]$ sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for aman:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 232 100 232 0 0 1008 0 –:–:– –:–:– –:–:– 1013
[aman@linuxserver ~]$ sudo yum install -y mssql-server
Loaded plugins: fastestmirror, product-id, rhnplugin, search-disabled-repos, subscription-manager, versionlock
This system is receiving updates from RHN Classic or Red Hat Satellite.
packages-microsoft-com-mssql-server-2017 | 2.9 kB 00:00:00
packages-microsoft-com-mssql-server-2017/primary_db | 8.0 kB 00:00:00
Loading mirror speeds from cached hostfile
* test-customized: yum.domain.com
* test-puppet: yum.domain.com
* test-rhel-base: yum.domain.com
* test-rhel-optional: yum.domain.com
* test-rhel-updates: yum.domain.com
Resolving Dependencies
–> Running transaction check
—> Package mssql-server.x86_64 0:14.0.3015.40-1 will be installed
–> Processing Dependency: gdb for package: mssql-server-14.0.3015.40-1.x86_64
–> Processing Dependency: bzip2 for package: mssql-server-14.0.3015.40-1.x86_64
–> Running transaction check
—> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
—> Package gdb.x86_64 0:7.6.1-100.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================================================
Installing:
mssql-server x86_64 14.0.3015.40-1 packages-microsoft-com-mssql-server-2017 166 M
Installing for dependencies:
bzip2 x86_64 1.0.6-13.el7 test-rhel-updates 52 k
gdb x86_64 7.6.1-100.el7 test-rhel-updates 2.4 M

Transaction Summary
=======================================================================================================================================================================================================
Install 1 Package (+2 Dependent packages)

Total download size: 168 M
Installed size: 173 M
Downloading packages:
(1/3): bzip2-1.0.6-13.el7.x86_64.rpm | 52 kB 00:00:00
(2/3): gdb-7.6.1-100.el7.x86_64.rpm | 2.4 MB 00:00:00
warning: /var/cache/yum/x86_64/7Server/packages-microsoft-com-mssql-server-2017/packages/mssql-server-14.0.3015.40-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEYB 00:00:00 ETA
Public key for mssql-server-14.0.3015.40-1.x86_64.rpm is not installed
(3/3): mssql-server-14.0.3015.40-1.x86_64.rpm | 166 MB 00:00:11
——————————————————————————————————————————————————————————————————-
Total 14 MB/s | 168 MB 00:00:11
Retrieving key from https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
Userid : “Microsoft (Release signing) <gpgsecurity@microsoft.com>”
Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : bzip2-1.0.6-13.el7.x86_64 1/3
Installing : gdb-7.6.1-100.el7.x86_64 2/3
Installing : mssql-server-14.0.3015.40-1.x86_64 3/3

+————————————————————–+
Please run ‘sudo /opt/mssql/bin/mssql-conf setup’ to complete the setup of Microsoft SQL Server
+————————————————————–+

Verifying : gdb-7.6.1-100.el7.x86_64 1/3
Verifying : mssql-server-14.0.3015.40-1.x86_64 2/3
Verifying : bzip2-1.0.6-13.el7.x86_64 3/3

Installed:
mssql-server.x86_64 0:14.0.3015.40-1

Dependency Installed:
bzip2.x86_64 0:1.0.6-13.el7 gdb.x86_64 0:7.6.1-100.el7

Complete!
[aman@linuxserver ~]$ sudo /opt/mssql/bin/mssql-conf setup
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID)
7) Enterprise Core (PAID)
8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-8): 2
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Do you accept the license terms? [Yes/No]:yes

Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server…

The SQL Server End-User License Agreement (EULA) must be accepted before SQL
Server can start. The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388.

You can accept the EULA by specifying the –accept-eula command line option,
setting the ACCEPT_EULA environment variable, or using the mssql-conf tool.
Initial setup of Microsoft SQL Server failed. Please consult the ERRORLOG
in /var/opt/mssql/log for more information.

Give full control on the directory, to have a seamless setup and then rerun the mssql-conf:
[aman@linuxserver opt]$ sudo chmod -R 777 /var/opt/mssql

[aman@linuxserver data]$ sudo /opt/mssql/bin/mssql-conf setup
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID)
7) Enterprise Core (PAID)
8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-8): 2
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server…

Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.
[aman@linuxserver data]$ systemctl status mssql-server
● mssql-server.service – Microsoft SQL Server Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-01-22 19:44:59 PST; 1min 19s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 25823 (sqlservr)
CGroup: /system.slice/mssql-server.service
├─25823 /opt/mssql/bin/sqlservr
└─25846 /opt/mssql/bin/sqlservr

Installing Tools required for SQL Server:

[aman@linuxserver data]$ sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 193 100 193 0 0 877 0 –:–:– –:–:– –:–:– 881
[aman@linuxserver data]$ sudo yum install -y mssql-tools unixODBC-devel
Loaded plugins: fastestmirror, product-id, rhnplugin, search-disabled-repos, subscription-manager, versionlock
This system is receiving updates from RHN Classic or Red Hat Satellite.
packages-microsoft-com-prod | 2.9 kB 00:00:00
packages-microsoft-com-prod/primary_db | 42 kB 00:00:00
Loading mirror speeds from cached hostfile
* test-customized: yum.domain.com
* test-puppet: yum.domain.com
* test-rhel-base: yum.domain.com
* test-rhel-optional: yum.domain.com
* test-rhel-updates: yum.domain.com
Resolving Dependencies
–> Running transaction check
—> Package mssql-tools.x86_64 0:14.0.6.0-1 will be installed
–> Processing Dependency: msodbcsql < 13.2.0.0 for package: mssql-tools-14.0.6.0-1.x86_64
–> Processing Dependency: msodbcsql >= 13.1.0.0 for package: mssql-tools-14.0.6.0-1.x86_64
—> Package unixODBC-devel.x86_64 0:2.3.1-11.el7 will be installed
–> Processing Dependency: unixODBC(x86-64) = 2.3.1-11.el7 for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libodbcminiS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libnn.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libesoobS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libsapdbS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libtdsS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libodbctxtS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libtemplate.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libodbcnnS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libodbcdrvcfg2S.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libmimerS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libodbcdrvcfg1S.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: libodbccr.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: liboplodbcS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Processing Dependency: liboraodbcS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
–> Running transaction check
—> Package msodbcsql.x86_64 0:13.1.9.2-1 will be installed
—> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================================================
Installing:
mssql-tools x86_64 14.0.6.0-1 packages-microsoft-com-prod 249 k
unixODBC-devel x86_64 2.3.1-11.el7 test-rhel-updates 55 k
Installing for dependencies:
msodbcsql x86_64 13.1.9.2-1 packages-microsoft-com-prod 4.0 M
unixODBC x86_64 2.3.1-11.el7 test-rhel-updates 413 k

Transaction Summary
=======================================================================================================================================================================================================
Install 2 Packages (+2 Dependent packages)

Total download size: 4.7 M
Installed size: 5.6 M
Downloading packages:
(1/4): unixODBC-devel-2.3.1-11.el7.x86_64.rpm | 55 kB 00:00:00
(2/4): unixODBC-2.3.1-11.el7.x86_64.rpm | 413 kB 00:00:00
(3/4): mssql-tools-14.0.6.0-1.x86_64.rpm | 249 kB 00:00:00
(4/4): msodbcsql-13.1.9.2-1.x86_64.rpm | 4.0 MB 00:00:00
——————————————————————————————————————————————————————————————————-
Total 7.1 MB/s | 4.7 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : unixODBC-2.3.1-11.el7.x86_64 1/4
The license terms for this product can be downloaded from
https://aka.ms/odbc131eula and found in
/usr/share/doc/msodbcsql/LICENSE.TXT . By entering ‘YES’,
you indicate that you accept the license terms.

Do you accept the license terms? (Enter YES or NO)
YES
Installing : msodbcsql-13.1.9.2-1.x86_64 2/4
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt . By entering ‘YES’,
you indicate that you accept the license terms.

Do you accept the license terms? (Enter YES or NO)
YES
Installing : mssql-tools-14.0.6.0-1.x86_64 3/4
Installing : unixODBC-devel-2.3.1-11.el7.x86_64 4/4
Verifying : unixODBC-devel-2.3.1-11.el7.x86_64 1/4
Verifying : unixODBC-2.3.1-11.el7.x86_64 2/4
Verifying : mssql-tools-14.0.6.0-1.x86_64 3/4
Verifying : msodbcsql-13.1.9.2-1.x86_64 4/4

Installed:
mssql-tools.x86_64 0:14.0.6.0-1 unixODBC-devel.x86_64 0:2.3.1-11.el7

Dependency Installed:
msodbcsql.x86_64 0:13.1.9.2-1 unixODBC.x86_64 0:2.3.1-11.el7

Complete!
[aman@linuxserver data]$ echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bash_profile
[aman@linuxserver data]$ echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bashrc
[aman@linuxserver data]$ source ~/.bashrc
[aman@linuxserver data]$ sqlcmd -S linuxserver -U sa -p
Password:
1> select @@version;
2> go

————————————————————————————————————————————————————————————————————————————————————————————————————
Microsoft SQL Server 2017 (RTM-CU3-GDR) (KB4052987) – 14.0.3015.40 (X64)
Dec 22 2017 16:13:22
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (Red Hat Enterprise Linux Server 7.4 (Maipo))

Installing SQL Server Agent:

[aman@linuxserver data]$ sudo yum install mssql-server-agent
[sudo] password for aman:
Loaded plugins: fastestmirror, product-id, rhnplugin, search-disabled-repos, subscription-manager, versionlock
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
* test-customized: yum.domain.com
* test-puppet: yum.domain.com
* test-rhel-base: yum.domain.com
* test-rhel-optional: yum.domain.com
* test-rhel-updates: yum.domain.com
Resolving Dependencies
–> Running transaction check
—> Package mssql-server-agent.x86_64 0:14.0.3015.40-1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================================================
Installing:
mssql-server-agent x86_64 14.0.3015.40-1 packages-microsoft-com-mssql-server-2017 1.5 M

Transaction Summary
=======================================================================================================================================================================================================
Install 1 Package

Total download size: 1.5 M
Installed size: 1.5 M
Is this ok [y/d/N]: y
Downloading packages:
mssql-server-agent-14.0.3015.40-1.x86_64.rpm | 1.5 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mssql-server-agent-14.0.3015.40-1.x86_64 1/1

+——————————————————————————–+
Please restart mssql-server to enable Microsoft SQL Server Agent.
+——————————————————————————–+

Verifying : mssql-server-agent-14.0.3015.40-1.x86_64 1/1

Installed:
mssql-server-agent.x86_64 0:14.0.3015.40-1

Complete!
[aman@linuxserver data]$ sudo systemctl restart mssql-server
[aman@linuxserver data]$ systemctl status mssql-server
● mssql-server.service – Microsoft SQL Server Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-01-22 20:03:00 PST; 14s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 2827 (sqlservr)
CGroup: /system.slice/mssql-server.service
├─2827 /opt/mssql/bin/sqlservr
└─2829 /opt/mssql/bin/sqlservr

In similar fashion, we can install Integration Services on SQL Server 2017 for Linux:

sudo yum install -y mssql-server-is
Loaded plugins: fastestmirror, product-id, rhnplugin, search-disabled-repos, subscription-manager, versionlock
This system is receiving updates from RHN Classic or Red Hat Satellite.
packages-microsoft-com-mssql-server-2017 | 2.9 kB 00:00:00
Loading mirror speeds from cached hostfile
* domain-customized: yup.domain.com
* domain-puppet: yup.domain.com
* domain-rhel-base: yup.domain.com
* domain-rhel-optional: yup.domain.com
* domain-rhel-updates: yup.domain.com
Resolving Dependencies
–> Running transaction check
—> Package mssql-server-is.x86_64 0:14.0.3015.40-1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================================================================
Installing:
mssql-server-is x86_64 14.0.3015.40-1 packages-microsoft-com-mssql-server-2017
172 M

Transaction Summary
======================================================================================================================================================================================================
Install 1 Package

Total download size: 172 M
Installed size: 815 M
Downloading packages:
mssql-server-is-14.0.3015.40-1.x86_64.rpm | 172 MB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mssql-server-is-14.0.3015.40-1.x86_64 1/1

+——————————————————————————–+
Please run ‘sudo /opt/ssis/bin/ssis-conf setup’
to complete the setup of Microsoft SQL Server Integration Services
+——————————————————————————–+

Verifying : mssql-server-is-14.0.3015.40-1.x86_64 1/1

Installed:
mssql-server-is.x86_64 0:14.0.3015.40-1

Complete!
[aman@linuxserver ~]$ sudo /opt/ssis/bin/ssis-conf setup
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID)
7) Enterprise Core (PAID)
8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-8): 2
The license terms for this product can be downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Do you accept the license terms? [Yes/No]:YES

Setup has completed successfully.
[aman@linuxserver ~]$ export PATH=/opt/ssis/bin:$PATH

 

Happy learning!

Cheers!
Aman Kharbanda

Advertisements