Home > Workload Solutions > SQL Server > White Papers > Dell PowerMax 2500 and 8500 Best Practices for Mission Critical SQL Server Databases > Example: Deploying SQL Server on Red Hat Enterprise Linux
The following section shows how to deploy SQL Server on Linux. In this example, the operating system is Red Hat Enterprise Linux 8.5.
Perform the following steps to prepare to deploy SQL Server:
# subscription-manager register --username <NAME> --password <PWD> --auto-attach
# groupadd mssql
# useradd mssql -g mssql -d /home/mssql
# dnf install -y tuned-profiles-mssql
# tuned-adm list
Available profiles:
...
- mssql - Optimize for Microsoft SQL Server
...
# tuned-adm profile mssql
# tuned-adm active
Current active profile: mssql
# cat /usr/lib/tuned/mssql/tuned.conf
Perform the following steps to install SQL Server on Red Hat Enterprise Linux 8:
# dnf install -y python2 compat-openssl10
# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo
# dnf install -y mssql-server
Perform the following steps to configure SQL Server:
# /opt/mssql/bin/mssql-conf setup
# systemctl status mssql-server
● mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2022-05-15 13:10:20 CDT; 2min 0s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 505201 (sqlservr)
Tasks: 262
Memory: 3.7G
CGroup: /system.slice/mssql-server.service
├─505201 /opt/mssql/bin/sqlservr
└─505253 /opt/mssql/bin/sqlservr
# firewall-cmd --zone=public --add-port=1433/tcp --permanent
success
# firewall-cmd --reload
success
Perform the following steps to install SQL Server tools:
# curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
# dnf install -y mssql-tools unixODBC-devel
# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# source ~/.bashrc
# su - mssql
$ echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
$ . ~/.bash_profile
$ sqlcmd -S localhost -U SA
Password:
1> select cast(name as varchar(20)), database_id from sys.databases
2> GO
database_id
-------------------- -----------
master 1
tempdb 2
model 3
msdb 4
(4 rows affected)
By default, SQL Server is installed under the /var/opt/mssql/ local directory structure, where the errorlog files are in the /var/opt/mssql/log directory, and the system databases (such as master, temp, and msdb) are in /var/opt/mssql/data directory.
[root@dsib1004 ~]# ls -ld /sql/sysdb
drwxr-xr-x 2 mssql mssql 6 May 19 16:09 /sql/sysdb/
Note: For information about how to set up the PowerMax volumes with XFS mountpoints, see Storage considerations for SQL Server on Linux.
[root@dsib1004 ~]# mssql-conf set filelocation.masterdatafile /sql/sysdb/master.mdf
SQL Server needs to be restarted in order to apply this setting. Please run
'systemctl restart mssql-server.service'.
[root@dsib1004 ~]# mssql-conf set filelocation.masterlogfile /sql/sysdb/mastlog.ldf
SQL Server needs to be restarted in order to apply this setting. Please run
'systemctl restart mssql-server.service'.
The files are still in their original location because the SQL Server service is still running.
For example:
# systemctl restart mssql-server.service
#
# ls -l /sql/sysdb/
total 130372
drwxr-xr-x 2 mssql mssql 65536 May 20 17:11 ./
drwxr-xr-x 5 root root 48 May 19 13:26 ../
-rw-rw---- 1 mssql mssql 256 May 20 17:11 Entropy.bin
-rw-rw---- 1 mssql mssql 4653056 May 20 17:11 master.mdf
-rw-rw---- 1 mssql mssql 2097152 May 20 17:11 mastlog.ldf
...
-rw-rw---- 1 mssql mssql 8388608 May 20 17:11 templog.ldf
[root@dsib1004 ~]# mssql-conf set filelocation.defaultdatadir /sql/sqldata/
SQL Server needs to be restarted in order to apply this setting. Please run
'systemctl restart mssql-server.service'.
[root@dsib1004 ~]# mssql-conf set filelocation.defaultlogdir /sql/sqllog/
SQL Server needs to be restarted in order to apply this setting. Please run
'systemctl restart mssql-server.service'.
[root@dsib1004 ~]# systemctl restart mssql-server
Perform the following steps to connect from SSMS:
For example, if the Windows environment runs on the org.local domain, and the Linux server instance runs on a server with IP address 10.228.245.4, you can add an entry to the DNS, such as SQLLINUX1, to point to it, as shown in the following figure: