In this short guide we will be performing an installation of Microsoft SQL Server 2019 Developer edition on an Amazon Linux 2 Server. Microsoft SQL Server Developer is a free, full-featured relational database management system licensed for use as a development and test database in a non-production environment.

Follow this guide to quickly install Microsoft SQL Server 2019 on Amazon Linux 2 for storing and retrieving data as requested by your software applications. You can choose to install Microsoft SQL Server 2019 on the same server hosting applications or on dedicated hardware for intensive read and write operations.

SQL Server 2019 Express is also free edition ideal for development and production for desktop, web, and small server applications.

Install Microsoft SQL Server 2019 on Amazon Linux 2

Follow the next steps below to have a running Microsoft SQL Server 2019 on Amazon Linux 2. A repository is provided by Microsoft for Linux Servers.

Step 1: Add Install Microsoft SQL Server 2019 YUM Repository

Add Install Microsoft SQL Server 2019 YUM Repository to your local Amazon Linux 2 Server using the commands below.

sudo curl https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo -o /etc/yum.repos.d/mssql-server-2019.repo
sudo  curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/msprod.repo

You can validate the contents added to the file /etc/yum.repos.d/mssql-server-2019.repo.

$ cat /etc/yum.repos.d/mssql-server-2019.repo
$ cat  /etc/yum.repos.d/msprod.repo

Step 2: Install Microsoft SQL Server 2019 on Amazon Linux 2

Once the repository has been added, proceed to install Microsoft SQL Server 2019 on Amazon Linux 2:

sudo  yum -y install mssql-server mssql-tools unixODBC-devel

Accept license prompts when requested during installation.

Do you accept the license terms? (Enter YES or NO)
YES

Step 3: Configure Microsoft SQL Server 2019 on Amazon Linux 2

You can now run the initial setup of Microsoft SQL Server 2019 on Amazon Linux 2 server.

$ sudo /opt/mssql/bin/mssql-conf setup

You choose the Developer or Express Edition. They’re both free only that Developer should not be used in Production environments.

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) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
  7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
  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=2109348&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): 3

Accept License terms.

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

Set Admin Password:

Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:

If all went as expected the configuration should be successful.

Configuring SQL Server...

The licensing PID was successfully processed. The new edition is [Express Edition].
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.

Check if database service is running.

$ 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 Thu 2020-10-15 05:24:22 UTC; 52s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 26422 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─26422 /opt/mssql/bin/sqlservr
           └─26451 /opt/mssql/bin/sqlservr

Oct 15 05:24:33 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:33.34 spid25s     Server is listening on [ 127.0.0.1 <ipv4> 1431].
Oct 15 05:24:33 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:33.35 spid25s     SQL Server is now ready for client connect...uired.
Oct 15 05:24:33 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:33.75 spid15s     [2]. Feature Status: PVS: 0. CTR: 0. Concu...te: 1.
Oct 15 05:24:33 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:33.76 spid15s     Starting up database 'tempdb'.
Oct 15 05:24:34 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:34.03 spid28s     The Service Broker endpoint is in disabled...state.
Oct 15 05:24:34 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:34.03 spid28s     The Database Mirroring endpoint is in disa...state.
Oct 15 05:24:34 ip-172-31-39-10.eu-west-1.compute.internal sqlservr[26422]: 2020-10-15 05:24:34.05 spid28s     Service Broker manager has started.

Update your bashrc file with binaries path.

echo 'export PATH=$PATH:/opt/mssql-tools/bin' > ~/.bashrc

Source the file.

source ~/.bashrc

If you have Firewalld service and remote hosts needs to connect to the SQL Server, allow service port as shown below.

sudo firewall-cmd --add-port=1433/tcp --permanent
sudo  firewall-cmd --reload

Connect to the Microsoft SQL Server 2019 on Amazon Linux 2 to verify it is working:

$ sqlcmd -S localhost -U SA
Password:

Show current active user.

1> select current_user;
2> go

--------------------------------------------------------------------------------------------------------------------------------
dbo

(1 rows affected)
1> quit

You can optionally enable SQL Server Agent to run scheduled jobs.

$ sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true

Restart SQL Server in order to apply this setting.

sudo systemctl restart mssql-server

You now have a working installation of Microsoft SQL Server 2019 on Amazon Linux 2. Check other guides we have on Amazon Linux 2.

How To Install Tomcat 9 on Amazon Linux 2

Install GitLab CE on Amazon Linux 2 with Let’s Encrypt SSL

How To Install InfluxDB on Amazon Linux 2

How To Install Grafana 7 on Amazon Linux 2

LEAVE A REPLY

Please enter your comment!
Please enter your name here

four + fourteen =