Microsoft SQL Server, a prominent database management system, is known for its robustness and wide usage in various domains including transaction processing, business intelligence and analytics applications. With the release of SQL Server for Linux, the tool’s performance and security features can now be leveraged on preferred Linux distributions, including openSUSE.

Installation Process

Step 1: System Update

Always start by updating your system to ensure all existing packages are up-to-date. This step is crucial as it equips your system with the latest security patches and dependencies required for a smooth installation.

sudo zypper refresh
sudo zypper update

Step 2: Installing Microsoft SQL Server

Next, add the Microsoft SQL Server 2019 repository to your system’s package manager. This repository houses the SQL Server packages and dependencies required for installation.

sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/15/mssql-server-2019.repo
sudo zypper --gpg-auto-import-keys refresh

To ensure the package authenticity, import the Microsoft package signing key:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

With the repository setup, you can now install SQL Server:

sudo zypper install mssql-server

Step 3: Configuration

Post installation, run the SQL Server setup utility to configure your new SQL Server installation. This involves setting the SA (system administrator) password and choosing the SQL Server edition to install (Developer, Express, or Evaluation are free):

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

Step 4: Installing SQL Server Command-Line Tools

For better management of SQL Server, install the command-line tools sqlcmd and bcp. These tools are crucial for interacting with SQL Server from the command line.

sudo zypper install mssql-tools unixODBC-devel

To make these tools easily accessible, add them to your PATH:

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

Confirm that SQL Server is running properly:

sudo systemctl status mssql-server

And then connect to your SQL Server instance using sqlcmd:

sqlcmd -S localhost -USA -P ''

Step 5: Creating a New Database

After installing and configuring SQL Server, you can create a new database using the sqlcmd utility:

sqlcmd -S localhost -U SA -P ''

At the sqlcmd prompt, create a new database named TestDB:

CREATE DATABASE TestDB;
GO

To verify the database creation, list all databases on your server:

SELECT Name FROM sys.databases;
GO

Exit sqlcmd:

QUIT

If you find these steps overwhelming or lack the time, consider using a service like Shape.host. They offer Linux SSD VPS, and can handle the process for you. Visit Shape.host to get the best deal!