...
How to install microsoft sql server on ubuntu vps
Learn how to install microsoft sql server on ubuntu vps.

This article provides a guide for how to install Microsoft SQL Server on Ubuntu VPS.

What is Microsoft SQL Server?

Microsoft SQL Server is a relational database management system (RDBMS) developed by Microsoft. It is used to store, retrieve, manage, and analyze data in a structured way using SQL (Structured Query Language).

🔑 Key Features:

  • SQL Engine: Handles querying and data manipulation using T-SQL (Transact-SQL).
  • SSMS (SQL Server Management Studio): A GUI tool to manage databases.
  • Security: Supports encryption, role-based access, and auditing.
  • High Availability: Offers features like Always On Availability Groups, failover clustering, and replication.
  • Integration Services: ETL (Extract, Transform, Load) operations via SQL Server Integration Services (SSIS).
  • Reporting Services (SSRS): Tools to create and deliver reports.
  • Machine Learning Services: Allows R and Python integration for advanced analytics.
  • Support for JSON, XML, Spatial Data, and Graph Databases.

🖥️ Common Use Cases:

  • Enterprise Applications (e.g., ERP, CRM)
  • Business Intelligence and Reporting
  • Data Warehousing
  • E-commerce Platforms
  • Web Applications

📦 Editions Available:

Edition Description
Express Free entry-level version for small-scale applications.
Developer Free full-featured version for development and testing.
Standard Core database functionality for mid-tier applications.
Enterprise Full feature set including advanced analytics, scalability, and HA.
Web Affordable version for web hosting providers.

🧩 Platforms Supported:

  • Windows Server (primary OS)
  • Linux (available since SQL Server 2017)
  • Docker containers

Here’s a detailed step-by-step guide on How to Install Microsoft SQL Server on an Ubuntu VPS. This guide is applicable to Ubuntu 20.04, 22.04, and newer LTS versions.

🧰 Prerequisites

Launch 100% ssd ubuntu vps from $3. 19/mo!
Launch 100% ssd ubuntu vps from $3. 19/mo!

Compare Ubuntu VPS Plans

KVM-SSD-1
KVM-SSD-8
KVM-SSD-16
KVM-SSD-32
CPU
1 Core
2 Cores
4 Cores
8 Cores
Memory
1 GB
8 GB
16 GB
32 GB
Storage
16 GB NVMe
128 GB NVMe
256 GB NVMe
512 GB NVMe
Bandwidth
1 TB
4 TB
8 TB
16 TB
Network
1 Gbps
1 Gbps
1 Gbps
1 Gbps
Delivery Time
⏱️ Instant
⏱️ Instant
⏱️ Instant
⏱️ Instant
Location
US/FR
US/FR
US/FR
US/FR
Price
$7.58*
$39.50*
$79.40*
$151.22*
KVM-SSD-1
CPU: 1 Core
Memory: 2 GB
Storage: 16 GB NVMe
1 TB
KVM-SSD-8
CPU: 2 Cores
Memory: 8 GB
Storage: 128 GB NVMe
4 TB
KVM-SSD-16
CPU: 4 Cores
Memory: 16 GB
Storage: 256 GB NVMe
8 TB
KVM-SSD-32
CPU: 8 Cores
Memory: 32 GB
Storage: 512 GB NVMe
16 TB

How to Install Microsoft SQL Server on Ubuntu VPS

To install Microsoft SQL Server on Ubuntu VPS, follow the steps below:

  1. 📦 Import Microsoft GPG Key and Add SQL Server Repository

    1. Open an SSH terminal and log in to your Ubuntu VPS.
    2. Import the Microsoft GPG key:
      wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
      
    3. Add the Microsoft SQL Server repository:
      sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/mssql-server-2022.list)"
      
    4. Update package lists:
      sudo apt update
      
  2. 🛠 Install Microsoft SQL Server

    1. Install SQL Server:
      sudo apt install -y mssql-server
      
    2. Run the configuration script:
      sudo /opt/mssql/bin/mssql-conf setup
      
    3. During setup, you will:
      • Choose the edition (e.g., Developer, Express)
      • Accept the license terms
      • Set a strong SA (System Administrator) password
    4. Enable and start SQL Server:
      sudo systemctl enable --now mssql-server
      
  3. ✅ Verify SQL Server Installation

    Check if SQL Server is running:

    systemctl status mssql-server
    

    You should see active (running) in green.

  4. 🔧 Install Microsoft SQL Server Command-Line Tools (Optional but Recommended)

    1. Import the Microsoft GPG key and repository for tools:
      curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
      sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list)"
      sudo apt update
      
    2. Install SQL tools:
      sudo apt install -y mssql-tools unixodbc-dev
      
    3. Add tools to your path:
      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
      source ~/.bashrc
      
  5. 🧪 Connect to SQL Server

    Use sqlcmd to connect:

    sqlcmd -S localhost -U SA -P 'YourPasswordHere'
    

    If successful, you’ll get a 1> prompt. Try a simple query:

    SELECT @@VERSION;
    GO
    
  6. 🔐 Configure Firewall (If UFW is Enabled)

    If your server uses UFW (Uncomplicated Firewall), open port 1433:

    sudo ufw allow 1433/tcp
    
  7. 📤 Enable Remote Access (Optional)

    To allow external clients to connect:

    1. Edit the Microsoft SQL Server config:
      sudo nano /opt/mssql/mssql.conf
      
    2. Add (or edit) under [network]:
      [tcp]
      tcpport=1433
      
    3. Restart the service:
      sudo systemctl restart mssql-server
      

      Make sure your VPS provider allows traffic on port 1433.

  8. 🧼 Troubleshooting Tips

    Issue Solution
    Cannot connect with sqlcmd Ensure SQL tools are installed and SQL Server is running
    Login failed for user ‘SA’ Double-check password and ensure SA is enabled
    Port 1433 not accessible Check UFW, provider firewall, and SQL Server config

📚 Bonus: Create a Sample Database

Once connected:

CREATE DATABASE TestDB;
GO
USE TestDB;
GO
CREATE TABLE Inventory (id INT, name NVARCHAR(50));
GO
INSERT INTO Inventory VALUES (1, 'Screwdriver'), (2, 'Hammer');
GO
SELECT * FROM Inventory;
GO

After we install Microsoft SQL server on Ubuntu VPS, let’s install Adminer on Ubuntu VPS so we can manage Microsoft SQL Server from a web-based GUI.

🌐 What is Adminer?

Adminer is a lightweight, single-file PHP web app that lets you manage databases from a browser—like a simpler, more secure alternative to phpMyAdmin.

✅ Works with: SQL Server, MySQL, PostgreSQL, SQLite, Oracle, and others
✅ No database client needed
✅ Simple installation (just one PHP file)

📦 Prerequisites

  • Ubuntu VPS with Microsoft SQL Server installed
  • Apache or Nginx web server
  • PHP installed (7.4+ recommended)

⚙️ Step-by-Step: Install Adminer for Microsoft SQL Server

To install Adminer for Microsoft SQL Server on Ubuntu VPS, follow the steps below:

  1. Install Web Server + PHP

    For Apache:

    sudo apt update
    sudo apt install -y apache2 php php-sybase
    

    php-sybase enables PHP to connect to Microsoft SQL Server via FreeTDS.

  2. Download Adminer

    sudo mkdir -p /var/www/html/adminer
    cd /var/www/html/adminer
    sudo wget -O index.php https://github.com/vrana/adminer/releases/latest/download/adminer.php
    
  3. Secure Permissions

    sudo chown -R www-data:www-data /var/www/html/adminer
    sudo chmod -R 755 /var/www/html/adminer
    
  4. Enable the Adminer Site (Apache only)

    If you’re using Apache:

    sudo systemctl restart apache2
    

    You can now access Adminer at:

    http://your-server-ip/adminer
    
  5. Login to Microsoft SQL Server via Adminer

    Use the following settings:

    • System: Microsoft SQL Server
    • Server: localhost (or your IP)
    • Username: SA (or your configured SQL user)
    • Password: (your password)
    • Database: (optional: specify or leave blank to list all)

    If connecting remotely, use the public IP or hostname and ensure port 1433 is open.

  6. Secure Adminer (Highly Recommended)

    • Option 1: Restrict IP Access via .htaccess (Apache)

      sudo nano /var/www/html/adminer/.htaccess
      
      Order Deny,Allow
      Deny from all
      Allow from YOUR_IP_ADDRESS
      
    • Option 2: Password-protect with Basic Auth

      sudo apt install apache2-utils
      sudo htpasswd -c /etc/apache2/.htpasswd youradminuser
      

      Edit your site config or .htaccess to include:

      AuthType Basic
      AuthName "Restricted Access"
      AuthUserFile /etc/apache2/.htpasswd
      Require valid-user
      

      Then reload:

      sudo systemctl reload apache2
      

✅ Adminer is Ready!

You can now:

  • Run SQL queries
  • Browse tables
  • Create/modify users and databases
  • Export/import data

All from your web browser.

🛠 Optional: Use Adminer Theme (for better UI)

wget -O adminer.css https://raw.githubusercontent.com/vrana/adminer/master/designs/pepa-linha/adminer.css

Adminer will auto-load adminer.css if placed in the same directory.

Launch 100% ssd ubuntu vps from $3. 19/mo!
Launch 100% ssd ubuntu vps from $3. 19/mo!

Compare Ubuntu VPS Plans

KVM-SSD-1
KVM-SSD-8
KVM-SSD-16
KVM-SSD-32
CPU
1 Core
2 Cores
4 Cores
8 Cores
Memory
1 GB
8 GB
16 GB
32 GB
Storage
16 GB NVMe
128 GB NVMe
256 GB NVMe
512 GB NVMe
Bandwidth
1 TB
4 TB
8 TB
16 TB
Network
1 Gbps
1 Gbps
1 Gbps
1 Gbps
Delivery Time
⏱️ Instant
⏱️ Instant
⏱️ Instant
⏱️ Instant
Location
US/FR
US/FR
US/FR
US/FR
Price
$7.58*
$39.50*
$79.40*
$151.22*
KVM-SSD-1
CPU: 1 Core
Memory: 2 GB
Storage: 16 GB NVMe
1 TB
KVM-SSD-8
CPU: 2 Cores
Memory: 8 GB
Storage: 128 GB NVMe
4 TB
KVM-SSD-16
CPU: 4 Cores
Memory: 16 GB
Storage: 256 GB NVMe
8 TB
KVM-SSD-32
CPU: 8 Cores
Memory: 32 GB
Storage: 512 GB NVMe
16 TB

Conclusion

You now know how to install Microsoft SQL Server on Ubuntu VPS! This setup enables you to use SQL Server for development, testing, or production purposes with full command-line access.

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.

2 thoughts on “How to Install Microsoft SQL Server on Ubuntu VPS (10 Minute Quick-Start Guide)

  1. […] How to Install Microsoft SQL Server on Ubuntu VPS (10 Minute Quick-Start Guide) […]

Comments are closed.

lg