Installing MS SQL Server Express on CentOS
-
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 ServerThe
sa
account is equivalent to theroot
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.
-
If anyone is curious, you do not have to tell it to start on boot as the setup step does that. You can see it linking the service in the screenshot.
-
And screw you Microsoft...
I had to manually type
yes
twice during ayum update -y
-
@JaredBusch that's ridiculous
-
@JaredBusch said in Installing MS SQL Server Express on CentOS:
And screw you Microsoft...
I had to manually type
yes
twice during ayum update -y
They've screwed up the update process on Fedora? Guess I probably shouldn't be surprised.
-
@travisdh1 said in Installing MS SQL Server Express on CentOS:
@JaredBusch said in Installing MS SQL Server Express on CentOS:
And screw you Microsoft...
I had to manually type
yes
twice during ayum update -y
They've screwed up the update process on Fedora? Guess I probably shouldn't be surprised.
SQL Server only works on CentOS 7 at the moment. Almost work on Fedora, but not quite.
-
excellent guide. :thumbs_up:
-
@JaredBusch said in Installing MS SQL Server Express on CentOS:
And screw you Microsoft...
I had to manually type
yes
twice during ayum update -y
I wonder if that affects yum-cron auto update schedule?
-
@black3dynamite said in Installing MS SQL Server Express on CentOS:
@JaredBusch said in Installing MS SQL Server Express on CentOS:
And screw you Microsoft...
I had to manually type
yes
twice during ayum update -y
I wonder if that affects yum-cron auto update schedule?
How could it not?
-
@JaredBusch said in Installing MS SQL Server Express on CentOS:
@black3dynamite said in Installing MS SQL Server Express on CentOS:
@JaredBusch said in Installing MS SQL Server Express on CentOS:
And screw you Microsoft...
I had to manually type
yes
twice during ayum update -y
I wonder if that affects yum-cron auto update schedule?
How could it not?
Yeah, has to break basic systems management and management practices. It would break Windows updates, too.
-
LEt me guess it is much faster on Linux than on Windows server, can you manage it using SQL server manager on Windows machine >?
-
@Emad-R said in Installing MS SQL Server Express on CentOS:
can you manage it using SQL server manager on Windows machine >?
Of course you can SSMS doens't care where the instance is. It doens't even know WHAT the instance is running on. It only connects to SQL.
I use Azure Data Studio on Linux and Windows instead of SSMS unless I need to do core management tasks that I don't know the SQL for (which most of those tasks I don't )
-
@Emad-R said in Installing MS SQL Server Express on CentOS:
Et me guess it is much faster on Linux than on Windows server
No idea, but it is one less Windows Server license needed.
Also MS SQL Server Express works well for many tasks.