×


How to install SQL Tools on Redhat Linux offline

Are you trying to get SQL tools installed on Redhat offline? This guide will help you.


Basically, SQL Tools is a development tool pack that provides many essential features for any Microsoft SQL Server developer.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform SQL related queries.

In this context, we shall look into the steps to take to install SQL tools on Redhat without the internet.

A brief information about SQL tools?

SQL tools can be installed easily with internet access. However, it is a bit complex task to install it offline.

The mssql-tools package contains two utilities i.e. "sqlcmd" and "bcp" which we will be installing below.

How to install SQL tools on Redhat without internet / offline?

To install SQL tools on offline mode, follow the steps below;

1. Download & Copy SQL Tools Packages to Linux Server

Start by checking whether the SQL server is installed or not on the machine. For that, execute the following command;

systemctl status mssql-server


As a result, it must display that the SQL server is running on the machine.

Now, it is time to check if the SQL tools are installed on the machine or not. To do this, execute the below command;

sqlcmd


If the above command shows a result of "No such file or directory" then it means that the SQL tools are not yet installed.

So download the rpm packages for SQL tools. You can download these packages on a machine that is connected to the internet. Here is the list of rpm packages that you would need to download.

msodbcsql-13.1.9.0-1.x86_64.rpm
mssql-tools-14.0.5.0-1.x86_64.rpm


First, we need to install msodbcsql as the SQL Tools package depends on it. Installing it will avoid any dependency issue. After downloading the package to your local PC, copy the downloaded packages to the RedHat Linux server that will be running without an internet connection.

You can use any tool, application, or method to copy this file from localhost to Linux server. Here, we used the WinSCP tool to copy this file from the local machine to the Linux server.

Now we launch the WinSCP tool and make a connection to the Red Hat Linux server. Enter the login details and establish a connection.

There will be two panes in the WinSCP window. The files in the left side pane are your local system and the right side pane is your target Linux server.

Now we need to drag the downloaded rpm packages from the left side pane and drop it to the right side pane. Now the files are copied and we can see the files in both side panes.

We have copied the rpm packages to location \home\techyaz\Packages\.

 

2. Installing SQL Tools on Redhat

In this step, we shall install the packages. To do this, execute the following command;

sudo yum localinstall msodbcsql-13.1.9.0-1.x86_64.rpm


Sometimes, it may fail due to the dependency unixODBC package. So make sure you install it.

For that, download the unixODBC package on the localhost and copy it to the Linux server using WinSCP. Run the below command to check if the file is copied on the server.

ls -lrt


Then you can run the command to install the package.

sudo yum localinstall unixODBC-2.3.2-6.fc22.x86_64.rpm


Once the installation will start, it will check dependencies and ask you to type "y" to proceed with the installation.

We have now installed the required package for msodbc package. So go ahead and install this package again. Run the command below to execute the installation;

sudo yum localinstall unixODBC-2.3.2-6.fc22.x86_64.rpm


The setup will ask for confirmation. So press Y and hit Enter to continue the installation process.

Then you will be asked to accept the license terms. Type "YES" to accept the license terms and press enter to proceed.

Next, install the mssql-tools package. For that, run the following command;

sudo yum localinstall mssql-tools-14.0.5.0-1.x86_64.rpm


Your confirmation is required to complete the installation. So press "Y" and press Enter.

Then you will be asked to accept the license terms. Type YES to accept the license terms and press enter to proceed.

Now, you must be able to see that the SQL Server Tools have been installed on this server. Then you can go ahead and run the below command to confirm the installation.

sqlcmd


In case, if you receive the error "command not found" then it means that the RHEL is not able to recognize the SQL tools. So now we shall add "/opt/mssql-tools/bin/" to your PATH environment variable in a bash shell. To do this, execute the following commands.

Here is the command to make sqlcmd/bcp accessible from the bash shell for login sessions, and modify your PATH in the ~/.bash_profile file.

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile


Then to make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, and modify the PATH in the ~/.bashrc file

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

3. How to validate the SQL tools Installation?

Finally, it’s time to validate the installation. So run the following command;

sqlcmd

Now you must see that Linux is able to recognize the utility.

[Need further support in fixing SQL queries? – We are available to help you today.]


Conclusion

This article will guide you on how to install SQL tools on Redhat offline.