How To Install Microsoft SQL Server on Debian 13
Microsoft SQL Server has evolved beyond its traditional Windows boundaries, now offering robust database management capabilities for Linux environments, including Debian systems. Installing SQL Server on Debian 13 provides organizations with enterprise-grade database functionality while leveraging the stability and security of the Debian Linux distribution. This comprehensive guide walks through every step of the installation process, from initial system preparation to advanced configuration and troubleshooting.
The transition of SQL Server to Linux platforms represents a significant shift in Microsoft’s database strategy. System administrators can now deploy SQL Server databases on Debian infrastructure while maintaining compatibility with existing Windows-based applications and tools.
Prerequisites and System Requirements
System Requirements
Installing Microsoft SQL Server on Debian 13 requires specific hardware and software prerequisites to ensure optimal performance and stability. The minimum system requirements include 4 GB of RAM for SQL Server Express edition, though 8 GB or more is recommended for production environments. Processor requirements mandate x64-compatible CPU architecture with SSE2 instruction set support.
Storage space requirements vary by SQL Server edition. The database engine requires approximately 6 GB of available disk space for installation files and system databases. Additional space is necessary for user databases, transaction logs, and backup files. Network connectivity must allow outbound HTTPS connections for package repository access and license validation.
Operating system compatibility focuses on 64-bit Debian systems. Debian 13 provides the necessary kernel version and system libraries for SQL Server operation. Administrative access through sudo privileges is mandatory for installation and configuration tasks.
Pre-Installation Checklist
Before beginning the SQL Server installation process, verify network connectivity to Microsoft package repositories. Debian systems require updated package indexes and resolved dependencies. Execute system updates using apt update && apt upgrade
commands to ensure current package versions.
Firewall configuration must accommodate SQL Server’s default TCP port 1433 for database connections. Consider security implications when opening network ports, particularly in production environments. Basic Linux command-line familiarity helps navigate installation procedures and troubleshoot potential issues.
Review existing database software installations that might conflict with SQL Server components. PostgreSQL, MySQL, or other database systems can coexist with SQL Server but may require port configuration adjustments to prevent conflicts.
Repository Setup and Package Management
Adding Microsoft Repository
Microsoft maintains dedicated package repositories for Linux distributions, including Debian systems. Repository configuration requires downloading and installing Microsoft’s GPG signing keys to verify package authenticity. This process ensures downloaded packages originate from legitimate Microsoft sources.
Begin by downloading the Microsoft repository configuration package:
curl -sSL -O https://packages.microsoft.com/config/debian/13/packages-microsoft-prod.deb
Install the repository configuration package using dpkg:
sudo dpkg -i packages-microsoft-prod.deb
This command adds Microsoft’s repository information to the system’s package manager configuration. The installation process automatically configures GPG keys and repository URLs for subsequent package operations.
Updating Package Lists
Package list updates synchronize local package indexes with remote repository contents. Execute the apt update command to refresh package information:
sudo apt update
This operation downloads package metadata from all configured repositories, including the newly added Microsoft repository. Successful completion indicates proper repository configuration and network connectivity.
Address any repository-related errors before proceeding with SQL Server installation. Common issues include network connectivity problems, GPG key verification failures, or repository URL changes.
Package Dependencies
SQL Server installation relies on numerous system libraries and dependencies. Debian’s package manager automatically resolves most dependency requirements during installation. However, certain libraries may require manual installation or configuration.
Essential dependencies include system libraries for networking, security, and database operations. The installation process identifies and installs required packages automatically when using apt-based installation methods.
Microsoft SQL Server Installation Process
Downloading SQL Server Package
SQL Server installation begins with package download from Microsoft’s repository. Debian systems use the mssql-server
package containing the database engine and core components. Package selection varies based on intended SQL Server edition and licensing requirements.
The installation command initiates package download and dependency resolution:
sudo apt install -y mssql-server
This command downloads approximately 253 MB of package archives, including SQL Server binaries, configuration files, and installation scripts. Download time varies based on network speed and repository server load.
Installation Commands
Package installation proceeds automatically once download completes. The dpkg system handles package extraction, file placement, and initial configuration. Installation creates necessary directory structures, user accounts, and service definitions.
Monitor installation output for error messages or warnings. Successful installation produces confirmation messages and instructions for completing SQL Server setup. The installation process creates the mssql
system user for service operation and establishes directory permissions.
Common installation issues include insufficient disk space, permission errors, or conflicting packages. Address these problems before proceeding to configuration steps.
Post-Installation Verification
Verify installation success by checking installed package status:
dpkg -l | grep mssql-server
This command displays installed SQL Server package information, including version numbers and installation status. Successful installation shows package status as “ii” (installed and configured).
Examine installation directories to confirm proper file placement:
ls -la /opt/mssql/
The /opt/mssql/
directory contains SQL Server binaries, configuration files, and system databases. Proper installation creates subdirectories for bin, data, log, and secrets components.
SQL Server Configuration with mssql-conf
Running Initial Setup
SQL Server configuration begins with the mssql-conf
setup utility, which handles license acceptance, edition selection, and administrative password configuration. This interactive process determines SQL Server operational parameters and security settings.
Execute the configuration command with administrative privileges:
sudo /opt/mssql/bin/mssql-conf setup
The setup wizard presents several configuration options:
Edition Selection: Choose from Express, Developer, Standard, or Enterprise editions. Express edition provides free database functionality with limitations on database size and CPU utilization. Developer edition offers full features for development and testing environments.
License Agreement: Accept Microsoft Software License Terms by typing “Yes” when prompted. License acceptance is mandatory for SQL Server operation regardless of chosen edition.
SA Password Configuration: Establish a strong password for the system administrator (SA) account. Password requirements include minimum length, complexity rules, and character diversity. This account provides full database access and administrative privileges.
Advanced Configuration Options
Beyond basic setup, mssql-conf
provides extensive configuration capabilities for fine-tuning SQL Server behavior. Advanced options include network settings, memory allocation, and storage configuration.
TCP Port Configuration: Modify the default listening port (1433) using:
sudo /opt/mssql/bin/mssql-conf set network.tcpport 1433
Memory Limit Settings: Configure maximum memory allocation to prevent SQL Server from consuming excessive system resources:
sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 2048
Data Directory Configuration: Specify custom locations for data files and transaction logs:
sudo /opt/mssql/bin/mssql-conf set filelocation.defaultdatadir /var/opt/mssql/data
sudo /opt/mssql/bin/mssql-conf set filelocation.defaultlogdir /var/opt/mssql/log
Collation Settings: Configure character sorting and comparison rules:
sudo /opt/mssql/bin/mssql-conf set-collation
Network configuration options include enabling or disabling specific protocols, configuring SSL/TLS encryption, and setting connection timeout values. These settings affect client connectivity and security posture.
Installing SQL Server Command-Line Tools
ODBC Driver Installation
SQL Server command-line tools require Microsoft ODBC drivers for database connectivity. These drivers provide standardized database access methods for applications and utilities. ODBC driver installation precedes command-line tool setup.
Install the Microsoft ODBC driver package:
sudo ACCEPT_EULA=Y apt install -y msodbcsql18
The ACCEPT_EULA=Y
environment variable automatically accepts the end-user license agreement during installation. This driver supports modern authentication methods and encryption protocols for secure database connections.
Configure ODBC data sources if required for specific applications or connection scenarios. ODBC configuration files reside in /etc/odbcinst.ini
and /etc/odbc.ini
for system-wide and user-specific settings.
SQL Server Tools Setup
Microsoft SQL Server tools include sqlcmd
for interactive query execution and bcp
for bulk data operations. These command-line utilities provide essential database management capabilities without graphical interfaces.
Install SQL Server tools using the following command:
sudo ACCEPT_EULA=Y apt install -y mssql-tools18
Tool installation places executable files in /opt/mssql-tools/bin/
directory. Add this location to the system PATH for convenient access:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
Alternatively, add the PATH modification to /etc/environment
for system-wide availability:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> /etc/environment
Verify tool installation by checking version information:
sqlcmd -?
bcp -v
These commands display usage information and version details for installed tools, confirming successful installation and PATH configuration.
Service Management and Startup Configuration
Starting SQL Server Service
SQL Server operates as a systemd service on Debian systems, enabling standardized service management through systemctl commands. Service control includes starting, stopping, restarting, and monitoring SQL Server processes.
Start the SQL Server service:
sudo systemctl start mssql-server
Enable automatic startup at system boot:
sudo systemctl enable mssql-server
Service enablement ensures SQL Server starts automatically during system initialization, providing database availability without manual intervention.
Service Status Verification
Monitor SQL Server service status using systemctl commands:
sudo systemctl status mssql-server
This command displays current service state, process information, and recent log entries. Active services show “active (running)” status with process ID and startup time information.
Service logs provide detailed information about startup processes, configuration loading, and operational events:
sudo journalctl -u mssql-server -f
The -f
flag follows log output in real-time, useful for monitoring service behavior during startup or troubleshooting.
Process Monitoring
SQL Server processes appear in system process lists under the sqlservr
name. Monitor process status and resource utilization:
ps aux | grep sqlservr
Process information includes CPU utilization, memory consumption, and execution time. SQL Server typically runs as the mssql
system user with elevated privileges for database operations.
Resource monitoring helps identify performance issues, memory leaks, or excessive CPU consumption. Use tools like htop
, iotop
, or iftop
for comprehensive system monitoring during SQL Server operation.
Firewall and Network Configuration
Firewall Setup
Network security requires careful firewall configuration to allow legitimate database connections while blocking unauthorized access. SQL Server’s default TCP port 1433 must be accessible from client systems and applications.
Configure UFW (Uncomplicated Firewall) for Debian systems:
sudo ufw allow 1433/tcp
This rule permits inbound connections on port 1433 from any source address. Restrict access to specific IP addresses or network ranges for enhanced security:
sudo ufw allow from 192.168.1.0/24 to any port 1433
Verify firewall rules to ensure proper configuration:
sudo ufw status
Firewall status should show active rules including SQL Server port exceptions.
Remote Access Configuration
Remote database connections require both firewall configuration and SQL Server network settings. Default SQL Server installations may restrict remote connections for security purposes.
Configure SQL Server to accept remote connections:
sudo /opt/mssql/bin/mssql-conf set network.forceencryption 0
sudo systemctl restart mssql-server
Network interface binding determines which network adapters accept connections. Configure specific interface binding for security:
sudo /opt/mssql/bin/mssql-conf set network.ipaddress 192.168.1.100
Security considerations for remote access include encryption requirements, authentication methods, and connection logging. Implement SSL/TLS encryption for production environments handling sensitive data.
Testing and Verification
Local Connection Testing
Verify SQL Server installation by establishing local database connections using sqlcmd. Local connections validate service operation, authentication configuration, and basic database functionality.
Connect to SQL Server using the SA account:
sqlcmd -S localhost -U sa -P 'YourPassword'
Replace ‘YourPassword’ with the actual SA password configured during setup. Successful connection displays the sqlcmd prompt (1>), indicating ready database access.
Execute basic queries to verify database functionality:
SELECT @@VERSION;
GO
This query returns SQL Server version information, confirming successful installation and operation. Additional test queries can verify database creation, table operations, and data manipulation capabilities.
Remote Connection Testing
Remote connection testing validates network configuration and firewall settings. Use sqlcmd from remote systems or configure connection strings for application testing.
Test remote connections from client systems:
sqlcmd -S debian-server-ip -U sa -P 'YourPassword'
Replace debian-server-ip
with the actual server IP address or hostname. Successful remote connections confirm proper network configuration and service accessibility.
Connection string examples for application integration:
Server=debian-server-ip;Database=master;User Id=sa;Password=YourPassword;
Test connection strings using database management tools, development frameworks, or custom applications to ensure compatibility and functionality.
Common Troubleshooting Issues
Installation Problems
SQL Server installation failures typically result from dependency conflicts, insufficient permissions, or system resource limitations. Repository configuration errors prevent package downloads and updates.
Dependency Resolution Issues: Use apt’s fix-broken installation feature:
sudo apt --fix-broken install
This command resolves incomplete installations and missing dependencies. Manual dependency inspection helps identify specific missing packages:
apt show mssql-server
Permission-Related Errors: Ensure sudo access and proper file permissions. Installation requires write access to system directories and service configuration files.
Repository problems manifest as package not found errors or GPG verification failures. Verify repository configuration and network connectivity to Microsoft servers.
Service Startup Issues
SQL Server service failures prevent database access and application connectivity. Common startup problems include configuration errors, missing libraries, and resource constraints.
SQL Server Agent Problems: Monitor agent service status separately from main database engine:
sudo systemctl status mssql-server-agent
Agent startup issues often relate to authentication configuration or resource limitations.
Log File Analysis: Examine SQL Server error logs for detailed failure information:
sudo tail -f /var/opt/mssql/log/errorlog
Error logs contain startup sequences, configuration loading, and failure diagnostics. Common errors include library dependencies, permission problems, and configuration conflicts.
Configuration File Conflicts: Verify mssql.conf syntax and parameter values:
sudo cat /var/opt/mssql/mssql.conf
Invalid configuration parameters prevent service startup. Reset configuration to defaults if necessary and reconfigure using mssql-conf utility.
Hostname Resolution Issues: SQL Server requires proper hostname resolution for network operations. Configure /etc/hosts
with accurate hostname mappings:
echo "127.0.0.1 $(hostname)" >> /etc/hosts
Security Best Practices
Initial Security Configuration
Database security begins with strong authentication policies and access controls. Default SQL Server installations require immediate security hardening to prevent unauthorized access and data breaches.
Strong SA Password Policies: Implement complex passwords exceeding minimum requirements. Use password generators for truly random credentials including uppercase, lowercase, numbers, and special characters.
User Account Management: Create dedicated database users with minimal required privileges rather than using the SA account for routine operations. Principle of least privilege reduces security exposure and limits potential damage from compromised accounts.
Disable unnecessary services and features to reduce attack surface. SQL Server Express installations include fewer components than full editions, inherently improving security posture.
Network Security
Network-level security controls complement database authentication mechanisms. Implement multiple security layers for comprehensive protection.
Firewall Rule Optimization: Restrict database access to specific source networks rather than allowing global connectivity. Use iptables or UFW rules targeting legitimate client IP ranges.
Connection Encryption Setup: Enable SSL/TLS encryption for database connections handling sensitive information. Configure certificate-based encryption for production environments.
Access control recommendations include VPN requirements for remote database administration, network segmentation for database servers, and monitoring unusual connection patterns for intrusion detection.
Performance Optimization Tips
Memory Configuration
SQL Server memory management significantly impacts database performance and system stability. Default memory settings may not optimize performance for specific workloads or hardware configurations.
Memory Limit Optimization: Configure maximum memory allocation based on available system RAM and concurrent application requirements:
sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 6144
Reserve sufficient system memory for operating system operations and other applications. SQL Server should not consume all available RAM.
Buffer Pool Settings: Monitor buffer pool hit ratios and adjust memory allocation accordingly. Higher buffer pool hit ratios indicate better memory utilization and query performance.
Storage Configuration
Database performance depends heavily on storage subsystem capabilities and configuration choices. Proper storage planning prevents I/O bottlenecks and ensures reliable data persistence.
Data File Placement Strategies: Separate data files and transaction logs onto different storage devices when possible. This separation improves write performance and provides better failure isolation.
Log File Optimization: Configure transaction log files for sequential write operations. Use dedicated storage devices with consistent write performance characteristics for transaction logs.
Consider storage features like SSD acceleration, RAID configurations, and backup storage planning when designing SQL Server storage architectures.
Congratulations! You have successfully installed Microsoft SQL. Thanks for using this tutorial to install the latest version of Microsoft SQL Server on Debian 13 “Trixie”. For additional help or useful information, we recommend you check the official Microsoft SQL website.