To configure SQL Server on Ubuntu, run the following
commands in a terminal to install the mssql-server package.

Step 1:Import the public repository
GPG keys:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo
apt-key add –

 

Step 2:Register the SQL Server
Ubuntu repository:

cd /etc/apt/sources.list.d/

wget https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list

If you want to install a different version of SQL Server, see
the SQL
Server 2017 (14.x)
 or SQL
Server 2022 (16.x)
 versions of this
article.

Step 3:Run the following commands to
install SQL Server:
sudo apt-get update
sudo apt-get install -y mssql-server

 

Step 4:After the package
installation finishes,
run mssql-conf setup and follow the prompts to set the SA password
and choose your edition. As a reminder, the following SQL Server editions are
freely licensed: Evaluation, Developer, and Express.
sudo /opt/mssql/bin/mssql-conf setup

Remember to specify a strong password for the SA account. You need a minimum
length 8 characters, including uppercase and lowercase letters, base-10 digits
and/or non-alphanumeric symbols.

Step 5:Once the configuration is
done, verify that the service is
running:
systemctl enable mssql-server

systemctl start mssql-server

systemctl status mssql-server

 

If you
plan to connect remotely, you might also need to open the SQL Server TCP port
(default 1433) on your firewall.

At this point, SQL Server is running on your Ubuntu
machine and is ready to use!

作者 uoscn