百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程字典 > 正文

在 Linux 上安装 SQL Server 2017

toyiye 2024-09-07 00:42 1 浏览 0 评论

概述

通过将平台抽象层 (PAL) 引入 SQL Server,Linux 上的 SQL Server 成为可能。PAL 将所有操作系统特定代码集中在一处,并允许其余代码保持独立于操作系统。PAL 是 Microsoft 研究项目 Drawbridge 的成果。目前,Red Hat Enterprise Server、SUSE Linux Enterprise Server 和 Ubuntu 支持 SQL Server。它还支持在 Docker 容器中运行。

SQL Server for Linux版本,可以在某些Linux发行版上直接安装和运行。但是有一些具体系统要求,首先,确保你的Linux发行版满足SQL Server的要求。例如,SQL Server 2017要求操作系统为Red Hat Enterprise Linux(RHEL)7.3或Ubuntu 16.04 LTS,而SQL Server 2019要求操作系统为RHEL 8.0、SUSE Linux Enterprise Server(SLES)15或Ubuntu 18.04 LTS。

本文将阐述在 Linux 上安装 SQL Server 2017的具体过程。

为什么应该在 Linux 上运行 SQL Server?

企业需求:Linux 上的 SQL Server 为企业关键功能(例如使用针对 Linux 操作系统的开源集群机制的 AlwaysOn 可用性组的高可用性和灾难恢复)提供了一个可靠的平台。AlwaysOn 配置还可以将节点与 Linux 和 Windows 操作系统混合。AlwaysOn 可用性组可以帮助您的应用程序满足强大的业务连续性要求。

降低运营成本:组织在 Linux 上使用 SQL Server 时可以实现运营成本的降低。SQL Server 许可证允许它根据架构的需要在 Windows、Linux 或 Docker 上使用。跨平台的许可模型,允许在多操作系统环境中提供 SQL Server 功能。SQL Server 在 Windows 和 Linux 上的许可方式相同,例如,运行在windows上的现有许可证可以转移到 Linux,无需额外费用。

性能:与运行在 Windows 操作系统相比,Linux 上的 SQL Server 性能应该相当或更好。

简单性:Linux 上的 SQL Server 允许 SQL Server DBA 和开发人员使用现有工具和脚本执行日常任务,而无需关注其中的差异。在 Windows 上运行的所有核心数据库功能在 Linux 中也可用。但是,某些依赖于 Windows 功能的 SQL Server 功能将不可用。可以在此处找到不受支持的功能的列表。

安装和维护:在Linux上命令行安装SQL Server、补丁比Windows上相对要快。这使得企业能够节省代价高昂的停机时间。较旧版本的 SQL Server(例如 SQL Server 2008 或 2008 R2)可以轻松升级到 Linux 上较新版本的 SQL Server。

非生产环境一键完成:利用 docker 容器来配置非生产数据库环境,使开发人员和 DBA 能够立即执行测试。

安装过程

步骤 1:下载 Microsoft SQL Server Red Hat 存储库配置文件:

  • 以 root 用户身份运行以下命令:
curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo

第 2 步:安装 SQL Server:

yum -y install mssql-server

步骤 3:设置 SQL Server :

/opt/mssql/bin/mssql-conf setup
  • 安装程序将提示输入版本类型和 sa 密码,请在命令提示符上提供相关的信息。
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=852741&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
 
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) 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-7): 2
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
 
This is an evaluation version.  There are [132] days left in the evaluation period.
Setup has completed successfully. SQL Server is now starting.

这样就完成了 Linux 上的 SQL Server 安装,您可以通过以下命令检查 SQL Server 服务和进程:

  • 检查服务
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 Wed 2017-09-13 13:40:54 BST; 6min ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 6017 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─6017 /opt/mssql/bin/sqlservr
           └─6048 /opt/mssql/bin/sqlservr
 
Sep 13 13:41:08 dbalab1 sqlservr[6017]: 2017-09-13 13:41:08.95 spid6s      8 transactions rolled forward in database 'msdb' (4:0). This is an informat... required.
Sep 13 13:41:09 dbalab1 sqlservr[6017]: 2017-09-13 13:41:09.06 spid9s      Polybase feature disabled.
Sep 13 13:41:09 dbalab1 sqlservr[6017]: 2017-09-13 13:41:09.06 spid9s      Clearing tempdb database.
Sep 13 13:41:09 dbalab1 sqlservr[6017]: 2017-09-13 13:41:09.10 spid6s      0 transactions rolled back in database 'msdb' (4:0). This is an information... required.
Sep 13 13:41:09 dbalab1 sqlservr[6017]: 2017-09-13 13:41:09.73 spid9s      Starting up database 'tempdb'.
Sep 13 13:41:10 dbalab1 sqlservr[6017]: 2017-09-13 13:41:10.19 spid9s      The tempdb database has 1 data file(s).
Sep 13 13:41:10 dbalab1 sqlservr[6017]: 2017-09-13 13:41:10.20 spid22s     The Service Broker endpoint is in disabled or stopped state.
Sep 13 13:41:10 dbalab1 sqlservr[6017]: 2017-09-13 13:41:10.21 spid22s     The Database Mirroring endpoint is in disabled or stopped state.
Sep 13 13:41:10 dbalab1 sqlservr[6017]: 2017-09-13 13:41:10.32 spid22s     Service Broker manager has started.
Sep 13 13:41:10 dbalab1 sqlservr[6017]: 2017-09-13 13:41:10.46 spid6s      Recovery is complete. This is an informational message only. No user action is required.
  • 检查进程
ps -ef | grep sqlservr | grep -v grep
 
mssql     6017     1  0 13:40 ?        00:00:01 /opt/mssql/bin/sqlservr
mssql     6048  6017  8 13:40 ?        00:00:31 /opt/mssql/bin/sqlservr
  • 检查端口
netstat -tulpn | grep 1433
tcp    0   0 0.0.0.0:1433      0.0.0.0:*        LISTEN   6048/sqlservr
tcp6    0   0 :::1433         :::*          LISTEN   6048/sqlservr

步骤 4:连接到 SQL Server 实例:

要进行连接,您首先需要安装 mssql-tools(sqlcmd 和 bcp),可以通过执行以下命令来安装:

下载:

curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo

安装:

yum install -y mssql-tools unixODBC-devel

Mssq-tools 现已安装,但要使用它们,请将 mssql-tools 二进制文件添加到您的路径中:

export PATH="$PATH:/opt/mssql-tools/bin"

如果永久生效,请把mssql-tools 二进制文件加入用户的bash_profile文件或/etc/profile:

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile

完成此操作后,您可以通过执行以下命令连接到 SQL Server 实例:-

sqlcmd -S localhost -U SA -P ''

第 5 步:现在要允许远程连接(通过您最喜欢的 SSMS 连接),您需要禁用防火墙,这可以通过以下方式实现:

禁用防火墙:

systemctl disable firewalld

或者允许端口 1433:

firewall-cmd --zone=public --add-port=1433/tcp --permanent``firewall-cmd --reload

第6步:安装SQL Server代理

yum install mssql-server-agent
systemctl restart mssql-server



相关推荐

# Python 3 # Python 3字典Dictionary(1)

Python3字典字典是另一种可变容器模型,且可存储任意类型对象。字典的每个键值(key=>value)对用冒号(:)分割,每个对之间用逗号(,)分割,整个字典包括在花括号({})中,格式如...

Python第八课:数据类型中的字典及其函数与方法

Python3字典字典是另一种可变容器模型,且可存储任意类型对象。字典的每个键值...

Python中字典详解(python 中字典)

字典是Python中使用键进行索引的重要数据结构。它们是无序的项序列(键值对),这意味着顺序不被保留。键是不可变的。与列表一样,字典的值可以保存异构数据,即整数、浮点、字符串、NaN、布尔值、列表、数...

Python3.9又更新了:dict内置新功能,正式版十月见面

机器之心报道参与:一鸣、JaminPython3.8的热乎劲还没过去,Python就又双叒叕要更新了。近日,3.9版本的第四个alpha版已经开源。从文档中,我们可以看到官方透露的对dic...

Python3 基本数据类型详解(python三种基本数据类型)

文章来源:加米谷大数据Python中的变量不需要声明。每个变量在使用前都必须赋值,变量赋值以后该变量才会被创建。在Python中,变量就是变量,它没有类型,我们所说的"类型"是变...

一文掌握Python的字典(python字典用法大全)

字典是Python中最强大、最灵活的内置数据结构之一。它们允许存储键值对,从而实现高效的数据检索、操作和组织。本文深入探讨了字典,涵盖了它们的创建、操作和高级用法,以帮助中级Python开发...

超级完整|Python字典详解(python字典的方法或操作)

一、字典概述01字典的格式Python字典是一种可变容器模型,且可存储任意类型对象,如字符串、数字、元组等其他容器模型。字典的每个键值key=>value对用冒号:分割,每个对之间用逗号,...

Python3.9版本新特性:字典合并操作的详细解读

处于测试阶段的Python3.9版本中有一个新特性:我们在使用Python字典时,将能够编写出更可读、更紧凑的代码啦!Python版本你现在使用哪种版本的Python?3.7分?3.5分?还是2.7...

python 自学,字典3(一些例子)(python字典有哪些基本操作)

例子11;如何批量复制字典里的内容2;如何批量修改字典的内容3;如何批量修改字典里某些指定的内容...

Python3.9中的字典合并和更新,几乎影响了所有Python程序员

全文共2837字,预计学习时长9分钟Python3.9正在积极开发,并计划于今年10月发布。2月26日,开发团队发布了alpha4版本。该版本引入了新的合并(|)和更新(|=)运算符,这个新特性几乎...

Python3大字典:《Python3自学速查手册.pdf》限时下载中

最近有人会想了,2022了,想学Python晚不晚,学习python有前途吗?IT行业行业薪资高,发展前景好,是很多求职群里严重的香饽饽,而要进入这个高薪行业,也不是那么轻而易举的,拿信工专业的大学生...

python学习——字典(python字典基本操作)

字典Python的字典数据类型是基于hash散列算法实现的,采用键值对(key:value)的形式,根据key的值计算value的地址,具有非常快的查取和插入速度。但它是无序的,包含的元素个数不限,值...

324页清华教授撰写【Python 3 菜鸟查询手册】火了,小白入门字典

如何入门学习python...

Python3.9中的字典合并和更新,了解一下

全文共2837字,预计学习时长9分钟Python3.9正在积极开发,并计划于今年10月发布。2月26日,开发团队发布了alpha4版本。该版本引入了新的合并(|)和更新(|=)运算符,这个新特性几乎...

python3基础之字典(python中字典的基本操作)

字典和列表一样,也是python内置的一种数据结构。字典的结构如下图:列表用中括号[]把元素包起来,而字典是用大括号{}把元素包起来,只不过字典的每一个元素都包含键和值两部分。键和值是一一对应的...

取消回复欢迎 发表评论:

请填写验证码