1、添加 Microsoft 的 yum 存储库
[root@iZ22312ginudnbnifn438Z ~]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo |
这里地址一定要选择https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo
我查看了网上的按照https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo来安装最后发现启动报
/opt/mssql/bin/sqlservr: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /opt/mssql/bin/sqlservr)
/opt/mssql/bin/sqlservr: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /opt/mssql/bin/../lib/libc++abi.so.1)
最后在microsoft社区才找到了解决方法,意思是在MS官方文档中,SQL Server 2019的示例命令指向RHEL 8存储库。请确保在示例命令中将路径更改为/rhel/7,而不是/rhel/8。最后将路径改为/rhel/7就可以启动了(可能还有别的原因,就没有仔细研读,还有别的解决方法大家可以在评论区发表)
2、安装 mssql-server 包
[root@iZ22312ginudnbnifn438Z ~]# sudo yum install -y mssql-server |
3、执行 SQL Server 初始化操作
[root@iZ22312ginudnbnifn438Z ~]# sudo /opt/mssql/bin/mssql-conf setup |
4、选择所要安装的 SQL Server 版本(我选择了免费开发版本)
[root@iZ22312ginudnbnifn438Z ~]# sudo /opt/mssql/bin/mssql-conf setup Details about editions can be found at Use of PAID editions of this software requires separate licensing through a Enter your edition(1-8): 2 The privacy statement can be viewed at: Do you accept the license terms? [Yes/No]:y Enter the SQL Server system administrator password: |
5、设置 sa
账号密码(两次需要一致并且密码必须由字母数字特殊符号)
Enter the SQL Server system administrator password: Confirm the SQL Server system administrator password: |
设置完成后如果没有问题会自动启动成功,再有别的问题那就需要再排查了,哈哈