Linux, Windows, Virtualization, OpenSource & Blogging

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

6
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 at your own risk.

System Requirements:

Make sure your system meets below hardware requirements.

Memory Atleast 3.25 GB
File System XFS or EXT4
Disk space Minimum 1 GB
Processor type x64-compatible only

Supported Operating Systems:

  • Redhat Enterprise Linux 7.3/7.2
  • Ubuntu 16.04

Setup Repository:

### Ubuntu 16.04 ###

$ sudo apt-get install -y wget curl
$ 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/

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/mssql-conf setup

### CentOS 7 ###

# /opt/mssql/bin/mssql-conf setup

Output:

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? [Yes/No]:Yes
Enter the SQL Server system administrator password: Enter Admin Password
Confirm the SQL Server system administrator password: Re Enter Admin Password
Configuring SQL Server...

This is an evaluation version.  There are [119] days left in the evaluation period.
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

Start the MS SQL Service (Optional).

### 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:

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

FirewallD:

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

UFW:

$ sudo ufw allow 8080/tcp
$ sudo ufw reload

Connect to MS SQL server:

sqlcmd command now be found /opt/mssql-tools/bin directory. To make tools command available to shell path, run the following command.

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
source ~/.bash_profile

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

You might also like
  • 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

    • Hi Dinesh,

      it is clearly said, MSSQL works only on RHEL 7.2 and above..

  • Dinesh Vishe

    sqlservr-setup is not find in BIn folder..

    • GamessRap

      This is because in later version. Setup file name is changed to mssql-conf.

  • Esterlin Polanco

    What do I do when the trial period ends ?

    • Raj

      After 119 days from the date of installation

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

6