How to Configure Repositories for Installing and Upgrading SQL Server on RHEL Virtual Machine

By:   |   Updated: 2021-10-21   |   Comments   |   Related: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | > Virtualization


Problem

Repositories are very important to install or upgrade software on a Red Hat Linux machine. In this article we look at how to get the correct repositories in place to install SQL Server 2019 on RHEL.

Solution

Let’s first understand what a repository is and then we can discuss installation, update or upgrade activities.

A repository is a central storage location from where our machines retrieve the source files to install, update or upgrade the target applications or software. Every software or product version has their own repository which is a collection of software from where VMs get their updates.

There are two main type of repositories for distribution for SQL Server:

  • Cumulative Updates - The Cumulative Update (CU) repository contains packages for the base SQL Server release and any bug fixes or improvements since that release. Cumulative updates are specific to a release version, such as SQL Server 2019. They are released as changes or fixes are released.
  • GDR - The GDR repository contains packages for the base SQL Server release and only critical fixes and security updates since that release. These updates are also added to the next CU release.

Each CU and GDR release contains the full SQL Server package and all previous updates for that repository.

Let’s go ahead and configure the repositories to install SQL Server 2019.

Step by Step Process to Configure Repositories for SQL Server 2019 on RHEL Machine

Note: Ensure to change the path for each version of RHEL, if you are using RHEL 7 or RHEL 7.x then modify the commands with /rhel/7 and if you are using RHEL 8 or RHEL 8.x then you should use /rhel/8.

First check the existing repositories on your RHEL machine, this way you can also verify whether you have already configured the target repository or not. Run the below command to check if you have registered the SQL Server repository.

--Verify SQL Server Repository
sudo ls /etc/yum.repos.d

You can see in the below image, there are a few SQL Server related repositories listed in the output details. These are previously configured repositories on the machine. We can see mssql-server.repo is already registered, so let’s see the content of this repository to understand more about this file and its version. If you are sure that this repo is older and needs to be refreshed then you can directly go to the removal steps in order to configure correct repositories.

install repository

Run the below command to look at the content of the mssql-server.repo file.

--Get mssql-server.repo file contents
sudo cat /etc/yum.repos.d/mssql-server.repo

We can see additional details below.

install repository

I want to clean up the previously configured repository and get what we need to install SQL Server 2019. The below command will remove a previous repository to clean the machine.

--Remove previously configured repository
sudo rm -rf /etc/yum.repos.d/mssql-server.repo
install repository

Let’s verify whether the repository has been removed.

--Validate removed file
sudo ls /etc/yum.repos.d

We can see that mssql-server.repo file is not showing in the below image.

install repository

My Red hat Linux version is 7 and I want to install SQL Server 2019 on RHEL 7, so we will run the below commands to configure the repository. If you have a different version of RHEL, like RHEL 8, then you can use second set of commands.

--Configure Repository for SQL Server 2019 on RHEL 7
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo

--Configure GDR Repository for SQL Server 2019 on RHEL 7
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019-gdr.repo


--Configure CU Repository for SQL Server 2019 on RHEL 8.1
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo

--Configure GDR Repository for SQL Server 2019 on RHEL 8.1
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019-gdr.repo

Below shows the install for the GDR repo.

install repository

Run the below command to validate the newly configured repository.

--Validate the Newly configured Repository
sudo ls /etc/yum.repos.d

You can see the output, mssql-server.repo is showing now.

install repository

Here is the screenshot for configuring the SQL Server 2019 CU repository and also validation.

install repository
Next Steps
  • We have configured the right set of repositories for SQL Server. In the next article we install SQL Server.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Manvendra Singh Manvendra Singh has over 5 years of experience with SQL Server and has focused on Database Mirroring, Replication, Log Shipping, etc.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2021-10-21

Comments For This Article

















get free sql tips
agree to terms