Jump to content

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

Featured Replies

Posted
comment_89

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

For 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'

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now