咨询在Debian系统上安装SQL Server的可行性
Absolutely possible! Since Ubuntu is built on Debian, their underlying package ecosystems are similar enough that you can often adapt Microsoft's Ubuntu SQL Server packages to run on Debian. That said, this is an unsupported configuration—Microsoft won’t offer official troubleshooting help if you run into issues—but many community members have pulled it off successfully. Here’s how to go about it:
核心思路
Match your Debian release to a compatible Ubuntu LTS version (Microsoft only provides packages for LTS releases) and use that Ubuntu’s SQL Server repository. Here’s the standard mapping:
- Debian 12 (Bookworm) → Ubuntu 22.04 (Jammy Jellyfish)
- Debian 11 (Bullseye) → Ubuntu 20.04 (Focal Fossa)
实操步骤
1. 添加Microsoft的GPG密钥
First, you need to trust Microsoft’s package signing key. On newer Debian versions (11+), skip the deprecated apt-key command and use this instead:
install -m 0755 -d /etc/apt/keyrings curl -fsSL https://packages.microsoft.com/keys/microsoft.asc -o /etc/apt/keyrings/microsoft-prod.key chmod a+r /etc/apt/keyrings/microsoft-prod.key
2. 添加对应Ubuntu版本的SQL Server源
Create a repository file pointing to the matching Ubuntu LTS repo. For Debian 12 (Jammy):
echo "deb [arch=amd64,arm64 signed-by=/etc/apt/keyrings/microsoft-prod.key] https://packages.microsoft.com/ubuntu/22.04/mssql-server jammy main" > /etc/apt/sources.list.d/mssql-server.list
For Debian 11 (Focal):
echo "deb [arch=amd64,arm64 signed-by=/etc/apt/keyrings/microsoft-prod.key] https://packages.microsoft.com/ubuntu/20.04/mssql-server focal main" > /etc/apt/sources.list.d/mssql-server.list
3. 安装依赖与SQL Server
Update your package list and install SQL Server. You may need to fix missing dependencies first—for example, Debian 11 requires libssl1.1 (included by default in Ubuntu 20.04):
apt update # For Debian 11 only: install libssl1.1 if it's missing apt install -y libssl1.1 # Install SQL Server apt install -y mssql-server
4. 配置SQL Server
Run the setup script to set your SA password and choose an edition (Developer edition is free for non-production use):
/opt/mssql/bin/mssql-conf setup
重要注意事项
- No official support: If you hit bugs or compatibility snags, Microsoft won’t assist. You’ll have to rely on community forums or self-troubleshooting.
- Dependency mismatches: Some packages have different names or versions in Debian vs Ubuntu. For example, newer Debian releases might have a newer
libsslversion that SQL Server doesn’t expect—you may need to install an older version manually. - Update risks: Future SQL Server updates could break compatibility if the Ubuntu repo introduces changes that don’t play well with your Debian version.
Many users have reported successful installs on Debian 11 and 12 with SQL Server 2019 and 2022, so it’s definitely worth trying if you don’t mind the unsupported status.
内容的提问来源于stack exchange,提问作者i486

