Microsoft makes this super easy, and @scottalanmiller has posted about this once back in 2017.
First, as always when I write something, start with the minimal install. In this case, of CentOS 7, as Microsoft only supports the LTS model of operating systems. Their listed Ubuntu version is old. Also, you all know how much I love Ubuntu.
Second, make sure your system is fully up to date.
yum update -y
Note: You do not need the EPEL.
Now you are ready to go.
Go get the SQL Server repository from Microsoft.
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo

Install SQL Server with yum
sudo yum install -y mssql-server



Then as instructed run the setup wizard.
sudo /opt/mssql/bin/mssql-conf setup
You will be prompted to choose your version.
Choose the version you want. For this guide we are selecting 3) Express.

You will then have to agree to the license terms.

Now enter the sa user password you want for SQL Server
The sa account is equivalent to the root account in MariaDB/MySQL

You should see it was successfully completed.
That's it, you are up and running.

While you may be up and running now, you will also need to do a few more things to make it useful.
Allow inbound connections through the firewall to the server if needed.
In my case, I will have a remote server talking to this and I use Azure Data Studio form a Linux Desktop to access this.
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

Add the Microsoft command line tools so you can locally manage the instance.
This is a separate repository file from SQL Server itself.
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo

Install the tools.
sudo yum install -y mssql-tools unixODBC-devel

There are again license agreements to be agreed to.

If you want to use the tools without typing the full bath, add them to your path.
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
You now have access to sqlcmd

You can connect to the local instance like this. You will be prompted for your password.
sqlcmd -U sa

You can pass the password with the -P parameter.
sqlcmd -U sa -P 'YourSuperSecretPassword'
Note the single quotes. I always use them to ensure even if you have a special character, that the password is accepted when passed this way.
