FedoraRHEL Based

How To Install Microsoft SQL Server on Fedora 39

Install Microsoft SQL Server on Fedora 39

In this tutorial, we will show you how to install Microsoft SQL Server on Fedora 39. Microsoft SQL Server, a leading relational database management system, was initially designed for Microsoft Windows. However, the growing need for high-performance computing with demanding workloads led to the re-architecture of SQL Server in 2016, offering multiplatform support. As a result, it became possible to run SQL Server on Linux systems for the first time.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Microsoft SQL Server on a Fedora 39.

Prerequisites

Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora 39 provides the Terminal application for this purpose. It can be found in your Applications menu.
  • You’ll need an active internet connection to download Microsoft SQL Server and its dependencies.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Microsoft SQL Server on Fedora 39

Step 1. First, update the system packages to ensure that you have the latest versions. This can be done using the following command:

sudo dnf clean all
sudo dnf update

Step 2. Add the Microsoft SQL Server Repository.

We begin by adding Microsoft‘s package repository for SQL Server to Fedora’s package manager DNF. This allows us to easily install SQL Server using DNF rather than manually downloading and installing individual RPM packages:

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

This command downloads the SQL Server 2019 repository configuration file and saves it as /etc/yum.repos.d/mssql-server.repo.

Next, run dnf makecache to update the DNF package cache:

sudo dnf makecache

Step 3. Installing Microsoft SQL Server on Fedora 39.

After configuring the repository, you can install SQL Server by running the following command:

sudo dnf install mssql-server

This command installs the SQL Server package on your Fedora system.

After installing SQL Server and its command-line tools, you need to start the SQL Server service and enable it to start on system boot. Use the following commands to do this:

sudo systemctl start mssql-server
sudo systemctl enable mssql-server

Step 4. Initialize SQL Server.

Once the SQL Server package is installed, you need to initialize the SQL Server database engine. This process involves setting the SA (System Administrator) password and choosing your SQL Server edition. To initialize the SQL Server, run the following command:

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

Step 5. Open Firewall Ports for SQL Server.

For remote connections, open ports in the Linux firewall for the following services:

  • SQL Server: TCP port 1433
  • SQL Server Distributed Transaction Coordinator (DTC): TCP ports 11000-11999

Here are the commands for Fedora:

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

Step 6. Install SQL Server Command-Line Tools.

SQL Server provides some useful command-line tools for administration and querying including:

  • sqlcmd: SQL Server command-line query tool
  • bcp: Bulk import/export data utility

Install these tools on Fedora along with the ODBC driver and its dependencies using:

sudo dnf install mssql-tools unixODBC-devel

The sqlcmd tool can now connect to the SQL Server and execute T-SQL statements from the bash shell.

We can check if SQL Server is running with the systemctl status command:

sudo systemctl status mssql-server

Additionally, run sqlcmd to connect and execute a simple SQL query:

/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '<your_password>' -Q 'SELECT @@VERSION'

This connects as the SA user and displays the SQL Server version, confirming everything is working correctly.

Congratulations! You have successfully installed Microsoft SQL. Thanks for using this tutorial for installing the Microsoft SQL Server on your Fedora 39 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 seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button