Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
55 views

How To Install SQL Server On Ubuntu

1. The document discusses how to install SQL Server on Ubuntu Linux. It provides a 9-step process for installing SQL Server that involves importing keys, registering repositories, updating packages, and running installation and setup commands in the Terminal. 2. Optional tools like sqlcmd and bcp can also be installed to improve the experience. Their installation follows similar steps of importing keys, registering repositories, updating packages, and running installation commands. 3. Regular software updates are handled by running commands to update repository lists and install the latest mssql-server package, which replaces updated binaries without affecting user databases.

Uploaded by

Ronald
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

How To Install SQL Server On Ubuntu

1. The document discusses how to install SQL Server on Ubuntu Linux. It provides a 9-step process for installing SQL Server that involves importing keys, registering repositories, updating packages, and running installation and setup commands in the Terminal. 2. Optional tools like sqlcmd and bcp can also be installed to improve the experience. Their installation follows similar steps of importing keys, registering repositories, updating packages, and running installation commands. 3. Regular software updates are handled by running commands to update repository lists and install the latest mssql-server package, which replaces updated binaries without affecting user databases.

Uploaded by

Ronald
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1/2/2018 How to install SQL Server on Ubuntu

SQLShack Español 

How to install SQL Server on Ubuntu


May 18, 2017 by Stefan Veselinovic

Introduction

With an increasing number of new servers running on Linux, and even a third of Microsoft’s Azure
virtual machines running Linux, they have made a choice to bring SQL Server to Linux in order to
increase their market share and attract new customers.

Microsoft has started to make inroads outside of Windows environments with different products,
such as Office 365 apps for various mobile phone operating systems, such as iOS and Android as
well as their own Windows Phone OS. Microsoft has stated that they want to deliver a SQL Server
on Ubuntu, Red Hat and SUSE that feels, looks and performs just like the Windows version of the
SQL Server, where users should not be able to see the differences between those, at least from
the front-end perspective.

Things to consider

SQL Server on Linux is still very new, so inconsistent behaviour and partially supported features
can be apparent when using it. Microsoft stated that the preview version of SQL Server on Ubuntu,
Red Hat, SUSE and Docker engine will support the basic capabilities such as the core database
engine components that support transactional processing and data warehousing. At the moment,
as stated by Microsoft in their release notes for SQL Server on Linux, even in the latest
Community Tech Preview 2.0 (CTP 2.0), there are still a lot of features which aren’t supported, so
there is still work to be done in that field. Nevertheless, it is a huge step for Microsoft, and one that
many DBAs have looked forward to.

System requirements

Microsoft hasn’t stated the full system requirements to install SQL Server on Ubuntu, Red Hat,
SUSE and Docker engine, the only thing they noted is that it requires more than 3.25GB of RAM.
Listed below will be the basic minimum system hardware requirements to run Ubuntu, adjusted for
the RAM and HDD space requirements to run SQL Server on Ubuntu:

CPU: 700Mhz processor (Intel Celeron or better)


RAM: 4GB minimum (Ubuntu needs 512MB at minimum)
HDD: 5GB for Ubuntu and additional 3GB for SQL Server at minimum

I t ll ti d
https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 1/9
1/2/2018 How to install SQL Server on Ubuntu
Installation procedure

SQL Server on Linux currently supports a couple of distributions of Linux, those being Red Hat,
SUSE and Ubuntu, as well as Docker engine.

For this article, we are going to install SQL Server on Ubuntu, the latest version being 17.04 at the
time of writing this article.

1. First, open Terminal by clicking right mouse click on desktop and selecting Open Terminal.

Alternatively, you could go to start menu in the top left, opening it and clicking on Terminal
to open it.

2. After opening the Terminal, we are greeted with a window which looks like in the picture
below.

https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 2/9
1/2/2018 How to install SQL Server on Ubuntu

3. It is here where the installation takes place. First, we need to have the public repository’s
GPG keys imported by entering the following command:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-


key add –

4. The user needs to insert the account password before completing the step.

5. After that, we need to have the Microsoft SQL Server’s Ubuntu repository registered. In this
step as in previous, the user needs to enter the account password before completing the
step (but only if 15 minutes from the last action have passed, as this is Ubuntu’s feature to
only type the password only once in 15 minutes to make work flow easier).

curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-
server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

6 Now we can install SQL Server on Ubuntu by entering the following commands:
https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 3/9
1/2/2018 How to install SQL Server on Ubuntu
6. Now we can install SQL Server on Ubuntu by entering the following commands:

sudo apt-get update


sudo apt-get install -y mssql-server

With this, the package is installed. To completely install SQL Server on Ubuntu we need to
run the mssql-conf setup and follow the prompts. Also, a strong password is recommended
for the creation of SA account (Minimum length of 8 characters, including both uppercase
and lowercase letters and base 10 digits or/and non-alphanumeric symbols). To continue the
setup run the following command:

sudo /opt/mssql/bin/mssql-conf setup

7. After the install of SQL Server on Ubuntu has been completed, we can check if the service is
started and running by entering the following command:

systemctl status mssql-server

8. After some time, a software update may be released and that can be handled with a few
lines in the Terminal. First, it is needed to update the apt-get repository lists by running the
command below and entering the account password.

sudo apt-get update


sudo /opt/mssql/bin/mssql-conf setup

9. After updating the repository lists, all that is needed to update the SQL Server is to run the
above installation command which will update the mssql-server package:

sudo apt-get install mssql-server

Running these commands will try to download the latest package, afterwards replace the
updated binaries which are located under /opt/mssql. No user-generated databases or
system databases are affected with this operation.

Installation of SQL Server Tools


https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 4/9
1/2/2018 How to install SQL Server on Ubuntu
Installation of SQL Server Tools

Optionally, users can install SQL Server Tools on Ubuntu to improve their experience. Currently,
the package contains the Command line query utility (sqlcmd) and Bulk import export utility (bcp).

The installation is also done from the Terminal:

1. First, it is needed to import the public repository’s GPG keys. After running this command, it
is necessary to input the account password.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-


key add –

2. After that it is needed to register the Microsoft Ubuntu repository:

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list |
sudo tee /etc/apt/sources.list.d/msprod.list

3. Update the sources list and run the installation command with the unixODBC developer
package:

sudo apt-get update


sudo apt-get install mssql-tools unixodbc-dev

4. After running the second command, user will be prompted to allow the installation

5. After which the user will need to Accept the license terms

6. For the sqlcmd and bcp commands to be able to get accessed from bash shell, PATH
needs to be modified in the ~/.bash_profile using the command:

echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bash_profile

For non-login and interactive sessions, the PATH needs to be modified accordingly:
https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 5/9
1/2/2018 How to install SQL Server on Ubuntu

echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bashrc


source ~/.bashrc

7. After completing the installation, a test database is created to check the functionality of the
SQL Server on Ubuntu.

8. As the process completes, the latest SQL Server Management Studio installed on a
Windows machine is started. Since the Ubuntu machine is in the local network, the IP
address is 192.168.1.8. in this case. After connecting with SQL Server credentials (as
Windows authentication doesn’t work in this case), it can be seen that the database we just
created using sqlcmd tool in Linux Terminal is created and the server is reachable.

Installation of SQL Server Agent

In addition to SQL Server Tools, SQL Server Agent can also be installed as an addition after we
install SQL Server on Ubuntu to manage and run scheduled jobs.

1. Update the sources list and run the installation command, after which the Terminal will
prompt to restart the SQL Server for the Agent to be able to start.

sudo apt-get update


sudo apt-get install mssql-server-agent
sudo systemctl restart mssql-server

After that, connecting to the server in SSMS shows up that the SQL Server Agent is running.

Troubleshooting

Problem

Cannot connect to the SQL Server on Ubuntu from SSMS

Solutions

Verify if the server is running on the Ubuntu machine by running the command:

sudo systemctl status mssql-server

https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 6/9
1/2/2018 How to install SQL Server on Ubuntu

If the server is not running, it can be started by running the command:

sudo systemctl start mssql-server

After which, running the previous command again should look something like this:

Verify that the firewall has allowed the port 1433 which SQL Server is using by default. First
we need to check the status of the ufw, which is Ubuntu’s Uncomplicated Firewall, by
running the following command and entering the password for the account:

sudo ufw status

To allow a port through the ufw, run the following command:

sudo ufw allow 1433

Problem

Cannot connect to the server using SA account

Solution

To reset the system administrator (SA) password, run the following commands:

sudo systemctl stop mssql-server


sudo /opt/mssql/bin/mssql-conf setup

Take note that this will temporarily stop SQL Server mssql-server service.

See more

Consider these free tools for SQL Server that improve database developer productivity.

Useful links

Microsoft Blog: Announcing SQL Server on Linux


Wh t’ f SQL S 2017 Li
https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 7/9
1/2/2018 How to install SQL Server on Ubuntu
What’s new for SQL Server 2017 on Linux
Microsoft Docs: Use SSMS on Windows to manage SQL Server on Linux
Ubuntu Insights: Microsoft loves Linux
Ubuntu system requirements

Stefan Veselinovic
Support Sales Engineer at ApexSQL

Stefan has gotten into the world of electronics at an early age, always
surrounding himself with something to tinker. After that he got into IT world as
well. He got interested in database management, programming and graphic
design. He strives to improve himself everyday by learning and testing new
things.

Stefan is currently working at ApexSQL LLC as a Software sales engineer


where he specializes for database performance and backup.

Related Posts:
1. SQL Server vNext – Does Microsoft love Linux?
2. A Quick start Guide to Managing SQL Server 2017 on CentOS/RHEL Using the SSH
Protocol
3. Installation of SQL Server vNext CTP on Linux Distribution CentOS 7
4. How to install Microsoft SQL Server Express LocalDB
5. How to install, configure and use SQL Server Distributed Replay

SQL Server 2017, SQL Server on Linux

9,189 Views

https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 8/9
1/2/2018 How to install SQL Server on Ubuntu

0 Comments SQL Shack 


1 Login

Sort by Best
 Recommend 6 ⤤ Share

Start the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name

Be the first to comment.

ALSO ON SQL SHACK

R script word-cloud in SQL Server Report Monitoring SQL Server database status
Builder changes using T-SQL and PowerShell
2 comments • 2 months ago 2 comments • 4 months ago
Metalsimyaci — Thanks for sharing. Waiting Prashanth Jayaram — Hello, Thanks for the
for more... :D great comment. I agree with your view. This
is a great platform for SQL learners:-).Best

How to configure database mail in SQL How to configure SQL Server 2017 on
Server Linux with mssql-conf and other available
6 comments • 2 months ago 4 comments • 2 months ago
Prashanth Jayaram — Hi Bojan, Thanks for Prashanth Jayaram — Hi Karthik,Thanks for
the great write-up. Very informative and the comment. Its a great question.
detailed, touched every bit of the DB Mail Unfortunately we don't have an option to

✉ Subscribe d Add Disqus to your siteAdd DisqusAdd 🔒 Privacy

https://www.sqlshack.com/how-to-install-sql-server-on-ubuntu/ 9/9

You might also like