This is Our Old blog with useful tutorials, We'll start posting tutorial In forum soon, please use this forum as blog is discontinued but will not been taken down Link to Forum
aapanelCentosControl PanelCWPLinux

How to Install MSSQL Express Server In CWP/Centos 7/8 Stream/Almalinux/Rockylinux

In this tutorial we’ll learn how to install MSSQL express server in centos/EL 7/8 stream OS easily. Microsoft SQL Server Express is a version of Microsoft’s SQL Server relational database management system that is free to download, distribute and use. It comprises a database specifically targeted for embedded and smaller-scale applications.

To install MSSQL express edition follow the below steps :

First install some dependencies :-

yum install python2 compat-openssl10 openssl-devel

Second make python 2 default alternative interpreter :

alternatives --config python

Third Microsoft MSSQL repo :

For Centos 7/EL7 :

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

or Centos 8/EL8/AlmaLinux/RockyLinux :

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

Fourth Install MSSQL express server :

yum install mssql-server

Fifth Run mssql-conf via below command and choose the Express edition and accept the licensing and terms by typing “yes” :

/opt/mssql/bin/mssql-conf setup

** choose “Express” by typing the number you see Infront of it, also choose/enter the password fo “SA” user

Sixth enable MSSQL to run on boot :

systemctl enable mssql-server

you can restart, start and stop mssql-server as below :

systemctl start mssql-server
systemctl stop mssql-server
systemctl restart mssql-server

Install the SQL Server command-line tools

To install sqlcmd follow this :

For Centos 7/EL7 :

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

Ftos 8/EL8/AlmaLinux/RockyLinux :

curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo

Then install the sqlcmd tool :

yum remove unixODBC-utf16 unixODBC-utf16-devel -y && yum install mssql-tools unixODBC-devel -y

Now set the environment variable :

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

Now update the current shell environment :

source ~/.bashrc

example :

you can connect to SA user with below command :

sqlcmd -S localhost -U SA -P 'YourPassword'

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

2 Comments

  1. hello Sandeep ,
    thank you for all posts you make
    are you ok ? longtime you don’t post anything i hope you doing well

    have a good day.

Back to top button