This article explains how to install SQL server 2017 CTP with offline setup in Linux.

 Minimum requirement for mssql installation:-

  • You need at least 3.25GB of memory to run SQL Server on Linux.
  • SQL Server Engine has been tested up to 1 TB of memory at this time. The file system must be XFS or EXT4. Other file systems, such as BTRFS, are unsupported. 
                mount | grep "^/dev"       --check file system
                /dev/mapper/vg1-root_lv on / type ext4 (rw,relatime,data=ordered)
               /dev/sda1 on /boot type ext4 (rw,relatime,data=ordered)
              /dev/mapper/vg1-tmp_lv on /tmp type ext4 (rw,relatime,data=ordered)

  • you need  administrative access for installation.
            sudo -l -U msdba   -->User msdba is not allowed to run sudo on servername

Fresh install

1. Login with superuser

Sudo su 
#cat /etc/centos-release  --check version

CentOS Linux release 7.3.1611 (Core)
My system is Centos 7 so I am selecting 7. there is 6 also.
https://packages.microsoft.com/config/rhel/

2. Download Microsoft SQl server Red hat repository configuration file.

 You can copy repository file using winscp in centos machine.

3. Copy file in /etc/yum.repos.d/firectory. 

Yum repository must present in this location only

cp  mssql-server.repo /etc/yum.repos.d/mssql-server.repo

cp prod.repo /etc/yum.repos.d/msprod.repo

4. Install mssql using yum install.  

sudo yum install -y mssql-server
#sudo yum install -y mssql-server 
Loaded plugins: fastestmirror, langpacks packages-microsoft-com-mssql-server  | 2.9 kB  00:00  
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * epel: repo.ugm.ac.id
 * extras: mirror.fibergrid.in
 * updates: mirror.fibergrid.in
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 0:14.0.500.272-2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package  Arch  Version  Repository  Size
================================================================================
Installing:
 mssql-server x86_64 14.0.500.272-2  packages-microsoft-com-mssql-server 159 M
 Transaction Summary
================================================================================
Install  1 Package
Total download size: 159 M
Installed size: 159 M
Downloading packages:
mssql-server-14.0.500.272- 0% [  ]  0.0 B/s |  0 B  --:-- ETA
mssql-server-14.0.500.272- 0% [  ]  0.0 B/s | 576 kB  --:-- ETA
mssql-server-14.0.500.272- 0% [  ] 1.3 MB/s | 1.4 MB  02:01 ETA
mssql-server-14.0.500.272- 1% [  ] 1.4 MB/s | 2.4 MB  01:52 ETA
mssql-server-14.0.500.272- 99% [===============-] 4.2 MB/s | 157 MB  00:00 ETA
mssql-server-14.0.500.272- 99% [===============-] 4.2 MB/s | 159 MB  00:00 ETA
mssql-server-14.0.500.272-2.x86_64.rpm  | 159 MB  00:39 
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : mssql-server-14.0.500.272-2. [############################ ] 1/1
 Installing : mssql-server-14.0.500.272-2.x86_64  1/1
+--------------------------------------------------------------+
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
+--------------------------------------------------------------+
 Verifying  : mssql-server-14.0.500.272-2.x86_64  1/1
Installed:
 mssql-server.x86_64 0:14.0.500.272-2 
Complete!

5. Configuration and setting SA password with strong password.


sudo /opt/mssql/bin/mssql-conf setup
.
# sudo /opt/mssql/bin/mssql-conf setup
The license terms for this product can be downloaded from
 and found in /usr/share/doc/mssql-server/LICENSE.TXT.
Do you accept the license terms? [Yes/No]:yes 
Setting up Microsoft SQL Server 
Enter the new SQL Server system administrator password:  --Enter strong password
 Confirm the new SQL Server system administrator password: --Enter strong password
starting Microsoft SQL Server... 
Enabling Microsoft SQL Server to run at boot...
Setup completed successfully.

6. Check mssql services  packages is installed 

  root #rpm -qa | grep mssql
        mssql-server-14.0.500.272-2.x86_64                                                                                                              


7. Check mssql services is running.


  root #rsystemctl 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 2017-05-01 11:59:13 IST; 3min 17s ago
 Docs:
 Main PID: 15429 (sqlservr)
 CGroup: /system.slice/mssql-server.service
 15429 /opt/mssql/bin/sqlservr
 15454 /opt/mssql/bin/sqlservr
May 01 11:59:20 DBAT sqlservr[15429]: 2017-05-01 11:59:20.87 spid19s ....
May 01 11:59:20 DBAT sqlservr[15429]: 2017-05-01 11:59:20.87 Server  ....
May 01 11:59:20 DBAT sqlservr[15429]: 2017-05-01 11:59:20.88 Server  ....
May 01 11:59:20 DBAT sqlservr[15429]: 2017-05-01 11:59:20.88 spid19s ....
May 01 11:59:21 DBAT sqlservr[15429]: 2017-05-01 11:59:21.53 spid9s  ....
May 01 11:59:22 DBAT sqlservr[15429]: 2017-05-01 11:59:22.09 spid9s  ....
May 01 11:59:22 DBAT sqlservr[15429]: 2017-05-01 11:59:22.13 spid21s ....
May 01 11:59:22 DBAT sqlservr[15429]: 2017-05-01 11:59:22.13 spid21s ....
May 01 11:59:22 DBAT sqlservr[15429]: 2017-05-01 11:59:22.24 spid21s ....
May 01 11:59:22 DBAT sqlservr[15429]: 2017-05-01 11:59:22.44 spid5s  ....
 
Hint: Some lines were ellipsized, use -l to show in full

8. Enable firewall rule  


sudo firewall-cmd --zone=public --add-port=1433/tcp  --permanent

sudo firewall-cmd --reload

 9.Install mssql agent 


sudo yum install mssql-server-agent
sudo systemctl restart mssql-server

10.remove old version


sudo yum update
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel

11. Install mssql tools with unixODBC developer packages. 

 
sudo yum update
sudo yum install mssql-tools unixODBC-devel

12. Check for lasted update version


sudo yum check-update
sudo yum update mssql-server-agent
sudo yum update mssql-tools
sudo systemctl restart mssql-server
 

13. Login in mssql using Sqlcmd


[root]# sqlcmd -S 172.16.2.54 -U sa
Password:
1> select @@version
2> go
Microsoft SQL Server vNext (CTP2.0) - 14.0.500.272 (X64)         Apr 13 2017 11:44:40         Copyright (C) 2017 Microsoft Corporation. All rights reserved.  Developer Edition (64-bit) on Linux (CentOS Linux 7 (Core))                                                                                            

 

14. check mssql process
# ps -ef | grep mssql
mssql    36817     1  0 Jul28 ?        00:00:00 /opt/mssql/bin/sqlservr
mssql    36851 36817  1 Jul28 ?        04:46:58 /opt/mssql/bin/sqlservr
root     55572 55513  0 19:54 pts/0    00:00:00 grep --color=auto mssql


Suggested Readings

sudo yum update mssql-server-agent
sudo yum update mssql-tools