Fixing dependency issues during installation of SQL Server Tools on Red Hat Linux Server
When we install SQL Server or SQL Server tools on a Linux server, it first checks the dependencies of the package to be installed. When installing the SQL Server tools on one of the Linux servers, I got the following error.
Error: Package: unixODBC-utf16-2.3.1-1.x86_64 (apt-mo.trafficmanager.net_yumrepos_mssql-rhel7-release_) Requires: libltdl.so.7()(64bit)
Follow this tip to fix this type of error.
As you may know, SQL Server vNext does not install sqlcmd and the BCP utility along with the SQL Server installation on a Linux server. We need the sqlcmd utility to make a database connection to a Linux server, so we should install it on the target server where SQL Server is installed. I have explained the step by step method to install SQL Server tools on Red Hat Linux in my last tip.
In this tip, I will show how to fix any dependency error you face during installation. I will try to install the SQL Server tools on a Red Hat Linux server where I have already installed the SQL Server vNext version. Once I encounter a dependency error I will proceed with the fix in this tip.
Error during MSSQL Tools Installation on Redhat Linux 7.2
Step 1: First connect to the target Linux server on which you have installed SQL Server. You can directly connect to the server by logging in to do this exercise or you can use PuTTY a third party tool to make a Linux server connection. I used PuTTY to login to this server. I launched PuTTY and entered the IP address of the Linux server and then clicked the Open button as shown below.
Once you click on the Open button, a black screen with appear asking you to enter the login name followed the password. I entered the login name and password and then pressed enter to connect as shown in the below screenshot.
Step 2: You can see that I made a successful connection to the Linux server linux4mssql where I installed SQL Server. Now let's check and verify the SQL Server installation on this machine. Run the below command to check the mssql-server service.
#check the status of mssql-server service. systemctl status mssql-server
We can see the service status shows enabled and active (running) which is highlighted in green. This means SQL Server is installed and running fine on this Linux server. To make a database connection directly on this server, we need to install the sqlcmd utility on this machine to access SQL Server.
Step 3: We will use superuser mode su for the next step. Superuser mode in Linux is similar to the system administrator account permission in Windows. So connect using superuser mode by running the below command.
#Connect with superuser permission sudo su
You can see that I connected with the superuser account in the below screenshot.
Step 4: Now we will run a curl command to download the installation packages from the Microsoft website to this Linux server. The downloaded file will be saved in location /etc/yum.repos.d/ as mentioned in the command line.
#Download installation configuration file. curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
We can see the progress, time and details of the downloaded configuration file in the below picture.
Now we can check the location /etc/yum.repos.d/ to verify whether the above file is saved in this location. Run the ls -lrt command to display all the files present in that folder.
#list all files/folders inside the yum.repos.d folder. ls -lrt /etc/yum.repos.d/
You can see our target file msprod.repo is in this location in the above picture. You can exit the superuser mode by typing exit followed by pressing enter.
Step 5: Now our next step is to install the SQL Server tools on this box with the help of this package. We will use the yum package to install it as we do for other applications on Linux. Run the below command to install SQL Server tools on this machine.
#Install SQL Server vNext tools sudo yum install mssql-tools
Once you press enter to execute the above command, the execution process will start with checking some dependencies followed by downloading the required packages. Once the dependencies are resolved, all required packages will be displayed on this screen.
We can see the download is not started because the command execution threw some error as shown in the above screenshot. This error is due to some dependency for the unixODBC-utf16-2.3.1-1.x86_64 package which requires another package known as libltdl.so.7()(64bit) for installation. We can see there are a sequence of dependencies inside the mssql tools package. Package mssql-tools.x86_64 requires msodbcsql, package msodbcsql requires unixODBC-utf16 and unixODBC-utf16 will require libltdl.so.7()(64bit). The package libltdl.so.7()(64bit) is missing which means it will not allow you to install the unixODBC-utf16 package and so on.
The Dependency Fix
Step 6: I did some research to fix this issue, but was unable to find anything so I decided to first install the missing package libltdl.so.7()(64bit) on the Linux server. I did a Google search for this package and got a link to download the package libltdl.so.7()(64bit). If you open this link you will get the same package name libltdl.so.7()(64bit) mentioned under the "Provides" section of this page. Download this package to proceed with the next step.
Step 7: I downloaded this package on my local windows machine. My next challenge was to move this file onto the Linux server to install it. I used winscp, a third party tool to copy this downloaded package from my machine to Linux server. You can download winscp here. Now launch the winscp tool after installing it on your desktop, there are two panes for this tool. Files in left pane are on your Windows machine and files in the right pane are on your Linux server. We just need to drag and drop the target file from left pane to right pane to copy it to the Linux server. You can see I copied this downloaded package from C:\Users\Administrator\Downloads\ on my Windows machine to /home/Manvendra/ folder on the Linux server. Later we will check and verify this file on the Linux server.
Now go to your Linux server with PuTTY and check the location /home/manvendra to verify the file exists. You can see the file has been copied to this location in the below picture.
Now we need to move this package to /etc/yum.repos.d/ folder to kick off the installation of this package. Run the below commands to move this package to its destination folder.
#Move from/home/manvendra to /etc/yum.repos.d/ mv libtool-ltdl-2.4.2-21.217_2.x86_64.rpm /etc/yum.repos.d/libtool-ltdl-2.4.2-21.217_2.x86_64.rpm #Verify whether file is copied to destination or not. ls -lrt /etc/yum.repos.d/
Step 8: We can see our missing package which needs to be installed for the SQL Server tools package is copied to yum.repos.d folder in the above picture. The next step is to install this package to fix this issue. Run the below command to start the installation of this package.
#Run below command to start the installation of this package. sudo yum install libtool-ltdl-2.4.2-21.217_2.x86_64.rpm
Once you execute this package, it will ask you to type y to proceed with this installation as shown in the below picture.
Type y to confirm all details are OK to proceed. Once you press enter, the download process will start followed by the installation of this package. You can see this package has been successfully installed on this Linux server.
Step 9: The dependency problem should be fixed after installing the above package. Now start the installation again of the mssql tools package by running the below command.
#Run below command to start the installation of this package. sudo yum install mssql-tools
Now it's asking you to confirm the installation, to proceed type y. This means the dependency issue was resolved, because we can see it's showing "Dependencies Resolved" in the below picture.
Type y and press enter to proceed, now every package will ask you to enter YES to accept the license terms during installation as shown in the below screenshot.
Enter YES for each particular package to install them one by one on your machine. Once installation is completed, you will get the below screen with the name of the installed product and its status as compete. We can see the installed product is showing as mssql-tools.x86_64*.
Step 10: The dependency issue is fixed and the MSSQL tools have been installed successfully on your Linux machine. Now we will check and verify whether the sqlcmd utility is installed to access SQL Server on this machine. Type sqlcmd and press enter to check the details of this utility.
#check sqlcmd utility. sqlcmd
We can see that the sqlcmd command is recognized by Linux and the output of this command shows that sqlcmd is installed.
Step 11: Next we will validate that sqlcmd is working by making a database connection from the Linux box. Run the below command to connect to the database engine from the Linux server.
#Run sqlcmd to make database connection. #You need to pass server name/IP address with -S, user name with -U and password with -P. sqlcmd -S 192.168.209.128 -U SA -P 'XXXXXXX'
Once you will execute the above command, a SQL Server prompt will appear with cursor 1>. I executed "SELECT @@VERSION" to check the version of SQL Server installed and I got the below output
#I executed SELECT @@VERSION to get version details of SQL Server. I got below output: Microsoft SQL Server vNext (CTP1) - 126.96.36.199 (X64) Nov 1 2016 23:24:39 Copyright (c) Microsoft Corporation on Linux (Red hat Enterprise Linux Server 7.2 (Maipo))
- Go ahead and make database connections on your Linux server and learn new ways to interact with SQL Server databases.
- Explore more knowledge on SQL Server Database Administration Tips.
- Read these other SQL Server on Linux tips
About the author
View all my tips
Article Last Updated: 2017-02-01