FedoraRHEL Based

How To Install Microsoft SQL Server on Fedora 43

Install Microsoft SQL Server on Fedora 43

Microsoft SQL Server has evolved significantly since its introduction on Linux systems in 2017, bringing enterprise-grade database capabilities to the open-source world. Installing SQL Server on Fedora 43 provides developers and database administrators with a powerful relational database management system that integrates seamlessly with Microsoft’s ecosystem while leveraging the stability and flexibility of Linux. This comprehensive guide walks you through every step of the installation process, from system preparation to post-installation configuration, ensuring a successful deployment on your Fedora 43 system.

Table of Contents

Understanding Microsoft SQL Server on Linux

Microsoft’s decision to bring SQL Server to Linux platforms represents a fundamental shift in database technology accessibility. The Linux version includes most features available in the Windows edition, supporting T-SQL queries, stored procedures, and advanced database operations. SQL Server on Fedora runs natively, not through emulation, delivering excellent performance for both development and production workloads.

Available SQL Server Editions

SQL Server offers several editions tailored to different needs and budgets. The Evaluation Edition provides full functionality for 180 days, making it perfect for testing enterprise features. Developer Edition, completely free and feature-complete, serves development and testing environments exceptionally well. Express Edition offers a lightweight, free option with some resource limitations suitable for small applications. Standard and Enterprise Editions, which require commercial licensing, deliver production-ready performance with comprehensive support.

Recommended Version for Fedora 43

SQL Server 2022 represents the latest major release, offering enhanced security, performance improvements, and modern features optimized for Linux environments. This version demonstrates excellent compatibility with Fedora 43’s updated kernel and system libraries. SQL Server 2019 remains a solid alternative for organizations requiring long-term stability, while SQL Server 2017 continues receiving security updates for legacy systems.

System Requirements and Prerequisites

Hardware Specifications

Your Fedora 43 system must meet specific hardware requirements for SQL Server to function properly. The processor must be x64-compatible with at least 2 physical cores running at 2 GHz or faster. Memory requirements start at 2 GB RAM minimum, though 4 GB or more significantly improves performance, especially for production databases handling concurrent connections. Storage needs include a minimum of 6 GB for SQL Server installation files, with additional space required for your databases, transaction logs, and backup files.

File System Considerations

SQL Server on Linux performs optimally with specific file systems. XFS is the recommended file system, offering excellent performance characteristics for database workloads with large files and high I/O operations. EXT4 provides solid performance as an alternative and enjoys widespread adoption across Linux distributions. Notably, Btrfs is not supported and should be avoided for SQL Server installations due to compatibility issues. If using NFS for shared storage, ensure you’re running NFS version 4.2 or higher to avoid data corruption risks.

Software Prerequisites

Before beginning installation, verify your Fedora 43 system is fully updated with the latest security patches and package updates. You need root or sudo privileges to install system packages and configure services. An active internet connection is essential for downloading SQL Server packages and their dependencies from Microsoft’s repositories. Understanding basic firewall and SELinux concepts helps troubleshoot potential access issues after installation.

Preparing Your Fedora 43 System

Updating System Packages

Begin by opening a terminal window and updating your system’s package repositories. Run the command to refresh package lists and upgrade installed software:

sudo dnf update -y

This ensures compatibility with SQL Server and prevents conflicts with outdated libraries. If kernel updates are installed, reboot your system before proceeding. You can verify pending updates with the check-update command to confirm your system is current.

Configuring Firewall Rules

SQL Server listens on TCP port 1433 by default for client connections. Fedora 43 uses firewalld for network security, requiring explicit port opening. Execute the following commands to allow SQL Server traffic:

sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

The permanent flag ensures the rule persists across system reboots. The reload command activates the new configuration immediately without disrupting existing connections. You can verify the rule with firewall-cmd list-ports to confirm port 1433 appears in the active configuration.

SELinux Configuration

SELinux provides mandatory access controls on Fedora systems. While SQL Server can operate with SELinux enforcing, some organizations choose permissive mode during initial installation to simplify troubleshooting. Check your current SELinux status with the getenforce command. For production environments, maintaining SELinux in enforcing mode with properly configured policies provides superior security.

Adding Microsoft SQL Server Repositories

Understanding Repository Configuration

Microsoft distributes SQL Server through dedicated package repositories rather than Fedora’s default repositories. These repositories contain the mssql-server package and associated tools specifically compiled for Red Hat Enterprise Linux (RHEL) compatible systems. Fedora’s compatibility with RHEL packaging allows seamless installation using Microsoft’s official repositories.

Configuring SQL Server 2022 Repository

Add the SQL Server 2022 repository to your system with the following command sequence:

sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/9/mssql-server-2022.repo

This downloads the repository configuration file and places it in the correct directory for DNF to recognize. The repository targets RHEL 9, which aligns well with Fedora 43’s package structure and dependencies. Verify the repository was added successfully by listing your configured repositories with dnf repolist.

Adding Command-Line Tools Repository

SQL Server’s command-line utilities, including sqlcmd and bcp, require a separate repository. Install the tools repository configuration:

sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/9/prod.repo

This repository provides essential utilities for managing SQL Server from the command line, executing T-SQL queries, and performing bulk copy operations. The sqlcmd utility becomes indispensable for scripting, automation, and remote administration tasks.

Repository Verification

Refresh your package cache to ensure the new repositories are accessible:

sudo dnf check-update

This command contacts the Microsoft repositories and downloads current package lists. If you encounter GPG key prompts, accept them to establish trust for Microsoft’s package signatures. Network connectivity issues or DNS problems may prevent repository access, requiring troubleshooting before proceeding.

Installing Microsoft SQL Server

Installing the SQL Server Database Engine

With repositories configured, install the core SQL Server package:

sudo dnf install -y mssql-server

The installation process downloads approximately 200-300 MB of data, depending on dependencies. DNF automatically resolves and installs required libraries, including various system libraries and runtime components. The installation creates the mssql user and group for running the SQL Server service, establishes directory structures under /opt/mssql/ and /var/opt/mssql/, and prepares the system for initial configuration.

Installing SQL Server Command-Line Tools

Install the sqlcmd and bcp utilities essential for database management:

sudo dnf install -y mssql-tools unixODBC-devel

During installation, you’ll encounter license agreement prompts. Type “YES” in capital letters to accept the Microsoft ODBC Driver license terms, then confirm acceptance for the mssql-tools package license. These tools install to /opt/mssql-tools/bin/ and require PATH configuration for convenient access. The unixODBC-devel package provides ODBC connectivity libraries that enable database connections from various applications.

Verifying Package Installation

Confirm successful installation by querying installed packages:

rpm -qa | grep mssql

This displays all installed SQL Server-related packages with version information. You should see mssql-server, mssql-tools, and their dependencies listed. Check the installation directories exist with ls /opt/mssql/ and ls /var/opt/mssql/ to verify file placement.

Configuring Microsoft SQL Server

Initiating Setup Configuration

SQL Server requires initial configuration before starting. Execute the setup script provided with the installation:

sudo /opt/mssql/bin/mssql-conf setup

This interactive configuration wizard guides you through essential setup steps. The mssql-conf tool serves as SQL Server’s primary configuration utility on Linux, managing settings that Windows administrators typically handle through SQL Server Configuration Manager.

Selecting Your SQL Server Edition

The setup wizard presents edition options numbered 1 through 8. For development and testing, select option 2 for Developer Edition, which provides all enterprise features without licensing costs. Evaluation Edition (option 1) works well for temporary testing with a 180-day time limit. Express Edition (option 3) suits small applications with modest resource requirements. Production environments require licensed editions: Web (option 4), Standard (option 5), or Enterprise (option 6). Enter your chosen number and press Enter to continue.

Accepting License Terms

The wizard displays Microsoft’s Software License Terms. Read the agreement carefully, then type “Yes” (case-sensitive) to accept and proceed. This legal agreement governs your use of SQL Server and varies by edition selected.

Creating the SA Password

The System Administrator (SA) account is SQL Server’s most powerful login, possessing unrestricted access to all databases and configurations. Enter a strong password meeting these requirements: minimum 8 characters, including uppercase letters, lowercase letters, digits, and special symbols. Example format: “MyS3cur3P@ssw0rd” (never use this example in production). Type your password, press Enter, then retype it exactly for confirmation. The password does not display during entry for security purposes.

Configuration Completion

After password confirmation, setup proceeds automatically. The wizard configures ForceFlush settings for transaction log durability, creates systemd service files for automatic management, establishes symbolic links for convenient access, and initializes system databases including master, model, msdb, and tempdb. Upon successful completion, you’ll see “Setup has completed successfully. SQL Server is now starting”. This process typically takes 30-60 seconds depending on system performance.

Managing SQL Server Service

Starting the Database Service

Start SQL Server using systemd commands:

sudo systemctl start mssql-server

The service initialization connects to configured network ports, loads system databases into memory, and prepares to accept client connections. First-time startup may take slightly longer as SQL Server optimizes internal structures.

Enabling Automatic Startup

Configure SQL Server to start automatically when your Fedora system boots:

sudo systemctl enable mssql-server

This creates a symbolic link in the systemd multi-user target directory, ensuring SQL Server launches during system initialization. Automatic startup proves essential for production servers requiring high availability.

Checking Service Status

Verify SQL Server is running correctly:

sudo systemctl status mssql-server

Healthy output shows “active (running)” in green text, along with the service’s process ID, memory usage, and recent log entries. The status command also displays any error messages if SQL Server failed to start.

Stopping and Restarting

Stop SQL Server when performing maintenance or applying configuration changes:

sudo systemctl stop mssql-server

Restart SQL Server to apply certain configuration modifications:

sudo systemctl restart mssql-server

Always verify the service returns to active status after restarting. Configuration changes made with mssql-conf typically require restart to take effect.

Configuring Environment Variables

Adding Tools to System PATH

SQL Server binaries and command-line tools install outside the standard PATH. Create a system-wide configuration file for convenient access:

sudo nano /etc/profile.d/mssql.sh

Add these export statements to the file:

export PATH="$PATH:/opt/mssql/bin:/opt/mssql-tools/bin"

This appends SQL Server directories to the existing PATH variable. Save the file and exit your editor. System-wide PATH configuration affects all users, ensuring consistency across your environment.

Applying PATH Changes

Activate the new PATH configuration immediately:

source /etc/profile.d/mssql.sh

Alternatively, log out and log back in for changes to take effect permanently. Verify successful PATH configuration by running which sqlcmd, which should return /opt/mssql-tools/bin/sqlcmd. User-specific PATH modifications can be made in .bash_profile or .bashrc files in individual home directories.

Testing SQL Server Installation

Connecting with sqlcmd

Establish your first connection to SQL Server using the sqlcmd command-line utility:

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

Replace ‘YourPassword’ with the SA password you created during setup. The -S flag specifies the server name, -U provides the username, and -P supplies the password. For enhanced security, omit the -P flag and enter your password at the prompt where it won’t be visible.

Understanding the sqlcmd Interface

Upon successful connection, sqlcmd displays a numbered prompt: “1>”. This interactive mode allows multi-line query entry. Type SQL statements on consecutive lines, then execute them by typing “GO” on a new line. Results appear below the GO command. The prompt increments for each line entered.

Creating a Test Database

Verify SQL Server functionality by creating a sample database:

CREATE DATABASE TestDB;
GO

SQL Server creates the database with default settings, establishing data and log files in /var/opt/mssql/data/. The GO command executes the batch, and successful completion shows no errors. Database creation demonstrates that SQL Server can perform write operations and manage system resources properly.

Verifying Database Creation

Query system catalogs to confirm your database exists:

SELECT name, database_id, create_date FROM sys.databases;
GO

This query returns all databases including system databases (master, model, msdb, tempdb) and your newly created TestDB. The sys.databases catalog view provides comprehensive database metadata. You should see TestDB listed with its creation timestamp.

Testing Basic Queries

Check SQL Server version information:

SELECT @@VERSION;
GO

This returns detailed version information including the SQL Server build number, Linux kernel version, and system architecture. Exit sqlcmd by typing “QUIT” or “EXIT” and pressing Enter.

Advanced Configuration Options

Memory Configuration

SQL Server on Linux requires memory limits configuration for optimal performance. Set maximum server memory using mssql-conf:

sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 4096
sudo systemctl restart mssql-server

This example limits SQL Server to 4 GB of RAM. Adjust the value based on your system’s total memory and other running applications. Leave sufficient memory for the operating system and other processes.

Changing Default Directories

Relocate database files to different storage volumes for better I/O performance:

sudo mkdir /data/sqldata
sudo chown mssql:mssql /data/sqldata
sudo /opt/mssql/bin/mssql-conf set filelocation.defaultdatadir /data/sqldata
sudo systemctl restart mssql-server

This moves the default data directory while maintaining proper ownership. Similar commands configure log file directories and backup locations. Always set ownership to the mssql user before applying changes.

Network Configuration

Modify network settings through mssql-conf for custom port assignments or specific IP binding. List all configurable options with /opt/mssql/bin/mssql-conf list. Most configuration changes require service restart to take effect.

Common Installation Issues and Troubleshooting

Repository Connection Failures

Repository access errors typically stem from network connectivity problems. Verify internet connectivity with ping packages.microsoft.com. DNS resolution issues may require updating /etc/resolv.conf with functional nameservers. Firewall rules blocking outbound HTTPS traffic prevent repository access. Corporate proxies require proxy configuration in /etc/dnf/dnf.conf.

Insufficient System Resources

SQL Server refuses to start when memory requirements aren’t met. Check available RAM with free -h command. Systems with less than 2 GB fail immediately. Disk space exhaustion during installation or database growth causes various errors. Monitor disk usage with df -h and ensure adequate free space in /var/opt/mssql/.

Service Start Failures

Review SQL Server error logs when the service won’t start:

sudo tail -f /var/opt/mssql/log/errorlog

Common issues include incorrect file permissions on data directories, corrupted system databases requiring rebuild, and port 1433 already in use by another service. Check port availability with netstat -tulpn | grep 1433.

Connection Problems

“Cannot connect to localhost” errors indicate SQL Server isn’t running or network configuration blocks access. Verify service status with systemctl status mssql-server. Confirm firewall rules allow port 1433 traffic. SELinux denials appear in /var/log/audit/audit.log and may require policy adjustments.

sqlcmd Command Not Found

PATH configuration issues prevent sqlcmd execution. Verify tool installation with rpm -qa | grep mssql-tools. Manually configure PATH by adding export statements to your shell profile. Run /opt/mssql-tools/bin/sqlcmd with the full path as a temporary workaround.

Security Best Practices

SA Account Protection

Change the default SA password immediately in production environments. Use a password manager to generate and store complex credentials. Create alternative administrative accounts with specific responsibilities, reserving SA for emergency access only. Disable SA login after establishing other administrators for enhanced security.

User and Permission Management

Follow the principle of least privilege when granting database permissions. Create individual login accounts for each user rather than sharing credentials. Use role-based access control to simplify permission management across multiple databases. Regularly audit user permissions and remove unused accounts to minimize security exposure.

Network Security Hardening

Restrict firewall rules to specific IP addresses requiring SQL Server access rather than allowing all traffic. Implement SSL/TLS encryption for client connections to protect data in transit. Disable unnecessary network protocols and services. Consider placing SQL Server behind a VPN for remote access scenarios.

System-Level Security

Verify file permissions on SQL Server directories restrict access to the mssql user. Protect backup files with appropriate permissions and encryption. Enable SQL Server auditing to track administrative actions and suspicious activities. Apply security updates promptly to address vulnerabilities.

Post-Installation Tasks

Installing Database Management Tools

Azure Data Studio provides a modern, cross-platform graphical interface for SQL Server management. Download and install it from Microsoft’s website for enhanced productivity. SQL Server Management Studio (SSMS) runs on Windows but can connect remotely to Linux SQL Server instances. Third-party tools like DBeaver and DataGrip offer multi-platform support.

Implementing Backup Strategies

Create regular backup schedules using T-SQL BACKUP DATABASE commands:

BACKUP DATABASE TestDB TO DISK = '/var/opt/mssql/data/TestDB.bak'

Schedule backups with cron jobs for automation. Test restore procedures regularly to verify backup integrity. Implement a retention policy balancing storage costs and recovery point objectives.

Monitoring and Maintenance

Establish monitoring for SQL Server performance metrics, including CPU usage, memory consumption, and disk I/O. Configure alerts for critical conditions like database corruption or service failures. Create maintenance plans for index rebuilding, statistics updates, and consistency checks. Document your configuration, backup schedules, and maintenance procedures.

Alternative Installation Methods

Docker Container Deployment

SQL Server runs efficiently in Docker containers for development and testing. Pull the official image and run with:

docker pull mcr.microsoft.com/mssql/server:2022-latest
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong@Password' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest

Containers provide isolation, easy cleanup, and rapid deployment. Use volumes to persist database files beyond container lifecycle.

Manual RPM Installation

Download RPM packages directly from Microsoft’s website for offline installation. Transfer packages to your Fedora system and install with dnf localinstall command. This approach suits air-gapped environments without internet access. Manually resolve dependencies by downloading required packages.

Congratulations! You have successfully installed Microsoft SQL. Thanks for using this tutorial for installing the Microsoft SQL Server on your Fedora 43 Linux system. For additional or useful information, we recommend you check the official Microsoft website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button