Instalação do Microsoft SQL Server 2017 em Red Hat Enterprise Linux 7

Esta primeira instalação é do SQL Server em si.

[root@localhost ~]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   232  100   232    0     0    210      0  0:00:01  0:00:01 --:--:--   211
[root@localhost ~]# yum install -y mssql-server
Loaded plugins: product-id, search-disabled-repos, subscription-manager
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
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 0:14.0.3015.40-1 will be installed
--> Processing Dependency: libsss_nss_idmap for package: mssql-server-14.0.3015.40-1.x86_64
--> 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
---> Package libsss_nss_idmap.x86_64 0:1.15.2-50.el7_4.8 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                           rhel-7-server-rpms                                           52 k
 gdb                                 x86_64                    7.6.1-100.el7                          rhel-7-server-rpms                                          2.4 M
 libsss_nss_idmap                    x86_64                    1.15.2-50.el7_4.8                      rhel-7-server-rpms                                          131 k

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

Total download size: 168 M
Installed size: 173 M
Downloading packages:
(1/4): bzip2-1.0.6-13.el7.x86_64.rpm                                                                                                             |  52 kB  00:00:00
(2/4): libsss_nss_idmap-1.15.2-50.el7_4.8.x86_64.rpm                                                                                             | 131 kB  00:00:00
(3/4): gdb-7.6.1-100.el7.x86_64.rpm                                                                                                              | 2.4 MB  00:00:02
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: NOKEY
Public key for mssql-server-14.0.3015.40-1.x86_64.rpm is not installed
(4/4): mssql-server-14.0.3015.40-1.x86_64.rpm                                                                                                    | 166 MB  00:01:57
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   1.4 MB/s | 168 MB  00:01:57
Retrieving key from https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) "
 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 : libsss_nss_idmap-1.15.2-50.el7_4.8.x86_64                                                                                                            1/4
  Installing : bzip2-1.0.6-13.el7.x86_64                                                                                                                            2/4
  Installing : gdb-7.6.1-100.el7.x86_64                                                                                                                             3/4
  Installing : mssql-server-14.0.3015.40-1.x86_64                                                                                                                   4/4

+--------------------------------------------------------------+
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/4
  Verifying  : mssql-server-14.0.3015.40-1.x86_64                                                                                                                   2/4
  Verifying  : bzip2-1.0.6-13.el7.x86_64                                                                                                                            3/4
  Verifying  : libsss_nss_idmap-1.15.2-50.el7_4.8.x86_64                                                                                                            4/4

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                       libsss_nss_idmap.x86_64 0:1.15.2-50.el7_4.8

Complete!

E agora a configuração, que é necessária para que o SQL Server inicie automaticamente.

[root@localhost ~]# /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...

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.
[root@localhost ~]# 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 16:35:16 -02; 12s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 11173 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─11173 /opt/mssql/bin/sqlservr
           └─11198 /opt/mssql/bin/sqlservr

Jan 22 16:35:22 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:22.97 spid6s      8 transactions rolled forward in database 'msdb' (4:0). This is an...required.
Jan 22 16:35:23 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:23.06 spid6s      0 transactions rolled back in database 'msdb' (4:0). This is an in...required.
Jan 22 16:35:23 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:23.19 spid11s     Polybase feature disabled.
Jan 22 16:35:23 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:23.20 spid11s     Clearing tempdb database.
Jan 22 16:35:25 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:25.11 spid11s     Starting up database 'tempdb'.
Jan 22 16:35:25 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:25.57 spid11s     The tempdb database has 1 data file(s).
Jan 22 16:35:25 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:25.58 spid21s     The Service Broker endpoint is in disabled or stopped state.
Jan 22 16:35:25 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:25.59 spid21s     The Database Mirroring endpoint is in disabled or stopped state.
Jan 22 16:35:25 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:25.67 spid21s     Service Broker manager has started.
Jan 22 16:35:25 localhost.localdomain sqlservr[11173]: 2018-01-22 16:35:25.86 spid6s      Recovery is complete. This is an informational message only. No us...required.
Hint: Some lines were ellipsized, use -l to show in full.

Não se esqueça de liberar a porta no Firewall.

[root@localhost ~]# sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
success
[root@localhost ~]# sudo firewall-cmd --reload
success
[root@localhost ~]# 

A seguir, instalar as ferramentas de linha de comando do SQL Server.

  
[root@localhost ~]# 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    139      0  0:00:01  0:00:01 --:--:--   139
[root@localhost ~]# sudo yum install -y mssql-tools unixODBC-devel
Loaded plugins: product-id, search-disabled-repos, subscription-manager
packages-microsoft-com-prod                                                                                                                      | 2.9 kB  00:00:00
packages-microsoft-com-prod/primary_db                                                                                                           |  42 kB  00:00:00
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: libesoobS.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: libnn.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: libodbcdrvcfg1S.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: libodbcminiS.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: libodbctxtS.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
--> 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: libtemplate.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
--> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-11.el7.x86_64
--> Running transaction check
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 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                           rhel-7-server-rpms                                   55 k
Installing for dependencies:
 libtool-ltdl                           x86_64                         2.4.2-22.el7_3                         rhel-7-server-rpms                                   49 k
 msodbcsql                              x86_64                         13.1.9.2-1                             packages-microsoft-com-prod                         4.0 M
 unixODBC                               x86_64                         2.3.1-11.el7                           rhel-7-server-rpms                                  413 k

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

Total download size: 4.7 M
Installed size: 5.7 M
Downloading packages:
(1/5): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm                                                                                                    |  49 kB  00:00:00
(2/5): unixODBC-2.3.1-11.el7.x86_64.rpm                                                                                                          | 413 kB  00:00:01
(3/5): mssql-tools-14.0.6.0-1.x86_64.rpm                                                                                                         | 249 kB  00:00:01
(4/5): unixODBC-devel-2.3.1-11.el7.x86_64.rpm                                                                                                    |  55 kB  00:00:00
(5/5): msodbcsql-13.1.9.2-1.x86_64.rpm                                                                                                           | 4.0 MB  00:00:04
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   974 kB/s | 4.7 MB  00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                                                   1/5
  Installing : unixODBC-2.3.1-11.el7.x86_64                                                                                                                         2/5
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                                                                                                                          3/5
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                                                                                                                        4/5
  Installing : unixODBC-devel-2.3.1-11.el7.x86_64                                                                                                                   5/5
  Verifying  : unixODBC-devel-2.3.1-11.el7.x86_64                                                                                                                   1/5
  Verifying  : unixODBC-2.3.1-11.el7.x86_64                                                                                                                         2/5
  Verifying  : mssql-tools-14.0.6.0-1.x86_64                                                                                                                        3/5
  Verifying  : msodbcsql-13.1.9.2-1.x86_64                                                                                                                          4/5
  Verifying  : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                                                   5/5

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

Dependency Installed:
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3                        msodbcsql.x86_64 0:13.1.9.2-1                        unixODBC.x86_64 0:2.3.1-11.el7

Complete!
[root@localhost ~]#

E agora, o primeiro acesso e alguns comandos de teste.

[root@localhost ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
[root@localhost ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
[root@localhost ~]# source ~/.bashrc
[root@localhost ~]# sqlcmd -S localhost -U SA -P 'Nerv2018'
1> CREATE DATABASE TestDB
2> GO
1> SELECT Name from sys.Databases
2> GO
Name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
TestDB

(5 rows affected)
1> exit
[root@localhost ~]#

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *