Do you know how to install Microsoft SQL Server 2019 on CentOS 7? I mentioned in the post of Jexus deployment asp.net mvc website guide that the customer asked us to deploy the website developed by asp.net webform to the Linux system. At that time, I chose Centos 7, then in this post, you will learn To how to install Sql server 2019 on Centos 7 server, let’s get started.
Install Microsoft SQL Server 2019 on CentOS 7
SQL Server runs on Linux starting with SQL Server 2017. This SQL Server is the same SQL Server database engine running on Microsoft Operating systems, with many similar features and services.
This guide will take you through the steps to install Microsoft SQL Server 2019 on CentOS 7 | Fedora 36/35/34/33/32 Linux system. As of this writing, SQL Server 2019 is available for Production use on Ubuntu / CentOS and RHEL Linux.
Step 1: Install Microsoft SQL Server 2019 on CentOS 7 / Fedora
Microsoft SQL Server 2019 is available for the general use. Add the repository to your CentOS 7 / Fedora by running the following commands on your terminal.
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo
This will download SQL Server 2019 repository to
/etc/yum.repos.d/mssql-server.repo
Update your system cache:
### CentOS 7 ### sudo yum makecache ### Fedora ### sudo dnf makecache
Then install SQL server 2019 on CentOS 7:
sudo yum install -y mssql-server
For Fedora, you can use also use dnf
command;
sudo dnf install -y mssql-server
To get info about the installed package, run:
$ rpm -qi mssql-server Name : mssql-server Version : 15.0.4223.1 Release : 2 Architecture: x86_64 Install Date: Tue May 17 08:22:16 2022 Group : Unspecified Size : 1297034956 License : Commercial Signature : RSA/SHA256, Mon Apr 18 20:46:17 2022, Key ID eb3e94adbe1229cf Source RPM : mssql-server-15.0.4223.1-2.src.rpm Build Date : Mon Apr 18 20:05:17 2022 Build Host : 17a94b24c000000.qzwxqe3wa2kubparrevzc0ivhc.xx.internal.cloudapp.net ...
Step 2: Initialize MS SQL Database Engine
After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.
sudo /opt/mssql/bin/mssql-conf setup
1.
Select an edition you’d like to use
Choose an edition of SQL Server: 1) Evaluation (free, no production use rights, 180-day limit) 2) Developer (free, no production use rights) 3) Express (free) 4) Web (PAID) 5) Standard (PAID) 6) Enterprise (PAID) 7) Enterprise Core (PAID) 8) I bought a license through a retail sales channel and have a product key to enter.
For me. I’ll go with 7 – Enterprise Core.
2.
Accept the license terms
3.
Set SQL Server system administrator password
Enter the SQL Server system administrator password: <ENTER-STRONG-PASSWORD> Confirm the SQL Server system administrator password: <Confirm Password> Configuring SQL Server... ForceFlush is enabled for this instance. ForceFlush feature is enabled for log durability. Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service. Setup has completed successfully. SQL Server is now starting.
Step 3: Install SQL Server command-line tools
Then install mssql-tools
with the unixODBC developer package. Add the repository containing required packages using the next command:
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
With the repository added, we can proceed to install the tools
sudo yum -y install mssql-tools unixODBC-devel
Accept license terms as directed during installation:
The license terms for this product can be downloaded from https://aka.ms/odbc17eula and found in /usr/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES', you indicate that you accept the license terms. Do you accept the license terms? (Enter YES or NO) YES Installing : msodbcsql17-17.9.1.1-1.x86_64 2/4 The license terms for this product can be downloaded from http://go.microsoft.com/fwlink/?LinkId=746949 and found in /usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES', you indicate that you accept the license terms. Do you accept the license terms? (Enter YES or NO) YES
Step 4: Start and enable mssql-server service
Start mssql-server service
sudo systemctl start mssql-server
Enable it to start on system boot:
sudo systemctl enable mssql-server
Add /opt/mssql/bin/
to your $PATH variable:
echo 'export PATH=$PATH:/opt/mssql/bin:/opt/mssql-tools/bin' | sudo tee /etc/profile.d/mssql.sh
Source the file to start using MS SQL executable binaries in your current shell session:
source /etc/profile.d/mssql.sh
If you have an active Firewalld service, allow SQL Server ports for remote hosts to connect:
sudo firewall-cmd --add-port=1433/tcp --permanent sudo firewall-cmd --reload
Step 5: Test SQL Server
Connect to the SQL Server and verify it is working.
$ sqlcmd -S localhost -U SA Password: <INPUT-PASSWORD-SET-IN-STEP-2>
Authenticate with the password set in Step 2.
Show Database users:
Some useful commands
Start the sql server service: sudo systemctl start mssql-server Stop the sql server service: sudo systemctl stop mssql-server Restart the sql server service: sudo systemctl restart mssql-server View sql server status: sudo systemctl status mssql-server sql server starts automatically at boot: systemctl enable mssql --systemctl enable mssql-server.service Enable SQL server proxy sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true sudo systemctl restart mssql-server