Microsoft SQL Server on Linux – installation (Ubuntu)
Ubuntu Installation
Prerequisites
Ubuntu 16.04 or later with 2GB RAM is required to run SQL Server on UbuntuSQL Server Installation Steps
- The first step is to import the public repository keys.
- Now we need to register the Microsoft SQL Server Repository
- Update Local Repository information
- Next, the below command will install SQL Server
- We now need to complete the install with some basic configuration. In order to do that run the below command and follow the prompts
- Select the edition of SQL Server you would like to install and agree to terms
- Select Language
- Enter a Secure SA Password
- Installation is complete
- Just to confirm we can check to make sure the SQL Server service is running
Command Line Tools Installation
Now that we have a successful installation of SQL server we need to install tools to enable us to connect to the instance. The following steps will install command line tools and show you how to create a test database.- First, we need to register another repository to be able to access the installation files
- As we have added a new Repository we now need to update our local repository information
- Now we can install the command line tools with the below command. You will need to agree to the terms for the 2 packages.
- That completes the installation of the Command Line Tools. For Convenience i like to complete one more step to add /opt/mssql-tools/bin/ to my $PATH Variable. This allows me to call the command line tools without specifying the full path
Connecting to SQL Server and Creating a Database
- Run the below command to connect to SQL Server. you will be prompted to enter your password
- If you are connecting remotely you can pass the server name or IP address to the -S parameter. (You will also need to ensure that port 1433 is open in the firewall)
- Now that we have a connection to SQL Server we can run regular TSQL Commands. Below are a few for you to try out
[code language="SQL"] USE danTestDB Create Table Motorcycles (ID INT, Name NVARCHAR(50)) Insert INTO Motorcycles VALUES (1,'Harley Davidson') Insert INTO Motorcycles VALUES (2,'Honda') [/code]
[code language="SQL"] USE danTestDB SELECT * FROM Motorcycles SELECT * FROM Motorcycles where ID > 1 [/code]
Summary
I hope this helps you all get started with SQL Server On Linux. Please feel free to leave comments or questions below. My next post will go in to more detail regarding the configuration options in Linux. Stay Tuned.Learn more about Pythian Services for Microsoft SQL Server including professional consulting, implementation and ongoing support.
On this page
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
A simple command that saved me
A simple command that saved me
May 1, 2019 12:00:00 AM
1
min read
How to install 18c Grid Infrastructure in Silent Mode on Linux 7
How to install 18c Grid Infrastructure in Silent Mode on Linux 7
Jul 8, 2019 12:00:00 AM
4
min read
Moving APEX Applications Repository with APEXExport
Moving APEX Applications Repository with APEXExport
Apr 14, 2021 12:00:00 AM
3
min read
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.