Welcome to our guide on how to install Microsoft SQL server 2017 on Fedora 29/CentOS 7. Before you can follow through, ensure that your server meets the following minimum requirements;
- At least 2GB of RAM
- 64-bit CPU architecture
- At least 6GB of disk space
- At least 2x2GHZ CPU cores
- EXT4 or XFS filesystem
Install Microsoft SQL Server 2017 on Fedora 29/CentOS 7
To install MS SQL server 2017 on Fedora 29/CentOS , you need to create the MS SQL repository on your Fedora 29/CentOS 7 server since mssql-server
package is not available on the default repos.
Create MS SQL repository
Run the command below to install Fedora/CentOS MS SQL repo.
wget -O /etc/yum.repos.d/mssql-server-2017.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
Once the MS SQL repository is created, install MS SQL server.
On CentOS 7, run;
yum install mssql-server
On Fedora 29, run;
dnf install mssql-server
You can however use yum
on both.
Setup MS SQL server
Once the installation is done, run the setup script, /opt/mssql/bin/sqlservr-setup
, to setup MS SQL server system administrator (SA) password and choose your MS SQL edition. Note that the Evaluation, Developer and Express editions are free-licensed. In this case, we are going to choose the Developer Edition. All the limitations have been removed on the Developer edition hence it is fully functional.
/opt/mssql/bin/mssql-conf setup
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. Details about editions can be found at https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409 Use of PAID editions of this software requires separate licensing through a Microsoft Volume Licensing program. By choosing a PAID edition, you are verifying that you have the appropriate number of licenses in place to install and run this software. Enter your edition(1-8): 2 The license terms for this product can be found in /usr/share/doc/mssql-server or downloaded from: https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x409 The privacy statement can be viewed at: https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409 Do you accept the license terms? [Yes/No]:yes Enter the SQL Server system administrator password: [email protected] Confirm the SQL Server system administrator password: [email protected] 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.
MS SQL setup is done. It is now running and has been automatically enabled to start on system reboot.
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 Wed 2019-01-16 14:48:43 EST; 8min ago Docs: https://docs.microsoft.com/en-us/sql/linux Main PID: 3930 (sqlservr) CGroup: /system.slice/mssql-server.service ├─3930 /opt/mssql/bin/sqlservr └─3951 /opt/mssql/bin/sqlservr
systemctl list-unit-files --state=enabled | grep mssq mssql-server.service enabled
The default port for MS SQL is 1433/TCP.
ss -altnp | grep 1433 LISTEN 0 128 *:1433 *:* users:(("sqlservr",pid=3951,fd=133)) LISTEN 0 128 :::1433 :::* users:(("sqlservr",pid=3951,fd=138))
Configure firewalld Firewall to allow access to MS SQL server.
firewall-cmd --add-port=1433/tcp --permanent firewall-cmd --reload
MS SQL has been successfully installed on Fedora 29/CentOS 7 server. In order to manage the database tasks, you need to install MS SQL server command line management tools such as bcp
and sqlcmd
. These tools are not available on the default Fedora/CentOS repos. Hence create the repository as shown below;
wget -O /etc/yum.repos.d/mssql-tools.repo https://packages.microsoft.com/config/rhel/7/prod.repo
Install MS SQL command line tools
yum install -y mssql-tools unixODBC-devel
The sqlcmd
command is installed to /opt/mssql-tools/bin/
. To ensure that the command is available on your default PATH environment, create a symbolic to /usr/bin/
as shown below;
ln -s /opt/mssql-tools/bin/sqlcmd /usr/bin/
The sqlcmd
is now available under /usr/bin/
.
which sqlcmd /usr/bin/sqlcmd
Connect locally to you MS SQL server as SA and create a sample database;
sqlcmd -S localhost -U SA Password: <SA password created above>
This takes you to sqlcmd prompt, 1>
. Note that an sql statement is not executed until you enter GO
.
1> CREATE DATABASE testdbA 2> GO 1>
Verify the test database creation.
1> select name from sys.databases 2> go
That is all about how to install Microsoft SQL Server 2017 on Fedora 29/CentOS 7. If you need to learn more on MS SQL statements, look here. We hope this article helps.
you could also open the firewall by using:
firewall-cmd –add-service=mssql –permanent
as it has a configuration in /usr/lib/firewalld/services/mssql.xml