|
具体安装教程,官方都有文档,我只是知识的搬运工,当然本文的意义在于会提供相当详细的步步截图,以帮助你动手前已经在脑子中过一遍,提高信心和成功率。官方教程如下:
1.下载 Microsoft Red Hat 存储库配置文件。(看系统版本7就rhel/7 8就rhel/8)
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo2.输入命令安装 sudo yum install -y mssql-server(这网速想哭有没有)
[root@localhost jw]# sudo yum install -y mssql-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 0:15.0.4083.2-15 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package Arch Version Repository Size
==================================================================================
Installing:
mssql-server
x86_64 15.0.4083.2-15 packages-microsoft-com-mssql-server-2019 210 M
Transaction Summary
==================================================================================
Install 1 Package
Total download size: 210 M
Installed size: 1.0 G
Downloading packages:
mssql-server-15.0.4083.2-1 2% [ ] 45 kB/s | 5.6 MB 01:17:40 ETA3.输入命令进行配置 sudo /opt/mssql/bin/mssql-conf setup
[root@localhost jw]# sudo /opt/mssql/bin/mssql-conf setup
usermod: no changes
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
8) I bought a license through a retail sales channel and have a product key to enter.
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&clcid=0x409
Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.
Enter your edition(1-8): 7
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
The licensing PID was successfully processed. The new edition is [Enterprise Edition: Core-based Licensing].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.
Microsoft Privacy Statement[root@localhost jw]# sudo /opt/mssql/bin/mssql-conf setup
usermod: no changes
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
8) I bought a license through a retail sales channel and have a product key to enter.
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&clcid=0x409
Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.
Enter your edition(1-8): 7
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
The licensing PID was successfully processed. The new edition is [Enterprise Edition: Core-based Licensing].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.
自己玩玩选 developer 没问题,后期也可换。
4.打开1433端口
firewall-cmd --zone=public --add-port=1433/tcp --permanent
firewall-cmd --reload5.设置开机启动
systemctl enable mssql-server6.安装完成,Linux下用Azure Data Studio管理数据库
windows下用SQL Server Management Studio 连接并管理数据库,Linux下就是用Azure Data Studio,这家伙也是跨平台的,现在只要是跨平台的,我都是看着顺眼,未来趋势啊。按惯例附上官方安装教程,授人以渔,学会去官方找资料。

azuredatastudio-linux-1.25.2.deb下载下来deepin下直接双击就安装好了
其他知识小记:
关于存储库版本
在 Linux 上安装 SQL Server 时,须配置 Microsoft 存储库。此存储库用于获取数据库引擎包、mssql-server 以及相关 SQL Server 包 。现有五个主要存储库:
存储库 | 名称 | 说明 | 2019 | mssql-server-2019 | 累积更新 (CU) 存储库。 | 2019 GDR | mssql-server-2019-gdr | GDR 存储库仅用于关键更新。 | 2019 预览版 | mssql-server-preview | SQL Server 2019 预览版和 RC 存储库。 | 2017 | mssql-server-2017 | SQL Server 2017 累积更新 (CU) 存储库。 | 2017 GDR | mssql-server-2017-gdr | SQL Server 2017 GDR 存储库仅用于关键更新。 | 这里要记的就一句:选CU版本
关于离线下载包装,也是支持的,不过要检查依赖包。

下载地址:https://packages.microsoft.com/rhel/7/mssql-server-2019/

这个速度还勉强接受一下
关键版本切换
如果你之前选了developer想改成企业版,只要暂停服务,重新配置就好,选8输入密钥后会根据密钥自动切换版本。
[root@localhost jw]# sudo systemctl stop mssql-server
[root@localhost jw]# sudo /opt/mssql/bin/mssql-conf setup
usermod: no changes
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
8) I bought a license through a retail sales channel and have a product key to enter.
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&clcid=0x409
Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.
Enter your edition(1-8): 8
Enter the 25-character product key: 密钥网上自己找来输入,不要太多
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
The licensing PID was successfully processed. The new edition is [Enterprise Edition].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Setup has completed successfully. SQL Server is now starting.
其他几个命令
systemctl start mssql-server
systemctl restart mssql-server
systemctl stop mssql-server
systemctl status mssql-server |
|