[1] SQL Server – Instalacja

31 stycznia 2022 Wyłączono przez Adam [zicherka] Nogły

Zainstaluj Microsoft SQL Server 2019.

Przed instalacją i użyciem przeczytaj poniższe postanowienia licencyjne. Jeśli używasz go w środowisku produkcyjnym, nie jest darmowy, musisz kupić licencje.

https://www.microsoft.com/en-us/sql-server/sql-server-2019-pricing

[1] Dodaj repozytorium SQL Server 2019 i zainstaluj go.

[root@vlsr01 ~]# curl https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo -o /etc/yum.repos.d/mssql-server-2019.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   231  100   231    0     0    511      0 --:--:-- --:--:-- --:--:--   509
[root@vlsr01 ~]# curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/msprod.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   192  100   192    0     0    598      0 --:--:-- --:--:-- --:--:--   598
[root@vlsr01 ~]# dnf install mssql-server mssql-tools unixODBC-devel

[2] Uruchom ustawienia inicjacyjne.

[root@vlsr01 ~]# /opt/mssql/bin/mssql-conf setup
Locale pl_PL not supported. Using en_US.
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) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
  7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
  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=2109348
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=2104294
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010
Do you accept the license terms? [Yes/No]:Yes
Choose the language for SQL Server:
(1) English
(2) Deutsch
(3) Español
(4) Français
(5) Italiano
(6) 日本語
(7) 한국어
(8) Português
(9) Руѝѝкий
(10) 中文 – 简体
(11) 中文 (繝体)
Enter Option 1-11: 1
Enter the SQL Server system administrator password: #wpisz hasło
Confirm the SQL Server system administrator password: #wpisz hasło ponownie
Configuring SQL Server...
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service → /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

[root@vlsr01 ~]# systemctl status mssql-servermssql-server.service - Microsoft SQL Server Database Engine   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-01-29 16:11:41 CET; 2min 57s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 5379 (sqlservr)
    Tasks: 115
   Memory: 582.6M
   CGroup: /system.slice/mssql-server.service
           ├─5379 /opt/mssql/bin/sqlservr
           └─5410 /opt/mssql/bin/sqlservr

[root@vlsr01 ~]# echo 'export PATH=$PATH:/opt/mssql-tools/bin' > /etc/profile.d/mssql.sh
[root@vlsr01 ~]# source /etc/profile.d/mssql.sh

[3] Jeżeli Firewalld jest uruchomiony, a SQL Server jest/będzie używany ze zdalnych hostow, to zezwol na ruch na porcie [1443/tcp].

[root@vlsr01 ~]# firewall-cmd --add-port=1433/tcp --permanent
[root@vlsr01 ~]# firewall-cmd –reload

[4] Podłącz się do SQL Servera i sprawdź jego poprawną pracę.

#opcja -U SA - użytkownik SA (Administrator)
[root@vlsr01 ~]# sqlcmd -S localhost -U SA
Password: #wpisz hasło

#pokaż bazy systemowe
1> select name,database_id from sys.databases;
2> go
name                                                                                                                             database_id
-------------------------------------------------------------------------------------------------------------------------------- -----------
master                                                                                                                                     1
tempdb                                                                                                                                     2
model                                                                                                                                      3
msdb                                                                                                                                       4
(4 rows affected)

#pokaż użytkowników systemowych
1> select name from sysusers;
2> go
name
--------------------------------------------------------------------------------------------------------------------------------
##MS_AgentSigningCertificate##
##MS_PolicyEventProcessingLogin##
db_accessadmin
db_backupoperator
db_datareader
db_datawriter
db_ddladmin
db_denydatareader
db_denydatawriter
db_owner
db_securityadmin
dbo
guest
INFORMATION_SCHEMA
public
sys
(16 rows affected)

#pokaż aktualnego użytkownika
1> select current_user;
2> go
--------------------------------------------------------------------------------------------------------------------------------
dbo
(1 rows affected)

#wyjdź
1> exit