SQL Server 2017 is supported on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu. It is also supported as a Docker image, which can run on Docker Engine on Linux or Docker for Windows/Mac.
Even Sql Server 2017 can be deployed and managed by Redhat openshift and kubernetes.
Minimal Requirement for SQL server 2017 on REDHAT Enterprise Linux 7.3. is 2GB Ram with disk space 6GB ,2 core,XFS file system and X64- compatible.
Prerequisite
Download Redhat enterprise distribution from website of REDHAT
Installation can be done on Physical or VM machine with initial requirement with DVD
set Language English and in software Selection Put installation With GUI.
Set Sqlserver in usercreation and same can be used for SQLsetup.
Download SQL Server 2017 repository from LINUX machine if internet available or Download
from REDHAT Satellite server then copy tp server or compress format also can be downloaded from windows Machine
Command from Linux machine
1 | sudo curl -o /etc/yum.repos.d/mssql-server.repo htpps://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo |
copy software on /tmp location and give rights to sqlserver user
execute below command
1 | sudo yum install -y mssql-server |
Once setup completed below message will come
Then below command for SQL server confguration
1 | sudo /opt/mssql/bin/mssql-conf setup |
provide strong password for SA account and version you want to use
Give Strong SA password
Now you SQL server on Redhat Enterprise Linux installed and accessibility for SQL Server from outside world can be set on linux box or even port number also can be changed.
Configure Firewall rule and check SQL server is running
1 2 3 4 5 6 7 | sudo firewall-cmd --zone=public --add-port=1433/tcp –permanent sudo firewall-cmd –reload systemctl status mssql-server sudo systemctl restart mssql-server |
for convenience add bash profile for sqlserver user with below entry
1 | echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc |
while logging to SQLSERVER user you can connect locally with below command
1 | sqlcmd -S hostname(Linux Machine) -U SA -P 'password' |
if you need SQL server agent and command line tool,SQL operation studio on Linux Server then separate Linux RPM need to downloaded and install on Linux machine
1 2 3 4 5 6 7 | sudo yum install mssql-server-agent sudo yum install unixODBC-utf16 unixODBC-utf16-devel yum install libXScrnSaver sudo yum install sqlops-linux-0.26.6.rpm |
SQL server running on Linux can be connected with SQL server Management studio installed on window Machine and all database operation can be performed. SQL server database running on SQL server 2012 on windows server can be migrated to SQL server 2017 running on Redhat linux by copying db backup file to default directory of Database in Linux machine and restore with SQL server Management studio running on windows machine or by T-SQL. Backup yourdb from windows SQL server and copy backup file from windows machine to Linux box by winscp.
Connect SQL server from linux machine:
1 | sqlcmd -S localhost -U SA RESTORE DATABASE YourDB FROM DISK = '/var/opt/mssql/backup/YourDB.bak' WITH MOVE 'YourDB' TO '/var/opt/mssql/data/YourDB.mdf', MOVE 'YourDB_Log' TO '/var/opt/mssql/data/YourDB_Log.ldf' |
Conclusions
The availability of Microsoft SQL Server on Linux provides a useful new option for database administrators. SQL 2017 can potentially save on Windows license costs and even simplify server administration for primarily Linux based environments that would only use Windows servers as MS SQL .