Install Microsoft SQL Server (MS SQL) on RHEL (CentOS) / Ubuntu – Evaluation version

Install Microsoft SQL Server on Linux
Install Microsoft SQL Server on Linux

Microsoft has released SQL Server for Redhat Enterprise Linux and Ubuntu; you can now start testing this latest preview of SQL Server in your environment.

This version is still in preview; it is meant for testing and development purpose only. Try it on your own.

Supported Operating Systems:

  • Redhat Enterprise Linux 7.2
  • Ubuntu 16.04

Setup Repository:

### Ubuntu 16.04 ###

$ sudo apt-get install -y wget
$ wget https://packages.microsoft.com/keys/microsoft.asc
$ sudo apt-key add microsoft.asc
$ curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql.list
$ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

### CentOS 7 ###

# yum -y install wget
# wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo
# wget https://packages.microsoft.com/config/rhel/7/prod.repo
# mv *.repo /etc/yum.repos.d/mssql.repo

Install MS SQL Server on Linux:

### Ubuntu 16.04 ###

$ sudo apt-get update
$ sudo apt-get install -y mssql-server

### CentOS 7 ###

# yum install -y mssql-server

Setup MS SQL server.

### Ubuntu 16.04 ###

$ sudo /opt/mssql/bin/sqlservr-setup

### CentOS 7 ###

# /opt/mssql/bin/sqlservr-setup

Output:

Microsoft(R) SQL Server(R) Setup

You can abort setup at anytime by pressing Ctrl-C. Start this program
with the --help option for information about running it in unattended
mode.

The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388 and found
in /usr/share/doc/mssql-server/LICENSE.TXT.

Do you accept the license terms? If so, please type "YES": YES

Please enter a password for the system administrator (SA) account: Enter Admin Password
Please confirm the password for the system administrator (SA) account: Re Enter Admin Password

Setting system administrator (SA) account password...

Do you wish to start the SQL Server service now? [y/n]: n

You can use sqlservr-setup --start-service to start SQL Server, and
sqlservr-setup --enable-service to enable SQL Server to start at boot.

Setup completed successfully.

Start the MS SQL Service.

### Ubuntu 16.04 ###

$ sudo systemctl start mssql-server
$ sudo systemctl enable mssql-server

### CentOS 7 ###

# systemctl start mssql-server
# systemctl enable mssql-server

Install SQL Server tools on Linux:

It provides command line tools (sqlcmd and bcp), ODBC drivers and their dependencies.

### Ubuntu 16.04 ###

$ sudo apt-get install -y mssql-tools

### CentOS 7 ###

# yum install -y mssql-tools

Steps:

Accept License terms

Firewall (CentOS / RHEL):

Configure the firewall to allow 1433 port so that we can access the SQL server from external machines.

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

Connect to MS SQL server:

Once the installation is complete, connect to MS SQL server using the following command.

sqlcmd -H 127.0.0.1 -U sa

Password: 
1>

That’s All.

Reference:

Official Documentation

POSTS YOU MAY LIKE -:)

Share This Post

  • Dinesh Vishe

    Error: Package: mssql-server-14.0.304.138-1.x86_64 (packages-microsoft-com-mssql -server)
    Requires: systemd
    Error: Package: msodbcsql-13.1.4.0-1.x86_64 (packages-microsoft-com-prod)
    Requires: libc.so.6(GLIBC_2.14)(64bit)
    Error: Package: mssql-server-14.0.304.138-1.x86_64 (packages-microsoft-com-mssql -server)
    Requires: systemd-units
    Error: Package: msodbcsql-13.1.4.0-1.x86_64 (packages-microsoft-com-prod)
    Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
    Error: Package: msodbcsql-13.1.4.0-1.x86_64 (packages-microsoft-com-prod)
    Requires: libstdc++.so.6(GLIBCXX_3.4.19)(64bit)
    Error: Package: msodbcsql-13.1.4.0-1.x86_64 (packages-microsoft-com-prod)
    Requires: unixODBC >= 2.3.1
    Available: unixODBC-2.2.14-14.el6.i686 (base)
    unixODBC = 2.2.14-14.el6
    Error: Package: mssql-server-14.0.304.138-1.x86_64 (packages-microsoft-com-mssql -server)
    Requires: numactl-libs
    Error: Package: mssql-server-14.0.304.138-1.x86_64 (packages-microsoft-com-mssql -server)
    Requires: openssl >= 1:1.0.1
    Installed: openssl-1.0.1e-48.el6_8.4.x86_64 (@updates)
    openssl = 1.0.1e-48.el6_8.4
    Available: openssl-1.0.1e-48.el6.i686 (base)
    openssl = 1.0.1e-48.el6
    Available: openssl-1.0.1e-48.el6_8.1.i686 (updates)
    openssl = 1.0.1e-48.el6_8.1
    Available: openssl-1.0.1e-48.el6_8.3.i686 (updates)
    openssl = 1.0.1e-48.el6_8.3
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

  • Dinesh Vishe

    sqlservr-setup is not find in BIn folder..

Shares