How and Why to Install Microsoft SQL Server 2022 Express on Ubuntu 22.04: Benefits and Best Practices
This guide provides detailed steps to install and configure Microsoft SQL Server 2022 Express Edition on a server running Ubuntu 22.04.
Installing Microsoft SQL Server 2022 Express on Ubuntu 22.04 brings a robust, affordable, and scalable database solution to developers and businesses on Linux. This easy-to-follow guide to install SQL Server 2022 Express on Ubuntu 22.04 enables you to take advantage of the new features of SQL Server in a secure and performance-tuned environment.
💡Why Use MS SQL Server 2022 Express on Ubuntu 22.04?
- ✅Cross-platform support – Native Linux support for SQL Server enables developers to develop and deploy applications on their OS of choice.
- ✅Affordable – Express edition is free, making it suitable for startups, testing, and light production workloads.
- ✅High performance – Enjoy enterprise-class performance and capabilities with low overhead on a lightweight Ubuntu server.
- ✅Secure and Reliable – With encryption, role-based access, and containerized deployments, SQL Server on Linux is extremely secure and production-ready.
How to Set Up SQL Server on Linux
This Ubuntu 22.04 SQL Server 2022 Express install and configure tutorial takes you from system preparation all the way through to remote access and setting up services. Whether you’re hosting a cloud VM or local server, our install MS SQL Server 2022 Express on Ubuntu 22.04 LTS tutorial guarantees a pain-free experience.
Learn the prerequisites for installing MS SQL Server 2022 Express on Ubuntu 22.04, execute the necessary terminal commands, and verify that your database is running securely. This step-by-step guide makes it easy for beginners and seasoned sysadmins alike.
🛡️Benefits of Running SQL Server on Ubuntu 22.04
- ✅Open-source ecosystem: Leverage Linux-native tools and services alongside your SQL Server.
- ✅Faster deployments: With package managers and scripts, setup takes just minutes.
- ✅Flexibility: No matter on bare metal, virtual machines, or containers, Linux offers you flexibility in how you deploy your stack.
- ✅Community support: Both Ubuntu and SQL Server enjoy huge communities and documentation to troubleshoot and follow best practices.
For those who are having trouble, we also have troubleshooting SQL Server 2022 Express installation on Ubuntu 22.04 and best practices for installing Microsoft SQL Server Express 2022 on Ubuntu 22.04 to help you fine-tune your deployment.
🧾 Prerequisites
- Ubuntu 22.04 LTS server
- Root or sudo access
- Internet connectivity
📥 Step 1: Update the System
Start by updating the package list and upgrading the system packages.
sudo apt update
sudo apt -y upgrade
🔐 Step 2: Import Microsoft GPG Key
Add the Microsoft package signing key to ensure the integrity of the packages.
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
📦 Step 3: Add Microsoft SQL Server Repository
Add the SQL Server 2022 package repository for Ubuntu 22.04.
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | sudo tee /etc/apt/sources.list.d/mssql-server-2022.list
Or
You can also add the repository manually as shown below:
1. Create File on below location
cat /etc/apt/sources.list.d/mssql-server-2019.list
2. Add below repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/ubuntu/22.04/mssql-server-2022 jammy main" | sudo tee /etc/apt/sources.list.d/mssql-server-2022.list
Update the package list again:
sudo rm -rf /var/lib/apt/lists/*
sudo apt update
🏗️ Step 4: Install SQL Server 2022
Install the Microsoft SQL Server package:
sudo apt install -y mssql-server
⚙️ Step 5: Run SQL Server Setup
Run the setup script to configure SQL Server. This step includes selecting the edition, accepting the license, and setting the SA
password.
sudo /opt/mssql/bin/mssql-conf setup
📝 Note: When prompted, choose:
- Edition:
Express
- Accept license:
Yes
- Set SA password: A strong password (e.g.,
Mssql2022@pass
)
✅ Step 6: Verify SQL Server is Running
Check the status of the SQL Server service:
sudo systemctl status mssql-server --no-pager
You should see an output indicating that the service is active (running).

🛠️ Step 7: Install SQL Server Command-Line Tools
Add the tools repository (Ubuntu 20.04 repo works for now) and install sqlcmd
and ODBC tools:
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo apt-get install -y mssql-tools unixodbc-dev
➕ Step 8: Add Tools to PATH
Add the tools to your shell’s PATH variable for easier access:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
🧪 Step 9: Connect to SQL Server
Use sqlcmd
to connect to the SQL Server instance:
sqlcmd -S localhost -U SA
You will be prompted to enter the SA
password you set earlier.
After successful login, you’ll see the 1>
prompt. Try running:
SELECT @@VERSION;
GO
📌 Conclusion
You now have Microsoft SQL Server 2022 Express Edition running on Ubuntu 22.04. You can start creating databases, and tables, and managing your SQL environment using sqlcmd
or GUI tools like Azure Data Studio.
🧯 Troubleshooting Tips
- If you get connection issues, ensure the port
1433
is open in your firewall. - To restart the SQL Server service:
sudo systemctl restart mssql-server
Other Versions!
- SQL Server Express
- SQL Server Web
- SQL Server Standard
- SQL Server Enterprise
- SQL Server 2022
- SQL Server 2019
- SQL Server 2017
Experience reliable and scalable SQL Server cloud hosting with CloudPE. Our affordable Microsoft SQL Server hosting plans are designed for businesses seeking high availability SQL Server hosting solutions backed by powerful infrastructure. With Kubernetes-powered Server hosting, enjoy seamless scalability and flexibility. Take advantage of our SQL Server hosting with a free trial offer to explore the platform. Whether you need dedicated SQL Server hosting with full root access or VPS SQL Server hosting with flexible resources, CloudPE ensures performance, security, and 24/7 technical support for your critical database workloads.