Installing SQL 2019 on LInux (RHEL/CENTOS)

Wish you all a very happy new year folks!  Been a while since I posted something, so here I am 🙂  I would like to begin my blogging in year 2020 with Linux. Long ago, I wrote an article on how to setup a VM with CentOS and install SQL 2017 on top of it. I am not going to walk through those steps again., Instead let’s see if the setup experience is any different from SQL 2017 on RHEL.

Before begin installing, Let me examine repos on my linux machine. you can do that by navigating to /etc/yum.repos.d folder.

Well, this is a brand new installation. That explains all the repositories I have on my machine! Now, It’s time to download SQL Server repo from microsoft.
command: 
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo

Once this part is done, it’s time for actual installation.
Command:
sudo yum install -y mssql-server

Alright, let’s perform the configuration portion(EULA,Edition,sa pwd) as instructed by setup program.
Command:
sudo /opt/mssql/bin/mssql-conf setup

Oops! My configuration failed. you can clearly see the reason why my installation failed. I was way too conservative in terms of granting resources to my VM. Once I bumped up my RAM to 4 GB, all went well.

Check status using either ps-ef | grep mssql-server or systemctl command as shown below.

Now it is time to install client tools on the server. Microsoft has provided a separate repo for client tools which we need to download similar to what we did in step 1.
Command:
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
Note: Check RHEL version (7 or 8) and download appropriate repos.

Don’t forget to add sqlcmd and bcp tools to path to avoid providing literal path every time we need to access sqlcmd. I hope microsoft will take care of this as part of post installation in future releases instead of manual intervention. ( Symbolic links may be??)

Testing what we have done so far…..

That’s it for this blog post folks! As you can see the installation experience hasn’t been changed much from the last version of SQL on Linux!

Note: This is online setup experience, assuming your Linux machine can talk to internet. Microsoft did a great job on documenting online and offline installation methods. I would definitely recommend anyone to go through the documentation for more details.

Happy learning!

Advertisement

Microsoft Loves Linux – Installing SQL Server on Linux

In this blog post, let’s see how to Install SQL Server on Linux. It’s been a while since Microsoft announced SQL on Linux, but I thought of waiting for a while before I set this thing in my lab. With the release of SQL Server 2017 CTP 2.0, It’s about time. Okay ,so let’s get started!

Note: I’ve Centos installed in my lab. That’s where I started learning/exploring Linux. I am installing SQL Server on CentOS (Which is exactly same as RHEL). Every single command shown in this blog post should work on RHEL as well.

Step 1: Connect to Linux machine and download config/repo file using CURL command and verify if it downloaded the file.

As you can see in the above screenshot, I logged in as root user. It’s not required, in fact not recommended to ever login as root user to perform any sort of activities on linux box.(Well, I guess It’s okay sometimes If you are Linux admin and/or you absolutely understand what you are doing 🙂 ). You can just make use of sudo instead. ( As long as you are listed in sudoers file or a member of wheel group, you should be able to use sudo)

Step 2: Now we know that the file exists, lets try installing SQL using YUM Package.  I logged out of root and I am using my regular account “Sreekanth”. See below, It didn’t let me Install SQL because I didn’t have rights to use sudo.

As I mentioned above, I will be adding “Sreekanth” to wheel group by logging in as root again.

Now…logging in as “Sreekanth”, my regular user account, Let’s try it again…

Well, It works. If you notice, it says “Run sudo /opt/mssql/bin/mssql-conf setup to complete setup”…Okay let’s do that. That’s our next step.

Step 3:

This is the step where we accept license terms, set “sa” pwd …all that good stuff.

Done. That’s it guys! I am really impressed how easy it was actually to install SQL Server on Linux. It’s actually way faster than installing SQL on windows box. This entire process took less than 3 minutes for me! Wooohoooo!

Let’s check few other things before wrapping up. Let’s check the status of SQL Server service on our Linux box.

Okay…that confirms SQL service is actually Up and Running. Now, let’s open port 1433 in firewall.

Step 4: Let’s connect to this sql server instance from another client machine. (connect to IP address using the sa account which we provisioned earlier)

I see Agent XPs are disabled. Okay…let’s turn it on.

Give it a shot setting up in your own test area. Trust me, This reaaaaally feels good once you have SQL Server running on your Linux box 🙂  That’s it folks for today! Hope this blog post helps…Later.