https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-tools
The following steps install the command-line tools, Microsoft ODBC drivers, and their dependencies. The mssql-tools package contains:
Install the tools for your platform:
Use the following steps to install the mssql-tools on Red Hat Enterprise Linux.
sudo su
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
exit
sudo yum updatesudo yum remove unixODBC-utf16 unixODBC-utf16-devel
sudo yum updatesudo yum install mssql-tools unixODBC-devel
Note
To update to the latest version of mssql-tools run the following commands:
sudo yum check-update sudo yum update mssql-tools
To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrcsource ~/.bashrc