签到成功

知道了

CNDBA社区CNDBA社区

RedHat 7.4安装SQL Server

2018-12-29 11:00 3573 0 原创 SQL Server
作者: Expect-乐

RedHat 7.4安装SQL Server

标签(空格分隔): 数据库 SQLServerhttp://www.cndba.cn/Expect-le/article/3211


安装条件

必须是RedHat 7.3或7.4,而且内存至少要2GB。

http://www.cndba.cn/Expect-le/article/3211http://www.cndba.cn/Expect-le/article/3211

内存 文件系统 磁盘空间 CPU频率 CPU核心 CPU类型
2GB XFS或EXT4 (其他文件系统,如BTRFS,均不受支持) 6 GB 2GHz 2个核心 仅兼容X64

如果使用网络文件系统 (NFS) 在生产中,远程共享,请注意以下支持要求:

http://www.cndba.cn/Expect-le/article/3211http://www.cndba.cn/Expect-le/article/3211

  • 使用 NFS 版本4.2 或更高版本。 较旧版本的 NFS 不支持所需的功能,例如 fallocate 和稀疏文件创建,普遍适用于现代文件系统。
  • 仅定位 /var/opt/mssql上 NFS 装入的目录。 不支持其他文件,如 SQL Server 系统二进制文件。
  • 请确保装载的远程共享时,NFS 客户端,使用 nolock 选项。

安装

  • 1.通过YUM来安装,首先配置YUM源,以下是安装SQL Server 2017.要确保本地机器已连接外网。

    [root@test ~]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    100   232  100   232    0     0    893      0 --:--:-- --:--:-- --:--:--   892
    You have mail in /var/spool/mail/root
    

    如果想安装SQL Server 2019,则需要改为2019预览版:http://www.cndba.cn/Expect-le/article/3211http://www.cndba.cn/Expect-le/article/3211

    https://packages.microsoft.com/config/rhel/7/mssql-server-preview.repo

    http://www.cndba.cn/Expect-le/article/3211

  • 2.安装
    通过yum来安装

[root@test ~]# yum install -y mssql-server
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml"
Trying other mirror.
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 0:14.0.3048.4-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================================
 Package                                     Arch                                  Version                                       Repository                                                               Size
===============================================================================================================================================================================================================
Installing:
 mssql-server                                x86_64                                14.0.3048.4-1                                 packages-microsoft-com-mssql-server-2017                                169 M

Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package

Total download size: 169 M
Installed size: 169 M
Downloading packages:
No Presto metadata available for packages-microsoft-com-mssql-server-2017
warning: /var/cache/yum/x86_64/7Server/packages-microsoft-com-mssql-server-2017/packages/mssql-server-14.0.3048.4-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEYs | 168 MB  00:00:00 ETA
Public key for mssql-server-14.0.3048.4-1.x86_64.rpm is not installed
mssql-server-14.0.3048.4-1.x86_64.rpm                                                                                                                                                   | 169 MB  00:02:00
Retrieving key from https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
 Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
 From       : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mssql-server-14.0.3048.4-1.x86_64                                                                                                                                                           1/1

+--------------------------------------------------------------+
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
+--------------------------------------------------------------+

SQL Server needs to be restarted in order to apply this setting. Please run
'systemctl restart mssql-server.service'.
  Verifying  : mssql-server-14.0.3048.4-1.x86_64                                                                                                                                                           1/1

Installed:
  mssql-server.x86_64 0:14.0.3048.4-1

Complete!
  • 3.设置sa密码及选择相应的版本
    版本:Evaluation、 Developer 和 Express
[root@test ~]# /opt/mssql/bin/mssql-conf setup
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)
  7) Enterprise Core (PAID)
  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=852748&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): 2
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Do you accept the license terms? [Yes/No]:yes

Enter the SQL Server system administrator password:
The specified password does not meet SQL Server password policy requirements because it is too short. The password must be at least 8 characters
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...

sqlservr: This program requires a machine with at least 2000 megabytes of memory.
Initial setup of Microsoft SQL Server failed. Please consult the ERRORLOG
in /var/opt/mssql/log for more information.

注:生产环境要确保为 SA 帐户指定强密码(最少8个字符,包括大写和小写字母、十进制数字和/或非字母数字符号)。

  • 4.查看数据库状态
    注意一定要是7.3或7.4版本,否则数据库启动报错。
[root@sqlserver rpm]# systemctl status mssql-server
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2018-12-29 10:42:38 CST; 19s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 13293 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─13293 /opt/mssql/bin/sqlservr
           └─13325 /opt/mssql/bin/sqlservr

Dec 29 10:42:43 sqlserver sqlservr[13293]: 2018-12-29 10:42:43.83 spid6s      8 transactions rolled forward in database 'msdb' (4:0). This is an informational message only. No user action is required.
Dec 29 10:42:44 sqlserver sqlservr[13293]: 2018-12-29 10:42:43.99 spid6s      0 transactions rolled back in database 'msdb' (4:0). This is an informational message only. No user action is required.
Dec 29 10:42:44 sqlserver sqlservr[13293]: 2018-12-29 10:42:44.02 spid9s      Polybase feature disabled.
Dec 29 10:42:44 sqlserver sqlservr[13293]: 2018-12-29 10:42:44.02 spid9s      Clearing tempdb database.
Dec 29 10:42:44 sqlserver sqlservr[13293]: 2018-12-29 10:42:44.56 spid9s      Starting up database 'tempdb'.
Dec 29 10:42:45 sqlserver sqlservr[13293]: 2018-12-29 10:42:45.10 spid9s      The tempdb database has 1 data file(s).
Dec 29 10:42:45 sqlserver sqlservr[13293]: 2018-12-29 10:42:45.17 spid16s     The Service Broker endpoint is in disabled or stopped state.
Dec 29 10:42:45 sqlserver sqlservr[13293]: 2018-12-29 10:42:45.18 spid16s     The Database Mirroring endpoint is in disabled or stopped state.
Dec 29 10:42:45 sqlserver sqlservr[13293]: 2018-12-29 10:42:45.36 spid16s     Service Broker manager has started.
Dec 29 10:42:45 sqlserver sqlservr[13293]: 2018-12-29 10:42:45.37 spid6s      Recovery is complete. This is an informational message only. No user action is required.
  • 5.开放端口
    如果要远程连接,那么需要开放默认的 SQL Server 端口为 TCP 1433。 如果对防火墙使用 FirewallD,可以使用以下命令:
    [root@sqlserver rpm]# firewall-cmd --zone=public --add-port=1433/tcp --permanent
    success
    [root@sqlserver rpm]# firewall-cmd --reload
    success
    

至此,已经成功安装了SQL Server 2017了。http://www.cndba.cn/Expect-le/article/3211http://www.cndba.cn/Expect-le/article/3211

版权声明:本文为博主原创文章,未经博主允许不得转载。

RedHat 7.4 SQLServer

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
Expect-乐

Expect-乐

关注

Without the continuous bitter cold, there can be no fragrant plum blossom

  • 336
    原创
  • 6
    翻译
  • 100
    转载
  • 41
    评论
  • 访问:1547816次
  • 积分:1957
  • 等级:核心会员
  • 排名:第4名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ