In this article, you will learn how to install Microsoft SQL Server on Rocky Linux 8 or other RPM based Linux distros.
Table of Contents:
- What is Microsoft SQL Server?
- What is Transact-SQL?
- Environment Specification
- Update your Rocky Linux Server
- Install Python on Rocky Linux Server
- Install SQL Server Official Yum Repository
- Install Microsoft SQL Server on Rocky Linux
- Configure Linux Firewall
- Install MS SQL Server Command-line Tools
- Conclusion
What is Microsoft SQL Server? :
Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network (including the Internet). Microsoft markets at least a dozen different editions of Microsoft SQL Server, aimed at different audiences and for workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users. (Source: Wikipedia)
What is Transact-SQL? :
Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to the SQL (Structured Query Language) used to interact with relational databases. T-SQL expands on the SQL standard to include procedural programming, local variables, various support functions for string processing, date processing, mathematics, etc. and changes to the DELETE and UPDATE statements.
Transact-SQL is central to using Microsoft SQL Server. All applications that communicate with an instance of SQL Server do so by sending Transact-SQL statements to the server, regardless of the user interface of the application. (Source: Wikipedia)
Recommended Book: Exam Ref 70-761 Querying Data with Transact-SQL 1st Edition
Recommended Online Training: Querying Data with Transact-SQL
Environment Specification:
We are using a minimal Rocky Linux 8 virtual machine with following specifications.
- CPU - 3.4 Ghz (2 cores)
- Memory - 2 GB
- Storage - 20 GB
- Operating System - Rocky Linux 8.6 (Green Obsidian)
- Hostname – mssql-server-01.centlinux.com
- IP Address - 192.168.116.128 /24
Update your Rocky Linux Server:
By using a ssh client, connect with mssql-server-01.centlinux.com as root user.
Build cache for already installed yum repositories as follows.
# dnf makecache
Rocky Linux 8 - AppStream 451 kB/s | 8.3 MB 00:18
Rocky Linux 8 - BaseOS 628 kB/s | 2.6 MB 00:04
Rocky Linux 8 - Extras 234 B/s | 11 kB 00:47
Metadata cache created.
Execute following dnf command to update your Rocky Linux server.
# dnf update -y
If the above command updates your Linux Kernel, then you should reboot your Linux operating system with newly installed Kernel.
# reboot
After reboot, verify the versions of Linux Operating System and Kernel.
# uname -r 4.18.0-372.9.1.el8.x86_64 # cat /etc/rocky-release Rocky Linux release 8.6 (Green Obsidian)
Install Python on Rocky Linux Server:
MS SQL Server requires python2. Since, we are using a minimal installed Rocky Linux server. Therefore, you have to install Python2 before installing MS SQL Server.
Check if python interpreter is installed on your server.
# alternatives --config python
There is 1 program that provides 'python'.
Selection Command
-----------------------------------------------
*+ 1 /usr/libexec/no-python
Enter to keep the current selection[+], or type selection number:
Install python2 and openssl10 software packages by executing following command.
# dnf install -y python2 compat-openssl10
Last metadata expiration check: 0:00:25 ago on Fri 27 May 2022 09:52:40 PM PKT.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
compat-openssl10 x86_64 1:1.0.2o-3.el8 appstream 1.1 M
python2 x86_64 2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2
appstream 110 k
Installing dependencies:
make x86_64 1:4.2.1-11.el8 baseos 497 k
python2-libs x86_64 2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2
appstream 6.0 M
python2-pip-wheel noarch 9.0.3-19.module+el8.6.0+793+57002515 appstream 891 k
python2-setuptools-wheel
noarch 39.0.1-13.module+el8.4.0+403+9ae17a31 appstream 286 k
Installing weak dependencies:
python2-pip noarch 9.0.3-19.module+el8.6.0+793+57002515 appstream 1.6 M
python2-setuptools
noarch 39.0.1-13.module+el8.4.0+403+9ae17a31 appstream 641 k
Enabling module streams:
python27 2.7
Transaction Summary
================================================================================
Install 8 Packages
Total download size: 11 M
Installed size: 41 M
Downloading Packages:
(1/8): python2-2.7.18-10.module+el8.6.0+793+570 126 kB/s | 110 kB 00:00
(2/8): compat-openssl10-1.0.2o-3.el8.x86_64.rpm 307 kB/s | 1.1 MB 00:03
(3/8): python2-pip-9.0.3-19.module+el8.6.0+793+ 503 kB/s | 1.6 MB 00:03
(4/8): python2-setuptools-39.0.1-13.module+el8. 439 kB/s | 641 kB 00:01
(5/8): python2-setuptools-wheel-39.0.1-13.modul 368 kB/s | 286 kB 00:00
(6/8): python2-pip-wheel-9.0.3-19.module+el8.6. 282 kB/s | 891 kB 00:03
(7/8): python2-libs-2.7.18-10.module+el8.6.0+79 569 kB/s | 6.0 MB 00:10
(8/8): make-4.2.1-11.el8.x86_64.rpm 25 kB/s | 497 kB 00:19
--------------------------------------------------------------------------------
Total 400 kB/s | 11 MB 00:28
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : make-1:4.2.1-11.el8.x86_64 1/8
Running scriptlet: make-1:4.2.1-11.el8.x86_64 1/8
Installing : python2-setuptools-wheel-39.0.1-13.module+el8.4.0+40 2/8
Installing : python2-pip-wheel-9.0.3-19.module+el8.6.0+793+570025 3/8
Installing : python2-libs-2.7.18-10.module+el8.6.0+793+57002515.r 4/8
Installing : python2-pip-9.0.3-19.module+el8.6.0+793+57002515.noa 5/8
Installing : python2-setuptools-39.0.1-13.module+el8.4.0+403+9ae1 6/8
Installing : python2-2.7.18-10.module+el8.6.0+793+57002515.rocky. 7/8
Running scriptlet: python2-2.7.18-10.module+el8.6.0+793+57002515.rocky. 7/8
Installing : compat-openssl10-1:1.0.2o-3.el8.x86_64 8/8
Running scriptlet: compat-openssl10-1:1.0.2o-3.el8.x86_64 8/8
Verifying : compat-openssl10-1:1.0.2o-3.el8.x86_64 1/8
Verifying : python2-2.7.18-10.module+el8.6.0+793+57002515.rocky. 2/8
Verifying : python2-libs-2.7.18-10.module+el8.6.0+793+57002515.r 3/8
Verifying : python2-pip-9.0.3-19.module+el8.6.0+793+57002515.noa 4/8
Verifying : python2-pip-wheel-9.0.3-19.module+el8.6.0+793+570025 5/8
Verifying : python2-setuptools-39.0.1-13.module+el8.4.0+403+9ae1 6/8
Verifying : python2-setuptools-wheel-39.0.1-13.module+el8.4.0+40 7/8
Verifying : make-1:4.2.1-11.el8.x86_64 8/8
Installed:
compat-openssl10-1:1.0.2o-3.el8.x86_64
make-1:4.2.1-11.el8.x86_64
python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64
python2-libs-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64
python2-pip-9.0.3-19.module+el8.6.0+793+57002515.noarch
python2-pip-wheel-9.0.3-19.module+el8.6.0+793+57002515.noarch
python2-setuptools-39.0.1-13.module+el8.4.0+403+9ae17a31.noarch
python2-setuptools-wheel-39.0.1-13.module+el8.4.0+403+9ae17a31.noarch
Complete!
Configure the default Python interpreter by using following command.
# alternatives --config python There are 2 programs which provide 'python'. Selection Command ----------------------------------------------- *+ 1 /usr/libexec/no-python 2 /usr/bin/python2 Enter to keep the current selection[+], or type selection number: 2
Verify the Python version by executing following command at Linux bash prompt.
# python -V
Python 2.7.18
Install SQL Server Official Yum Repository:
Microsoft distributes the SQL Server software through their Official yum repository.
You can install SQL Server official yum repository as follows.
# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/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 265 0 --:--:-- --:--:-- --:--:-- 265
Build the cache for newly installed yum repositories.
# dnf makecache
Rocky Linux 8 - AppStream 3.0 kB/s | 4.8 kB 00:01
Rocky Linux 8 - BaseOS 2.1 kB/s | 4.3 kB 00:02
Rocky Linux 8 - Extras 2.4 kB/s | 3.5 kB 00:01
packages-microsoft-com-mssql-server-2019 805 kB/s | 4.6 MB 00:05
Metadata cache created.
Install Microsoft SQL Server on Rocky Linux:
You have already installed Microsoft Official yum repository. Therefore, you can now easily install MS SQL Server by executing following dnf command.
# dnf install -y mssql-server
...
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
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libmpc-1.1.0-9.1.el8.x86_64 1/30
Installing : cpp-8.5.0-10.el8.x86_64 2/30
Running scriptlet: cpp-8.5.0-10.el8.x86_64 2/30
Installing : python3-setuptools-39.2.0-6.el8.noarch 3/30
Installing : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_ 4/30
Running scriptlet: python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_ 4/30
Installing : python3-pip-9.0.3-22.el8.rocky.0.noarch 5/30
Installing : pkgconf-m4-1.4.2-1.el8.noarch 6/30
Installing : libtool-ltdl-2.4.6-25.el8.x86_64 7/30
Running scriptlet: libtool-ltdl-2.4.6-25.el8.x86_64 7/30
Installing : libpkgconf-1.4.2-1.el8.x86_64 8/30
Installing : pkgconf-1.4.2-1.el8.x86_64 9/30
Installing : pkgconf-pkg-config-1.4.2-1.el8.x86_64 10/30
Installing : libbabeltrace-1.5.4-3.el8.x86_64 11/30
Running scriptlet: libbabeltrace-1.5.4-3.el8.x86_64 11/30
Installing : libatomic-8.5.0-10.el8.x86_64 12/30
Running scriptlet: libatomic-8.5.0-10.el8.x86_64 12/30
Installing : kernel-headers-4.18.0-372.9.1.el8.x86_64 13/30
Running scriptlet: glibc-headers-2.28-189.1.el8.x86_64 14/30
Installing : glibc-headers-2.28-189.1.el8.x86_64 14/30
Installing : libxcrypt-devel-4.1.1-6.el8.x86_64 15/30
Installing : glibc-devel-2.28-189.1.el8.x86_64 16/30
Running scriptlet: glibc-devel-2.28-189.1.el8.x86_64 16/30
Installing : cyrus-sasl-gssapi-2.1.27-6.el8_5.x86_64 17/30
Running scriptlet: cyrus-sasl-2.1.27-6.el8_5.x86_64 18/30
Installing : cyrus-sasl-2.1.27-6.el8_5.x86_64 18/30
Running scriptlet: cyrus-sasl-2.1.27-6.el8_5.x86_64 18/30
Installing : bzip2-1.0.6-26.el8.x86_64 19/30
Installing : binutils-2.30-113.el8.x86_64 20/30
Running scriptlet: binutils-2.30-113.el8.x86_64 20/30
Installing : libipt-1.6.1-8.el8.x86_64 21/30
Installing : libatomic_ops-7.6.2-3.el8.x86_64 22/30
Installing : gc-7.6.4-3.el8.x86_64 23/30
Installing : guile-5:2.0.14-7.el8.x86_64 24/30
Running scriptlet: guile-5:2.0.14-7.el8.x86_64 24/30
Installing : gdb-headless-8.2-18.el8.x86_64 25/30
Installing : isl-0.16.1-6.el8.x86_64 26/30
Running scriptlet: isl-0.16.1-6.el8.x86_64 26/30
Installing : gcc-8.5.0-10.el8.x86_64 27/30
Running scriptlet: gcc-8.5.0-10.el8.x86_64 27/30
Installing : gcc-gdb-plugin-8.5.0-10.el8.x86_64 28/30
Running scriptlet: gcc-gdb-plugin-8.5.0-10.el8.x86_64 28/30
Installing : gdb-8.2-18.el8.x86_64 29/30
Running scriptlet: mssql-server-15.0.4223.1-2.x86_64 30/30
Installing : mssql-server-15.0.4223.1-2.x86_64 30/30
Running scriptlet: mssql-server-15.0.4223.1-2.x86_64 30/30
+--------------------------------------------------------------+
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
+--------------------------------------------------------------+
Running scriptlet: guile-5:2.0.14-7.el8.x86_64 30/30
Running scriptlet: mssql-server-15.0.4223.1-2.x86_64 30/30
Verifying : cpp-8.5.0-10.el8.x86_64 1/30
Verifying : gc-7.6.4-3.el8.x86_64 2/30
Verifying : gcc-8.5.0-10.el8.x86_64 3/30
Verifying : gcc-gdb-plugin-8.5.0-10.el8.x86_64 4/30
Verifying : gdb-8.2-18.el8.x86_64 5/30
Verifying : gdb-headless-8.2-18.el8.x86_64 6/30
Verifying : guile-5:2.0.14-7.el8.x86_64 7/30
Verifying : isl-0.16.1-6.el8.x86_64 8/30
Verifying : libatomic_ops-7.6.2-3.el8.x86_64 9/30
Verifying : libipt-1.6.1-8.el8.x86_64 10/30
Verifying : libmpc-1.1.0-9.1.el8.x86_64 11/30
Verifying : python3-pip-9.0.3-22.el8.rocky.0.noarch 12/30
Verifying : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_ 13/30
Verifying : binutils-2.30-113.el8.x86_64 14/30
Verifying : bzip2-1.0.6-26.el8.x86_64 15/30
Verifying : cyrus-sasl-2.1.27-6.el8_5.x86_64 16/30
Verifying : cyrus-sasl-gssapi-2.1.27-6.el8_5.x86_64 17/30
Verifying : glibc-devel-2.28-189.1.el8.x86_64 18/30
Verifying : glibc-headers-2.28-189.1.el8.x86_64 19/30
Verifying : kernel-headers-4.18.0-372.9.1.el8.x86_64 20/30
Verifying : libatomic-8.5.0-10.el8.x86_64 21/30
Verifying : libbabeltrace-1.5.4-3.el8.x86_64 22/30
Verifying : libpkgconf-1.4.2-1.el8.x86_64 23/30
Verifying : libtool-ltdl-2.4.6-25.el8.x86_64 24/30
Verifying : libxcrypt-devel-4.1.1-6.el8.x86_64 25/30
Verifying : pkgconf-1.4.2-1.el8.x86_64 26/30
Verifying : pkgconf-m4-1.4.2-1.el8.noarch 27/30
Verifying : pkgconf-pkg-config-1.4.2-1.el8.x86_64 28/30
Verifying : python3-setuptools-39.2.0-6.el8.noarch 29/30
Verifying : mssql-server-15.0.4223.1-2.x86_64 30/30
Installed:
binutils-2.30-113.el8.x86_64
bzip2-1.0.6-26.el8.x86_64
cpp-8.5.0-10.el8.x86_64
cyrus-sasl-2.1.27-6.el8_5.x86_64
cyrus-sasl-gssapi-2.1.27-6.el8_5.x86_64
gc-7.6.4-3.el8.x86_64
gcc-8.5.0-10.el8.x86_64
gcc-gdb-plugin-8.5.0-10.el8.x86_64
gdb-8.2-18.el8.x86_64
gdb-headless-8.2-18.el8.x86_64
glibc-devel-2.28-189.1.el8.x86_64
glibc-headers-2.28-189.1.el8.x86_64
guile-5:2.0.14-7.el8.x86_64
isl-0.16.1-6.el8.x86_64
kernel-headers-4.18.0-372.9.1.el8.x86_64
libatomic-8.5.0-10.el8.x86_64
libatomic_ops-7.6.2-3.el8.x86_64
libbabeltrace-1.5.4-3.el8.x86_64
libipt-1.6.1-8.el8.x86_64
libmpc-1.1.0-9.1.el8.x86_64
libpkgconf-1.4.2-1.el8.x86_64
libtool-ltdl-2.4.6-25.el8.x86_64
libxcrypt-devel-4.1.1-6.el8.x86_64
mssql-server-15.0.4223.1-2.x86_64
pkgconf-1.4.2-1.el8.x86_64
pkgconf-m4-1.4.2-1.el8.noarch
pkgconf-pkg-config-1.4.2-1.el8.x86_64
python3-pip-9.0.3-22.el8.rocky.0.noarch
python3-setuptools-39.2.0-6.el8.noarch
python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64
Complete!
Invoke Microsoft SQL Server setup to configure your preferred edition.
# /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) - 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&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=2104294&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... 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.
The MS SQL Server setup is completed. The setup process also enable and start the mssql-server.service.
Execute the following command to check the status of mssql-server.service.
# systemctl status mssql-server.service
● mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendo>
Active: active (running) since Sun 2022-05-29 08:41:05 PKT; 1min 31s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 922 (sqlservr)
Tasks: 123
Memory: 1.4G
CGroup: /system.slice/mssql-server.service
├─ 922 /opt/mssql/bin/sqlservr
└─1154 /opt/mssql/bin/sqlservr
May 29 08:42:02 mssql-server-01.centlinux.com sqlservr[1154]: [156B blob data]
May 29 08:42:02 mssql-server-01.centlinux.com sqlservr[1154]: [160B blob data]
May 29 08:42:03 mssql-server-01.centlinux.com sqlservr[1154]: [61B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [96B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [66B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [75B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [96B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [100B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [71B blob data]
May 29 08:42:04 mssql-server-01.centlinux.com sqlservr[1154]: [124B blob data]
Configure Linux Firewall:
To enable access to your MS SQL Server database server from across the network. You have to allow the default service port in Linux firewall.
# firewall-cmd --zone=public --add-port=1433/tcp --permanent success # firewall-cmd --reload success
Install MS SQL Server Command-line Tools:
To connect to a MS SQL Server and execute SQL commands, You need Transact SQL (T-SQL) command-line tools.
MS SQL Server command-line tools are provided with another official yum repository from Microsoft Corporation.
Use curl command to download and add yum repository in your Linux operating system.
# curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 192 100 192 0 0 203 0 --:--:-- --:--:-- --:--:-- 202
You have to rebuild the yum cache because you have added a new repo on your Linux operating system.
# dnf makecache
Rocky Linux 8 - AppStream 1.4 kB/s | 4.8 kB 00:03
Rocky Linux 8 - BaseOS 2.0 kB/s | 4.3 kB 00:02
Rocky Linux 8 - Extras 1.4 kB/s | 3.5 kB 00:02
packages-microsoft-com-prod 525 kB/s | 3.6 MB 00:07
packages-microsoft-com-mssql-server-2019 4.0 kB/s | 3.0 kB 00:00
Metadata cache created.
Now execute the following command to install MS SQL Command-line tools.
# dnf install -y mssql-tools unixODBC-devel Last metadata expiration check: 0:01:34 ago on Sun 29 May 2022 08:51:00 AM PKT. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mssql-tools x86_64 17.9.1.1-1 packages-microsoft-com-prod 291 k unixODBC-devel x86_64 2.3.7-1.rh packages-microsoft-com-prod 42 k Installing dependencies: msodbcsql17 x86_64 17.9.1.1-1 packages-microsoft-com-prod 909 k unixODBC x86_64 2.3.7-1.rh packages-microsoft-com-prod 213 k Transaction Summary ================================================================================ Install 4 Packages Total download size: 1.4 M Installed size: 3.8 M Downloading Packages: (1/4): unixODBC-2.3.7-1.rh.x86_64.rpm 149 kB/s | 213 kB 00:01 (2/4): mssql-tools-17.9.1.1-1.x86_64.rpm 190 kB/s | 291 kB 00:01 (3/4): unixODBC-devel-2.3.7-1.rh.x86_64.rpm 218 kB/s | 42 kB 00:00 (4/4): msodbcsql17-17.9.1.1-1.x86_64.rpm 395 kB/s | 909 kB 00:02 -------------------------------------------------------------------------------- Total 621 kB/s | 1.4 MB 00:02 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : unixODBC-2.3.7-1.rh.x86_64 1/4 Running scriptlet: unixODBC-2.3.7-1.rh.x86_64 1/4 Running scriptlet: msodbcsql17-17.9.1.1-1.x86_64 2/4 The license terms for this product can be downloaded from https://aka.ms/odbc17eula and found in /usr/share/doc/msodbcsql17/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 : msodbcsql17-17.9.1.1-1.x86_64 2/4 Running scriptlet: msodbcsql17-17.9.1.1-1.x86_64 2/4 Running scriptlet: mssql-tools-17.9.1.1-1.x86_64 3/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-17.9.1.1-1.x86_64 3/4 Installing : unixODBC-devel-2.3.7-1.rh.x86_64 4/4 Running scriptlet: msodbcsql17-17.9.1.1-1.x86_64 4/4 Running scriptlet: unixODBC-devel-2.3.7-1.rh.x86_64 4/4 Verifying : msodbcsql17-17.9.1.1-1.x86_64 1/4 Verifying : mssql-tools-17.9.1.1-1.x86_64 2/4 Verifying : unixODBC-2.3.7-1.rh.x86_64 3/4 Verifying : unixODBC-devel-2.3.7-1.rh.x86_64 4/4 Installed: msodbcsql17-17.9.1.1-1.x86_64 mssql-tools-17.9.1.1-1.x86_64 unixODBC-2.3.7-1.rh.x86_64 unixODBC-devel-2.3.7-1.rh.x86_64 Complete!
Add MS SQL Server command-line tools directory to PATH environment variable to make it executable from anywhere.
# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile # echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc # source ~/.bashrc
Execute sqlcmd command to connect with your Microsoft SQL Server.
# sqlcmd -S localhost -U SA
Password:
1>
Now you at the Transact SQL shell. you can execute SQL commands thereon.
Execute the following T-SQL command to get list of databases on your MS SQL Server.
1> SELECT Name from sys.Databases; 2> GO Name ------------------------------------------- master tempdb model msdb (4 rows affected)
Create a test database in SQL Server.
1> CREATE DATABASE Test 2> GO
Connect to test database and create a table thereon.
1> USE Test 2> GO Changed database context to 'Test'. 1> CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT) 2> GO
Insert some data in your table.
1> INSERT INTO Inventory VALUES (1, 'KEYBOARD', 800); 2> INSERT INTO Inventory VALUES (2, 'MOUSE', 800); 3> GO (1 rows affected) (1 rows affected)
Query your table to display its content.
1> SELECT * FROM Inventory; 2> GO id name quantity ----------- -------------------------------------------------- ----------- 1 KEYBOARD 800 2 MOUSE 800 (2 rows affected)
Exit from T-SQL shell.
1> QUIT
Conclusion:
In this article, you have successfully installed Microsoft SQL Server on Rocky Linux 8 or other RPM based Linux distros.
No comments:
Post a Comment