This Week I heard abt the possibility to run/install mssql on linux, here is my little howto for you:
*** Install Microsoft SQL Server on Nethserver 7.3
(https://www.microsoft.com/en-us/sql-server/sql-server-2017*resources)
-
Download the Microsoft SQL Server Red Hat repository configuration file:
curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo -
Run the following commands to install SQL Server:
yum install -y mssql-server -
After the package installation finishes, run mssql-conf setup and follow the prompts. Make sure to specify a strong password for the SA account (Minimum length 8 characters, including uppercase and lowercase letters, base 10 digits and/or non-alphanumeric symbols).
/opt/mssql/bin/mssql-conf setup -
Once the configuration is done, verify that the service is running:
systemctl status mssql-server -
To allow remote connections (LAN), open the SQL Server port on the firewall. The default SQL Server port is TCP 1433:
config set myservice service status enabled TCPPort 1433 access green
signal-event firewall-adjust -
To upgrade the mssql-server package on Nethserver 7.3, execute the following command:
yum update mssql-server -
To remove the mssql-server package, follow these steps:
yum remove mssql-server -
Removing the package will not delete the generated database files. If you want to delete the database files use the following command:
rm -rf /var/opt/mssql/
*** Connect to SQL Server on Linux …
(https://docs.microsoft.com/de-de/sql/linux/sql-server-linux-connect-and-query-sqlcmd)
-
Download the Microsoft Red Hat repository configuration file.
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo -
If you had a previous version of mssql-tools installed, remove any older unixODBC packages.
yum update
yum remove unixODBC-utf16 unixODBC-utf16-devel -
Run the following commands to install mssql-tools with the unixODBC developer package.
yum update
yum install mssql-tools unixODBC-devel -y -
To update to the latest version of mssql-tools run the following commands:
yum check-update
yum update mssql-tools -
Optional: Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell. 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"’ >> ~/.bashrc
source ~/.bashrc
*** Connect to SQL Server with sqlcmd
-
On your Linux box, open a command terminal. Run sqlcmd with parameters for your SQL Server name (-S), the user name (-U), and the password (-P).
-
The following command connects to the local SQL Server instance (localhost) on Linux.
sqlcmd -S localhost -U SA -P ‘’ -
To connect to a remote instance, specify the machine name or IP address for the -S parameter.
sqlcmd -S -U SA -P ‘’
*** Use SQL Server Management Studio (SSMS) on Windows to manage SQL Server on Linux
(https://docs.microsoft.com/de-de/sql/linux/sql-server-linux-develop-use-ssms)