Microsoft SQL Server on Linux removes the barrier for organizations that prefer the Linux operating system over Microsoft Windows. It’s the same SQL Server database engine with many similar features; the only difference is the operating system. Currently, Microsoft supports the Linux version of SQL Server on Red Hat Enterprise Linux, SUSE Linux Enterprise Server, and Ubuntu. You can also run SQL Server in a Docker container. You must be able to install, update, and remove SQL Server from the command line.
This post describes how to deploy a SQL Server database running on an Ubuntu Linux server on a single Oracle Cloud Infrastructure Compute VM. It also describes how you can use Oracle Cloud Infrastructure Block Volumes storage to store the SQL Server database files and transaction log files.
Before you install SQL Server on Linux, consider the following prerequisites:
You can choose the Linux image (Ubuntu) from the Oracle Cloud Infrastructure repository, or you can bring your own Linux image to deploy on the VM. We strongly recommend that you check the Linux server version support on Oracle Cloud Infrastructure before you start deploying. For this post, we chose Ubuntu 16.04 with Debian packages from the Oracle Cloud Infrastructure image repository, and the VM.Standard2.4 shape.
Before installing SQL Server, you must create an Oracle Cloud Infrastructure virtual cloud network (VCN) and choose the appropriate availability domain, subnet, and other components for your Linux server. In addition to the existing ingress stateful security rules in your VCN, you might need to add ingress security rules to allow remote SSH (secure shell) access to the Linux server. Ensure that the internet gateway route rules are enabled for internet access, which allows you to access the Linux host over the public network. The following images show the security rule added and route rules enabled to allow SSH access to the Linux host over the public network.
Security list rule:
Route table rule:
For more information about working with security rules and route rules, see the Networking service documentation.
When you provision the Linux (Ubuntu) server, you provide the SSH public key. After the server is provisioned, the following page is displayed in the Console, showing the public IP address to use to access the Linux host.
Use SSH to connect to Linux host, using the username ubuntu and the private key of the SSH key pair.
We installed the operating system, OS command-line tools, SQL Server binary, and all the required SQL Server tools on the local boot volume. However, we stored the SQL Server database on a block storage volume. The following image illustrates creating a block storage volume on Oracle Cloud Infrastructure and choosing the appropriate backup option (Bronze) for the volume.
Run the following command on the Ubuntu Linux server as the root user to add the iSCSI target to this block storage volume at the operating-system level.
After you run the preceding commands, you might need to partition the newly added iSCSI storage and create the file system (xfs and ext3 are both supported by SQL Server). The following image shows the mount point of the block storage volume after creating partition, creating appropriate filesystem and mounting the partition.
Follow these steps to install SQL Server on an Ubuntu Linux operating system. Run the following commands in a bash shell of the Ubuntu Linux terminal to install the mssql-server package.
sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
sudo apt-get update
sudo apt-get install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup
systemctl status mssql-server
To create the database, first access the database and connect with a tool that can run Transact-SQL statements on the SQL Server. You might need to install SQL Server Operations Studio, which is a cross-platform GUI database management utility, to manage your MS-SQL Server database.
This post demonstrated how to deploy Microsoft SQL Server on Ubuntu Linux using Oracle Cloud Infrastructure, and discussed how to use Oracle Cloud Infrastructure Block Volumes to store MS-SQL Server database to achieve higher performance and better manageability.