Install SQL Server and create a database on Red Hat

https://docs.microsoft.com/en-gb/sql/linux/quickstart-install-connect-red-hat

 

curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server.repo
yum install -y mssql-server
/opt/mssql/bin/mssql-conf setup
firewall-cmd –zone=public –add-port=1433/tcp –permanent
firewall-cmd –reload
sytemctl disable firewalld
systemctl stop firewalld

vi /etc/selinux/config

set to disabled

curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
yum remove unixODBC-utf16 unixODBC-utf16-devel
yum install -y mssql-tools unixODBC-devel
vi ~/.bash_profile
vi ~/.bashrc
systemctl enable mssql-server
systemctl status mssql-server
sqlcmd -S localhost -U SA -P ‘<password>’
. ~/.bash_profile

sqlcmd -S localhost -U SA -P ‘<password>’
create database testdb
select name from sys.databases
GO
use testdb
CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
INSERT INTO Inventory VALUES (1, ‘banana’, 150); INSERT INTO Inventory VALUES (2, ‘orange’, 154);
GO
SELECT * FROM Inventory WHERE quantity > 152;
GO
quit

Connect from Windows

From the Windows VBox host

sqlcmd -S 192.168.56.102 -U SA -P <pwd>
1>