发现搜到的都是在线下载安装的,都是只安装了mssql-server服务,没有mssql-server-agent服务。还以为linux下mssql没有agent服务呢。一番测试发现可以脱机安装,但是能找到的文章对于的rpm包在微软官网的位置改变了,所以最好每次都去上级目录看看。

1. 环境

Linux: CentOS Linux release 7.5
Memory: 4 GB
SQL Server: SQL Server 2017 (RC2) - 14.0.900.75 (X64)
 
 

2. 安装mssql-server

2.1 下载rpm包

[root@134test /opt]# mkdir -p /opt/sqlserver2017
[root@134test /opt]# cd /opt/sqlserver2017/
[root@134test /opt]# wget https://packages.microsoft.com/rhel/7/mssql-server-2017/mssql-server-14.0.3015.40-1.x86_64.rpm

 
发现centos7.5连wget都没有,于是 yum install wget进行安装。

2.2 yum安装

[root@134test /opt/sqlserver2017]# yum localinstall mssql-server-14.0.3015.40-1.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Examining mssql-server-14.0.900.75-1.x86_64.rpm: mssql-server-14.0.900.75-1.x86_64
Marking mssql-server-14.0.900.75-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 0:14.0.900.75-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================
 Package                             Arch                          Version                                 Repository                                                 Size
===========================================================================================================================================================================
Installing:
 mssql-server                        x86_64                        14.0.900.75-1                           /mssql-server-14.0.900.75-1.x86_64                        870 M

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

Total size: 870 M
Installed size: 870 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mssql-server-14.0.900.75-1.x86_64                                                                                                                       1/1

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

Verifying  : mssql-server-14.0.900.75-1.x86_64                                                                                                                       1/1

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

Complete!

 

2.3 配置

[root@134test /opt/mssql/bin]# /opt/mssql/bin/mssql-conf setup
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 [40] days left in the evaluation period.
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.

 
注意评估版本有使用期限。
 

2.4 验证服务

[root@134test /opt/mssql/bin]# 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 Thu 2017-12-14 18:25:03 CST; 1min 23s ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 56504 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─56504 /opt/mssql/bin/sqlservr
           └─56525 /opt/mssql/bin/sqlservr

Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.36 Server      Server is listening on [ ::1 <ipv6> 1434].
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.37 Server      Server is listening on [ 127.0.0.1 <ipv4> 1434].
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.37 Server      Dedicated admin connection support was established for listening locally on port 1434.
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.38 spid19s     SQL Server is now ready for client connections. This is an informational message; ... required.
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.42 spid9s      Starting up database 'tempdb'.
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.61 spid9s      The tempdb database has 1 data file(s).
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.61 spid20s     The Service Broker endpoint is in disabled or stopped state.
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.62 spid20s     The Database Mirroring endpoint is in disabled or stopped state.
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.62 spid20s     Service Broker manager has started.
Dec 14 18:25:10 134test sqlservr[56504]: 2017-12-14 18:25:10.63 spid6s      Recovery is complete. This is an informational message only. No user action is required.
Hint: Some lines were ellipsized, use -l to show in full.

2.5 停止、启动或重启 SQL Server 服务
systemctl stop mssql-server
systemctl start mssql-server
systemctl restart mssql-server

2.6 日志文件
/var/opt/mssql/log/errorlog

3. 安装 sqlcmd 和 bcp SQL Server 命令行工具

3.1 下载

wget https://packages.microsoft.com/rhel/7.3/prod/msodbcsql-13.1.6.0-1.x86_64.rpm
wget https://packages.microsoft.com/rhel/7.3/prod/mssql-tools-14.0.5.0-1.x86_64.rpm

3.2 安装

yum localinstall msodbcsql-13.1.6.0-1.x86_64.rpm
yum localinstall mssql-tools-14.0.5.0-1.x86_64.rpm

3.3 添加到环境变量

[root@134test /opt]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
[root@134test /opt]# source ~/.bash_profile
[root@134test /opt]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
[root@134test /opt]# source ~/.bashrc

3.4 本地连接

[root@134test /opt/mssql/bin]# sqlcmd -S localhost -U sa
Password:
1> select name from sys.databases;
2> go
name                                                                                                                            
--------------------------------------------------------------------------------------------------------------------------------
master                                                                                                                          
tempdb                                                                                                                          
model                                                                                                                           
msdb

(5 rows affected)
1>
1>create database TestDB;
2>go
1>

1> use TestDB;
2> go
Changed database context to 'TestDB'.
1> create table t1 (id int, cname nvarchar(50))
2> go
1>
1> insert into t1 (id, cname) values (1,'abc');
2> go

(1 rows affected)
1> select * from t1;
2> go
id          cname                                             
----------- --------------------------------------------------
          1 abc

(1 rows affected)
1>

3.5 退出

1> quit

4. 安装SQL Server Agent

4.1 下载

wget https://packages.microsoft.com/rhel/7/mssql-server-2017/mssql-server-agent-14.0.3015.40-1.x86_64.rpm

4.2 安装

[root@134test /opt/sqlserver2017]# yum localinstall mssql-server-agent-14.0.900.75-1.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Examining mssql-server-agent-14.0.900.75-1.x86_64.rpm: mssql-server-agent-14.0.900.75-1.x86_64
Marking mssql-server-agent-14.0.900.75-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mssql-server-agent.x86_64 0:14.0.900.75-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================
 Package                                Arch                       Version                              Repository                                                    Size
===========================================================================================================================================================================
Installing:
 mssql-server-agent                     x86_64                     14.0.900.75-1                        /mssql-server-agent-14.0.900.75-1.x86_64                     8.9 M

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

Total size: 8.9 M
Installed size: 8.9 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mssql-server-agent-14.0.900.75-1.x86_64                                                                                                                 1/1

+--------------------------------------------------------------------------------+
Please restart mssql-server to enable Microsoft SQL Server Agent.
+--------------------------------------------------------------------------------+

Verifying  : mssql-server-agent-14.0.900.75-1.x86_64                                                                                                                 1/1

Installed:
  mssql-server-agent.x86_64 0:14.0.900.75-1

Complete!

5. 在Windows上使用SSMS连接数据库

Figure-1:SSMS连接Linux下的数据库

Figure-2:查询版本信息

SELECT @@VERSION;
GO
Microsoft SQL Server 2017 (RC2) - 14.0.900.75 (X64)
Jul 27 2017 08:53:49
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (CentOS Linux 7 (Core))


Figure-3:查询数据

发现Red Gate部分功能不能使用。rpm包安装无法指定安装目录。

 

6. 参考

 
 
 

CentOS7.5脱机安装SQL Server 2017(NEW)的更多相关文章

  1. CentOS7脱机安装SQL Server 2017

    SQL Server on Linux也发布一段时间了,官方上支持Red Hat, SUSE, Ubuntu.手上没有以上Linux版本,选用了与Red Hat最接近的CentOS7.4来进行安装和测 ...

  2. 在Red Hat Enterprise Linux 7.3上安装SQL Server 2017

    必要条件: 1.在此快速安装过程中,您需要安装SQL Server 2017或SQL Server 2019上Red Hat Enterprise Linux (RHEL) 7.3 +.然后使用sql ...

  3. CentOS随笔 - 5.CentOS7安装Sql Server 2017

    前言 转帖请注明出处: http://www.cnblogs.com/Troy-Lv5/ 开发环境嘛, 作为.Net系Sql Server那是必备的. 听过Sql server可以安装在Linux上了 ...

  4. Linux环境下安装SQL Server 2017

    参考链接 https://docs.microsoft.com/zh-cn/sql/linux/quickstart-install-connect-red-hat?view=sql-server-2 ...

  5. 本地安装SQL Server 2017 Express和Microsoft SQL Server Management Studio 18.1

    sqlserver下载链接:https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 这个安装的是免费版的Express,当然也可 ...

  6. centos7.x中安装SQL Server

    本文内容是采集的好几位博主的博文进行的一个整合,内容更为精准和详尽,以下是我参照的几篇博文地址: 微软官方文档:https://docs.microsoft.com/zh-cn/sql/linux/s ...

  7. 一步一步安装SQL Server 2017

    快速开始: 下载安装文件:https://www.microsoft.com/en-us/sql-server/sql-server-downloads-free-trial 应该选择哪个版本? Th ...

  8. linux / centos 安装SQL Server 2017 设置默认语言与排序规则Chinese_PRC_CI_AS

    安装 安装很简单参照官方教程 https://docs.microsoft.com/zh-cn/sql/linux/quickstart-install-connect-red-hat?view=sq ...

  9. Win10 SQL Server 2017安装教程

    Win10 SQL Server 2017安装教程 1:下载地址 2:开始安装 1:安装环境预备说明 还要注意就是要先下载这个VC++的更新,可以解决服务器安装不上的问题,下载链接 :Microsof ...

随机推荐

  1. eclipse svn插件卸载 重新安装 Subclipse卸载安装 The project was not built since its build path is incomplete This client is too old to work with the working copy at

    安装插件的原则就是,要按照规则,插件与本地的svn版本要一致, 这样子本地和eclipse上面就可以无缝使用,不会出现问题 1.卸载eclipse  svn插件 2,安装新版的svn插件 2.1,下载 ...

  2. 痞子衡嵌入式:飞思卡尔i.MX RT系列MCU启动那些事(3)- Serial Downloader模式(sdphost/MfgTool)

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是飞思卡尔i.MX RT系列MCU的Serial Downloader模式. 在上一篇文章 Boot配置(BOOT Pin, eFUSE) ...

  3. 痞子衡嵌入式:ARM Cortex-M内核那些事(2)- 第一款微控制器

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是第一款Cortex-M微控制器. 1.天生荣耀:ARM Cortex-M处理器由来 ARM公司自2004年推出ARMv7内核架构时,摒弃 ...

  4. Haskell复习笔记(二)

    Haskell中的递归 递归就是定义函数以调用自身的方式,关于递归解决问题的实例有很多,如斐波那契数列,还有汉诺塔问题,递归也正是Haskell中用来解决循环问题的关键. 自定义maxinum函数 m ...

  5. 第49章 令牌端点(Token Endpoint) - Identity Server 4 中文文档(v1.0.0)

    令牌端点可用于以编程方式请求令牌.它支持password,authorization_code,client_credentials,refresh_token和urn:ietf:params:oau ...

  6. Vue开篇之Vue-cli搭建项目

    介绍 Vue.js是一套构建用户界面的渐进式框架.Vue 只关注视图层,采用自底向上增量开发的设计.Vue 的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件. 第一步:安装node ...

  7. 【代码笔记】Web-CSS-CSS background背景

    一,效果图. 二,代码. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

  8. Android Studio调试手机或者安装APK的时候出现install failed test only

    1.检查\app\src\main\AndroidMainfest.xml中是否有testOnly属性为true,如果有去掉或者改为false 2.检查Android Studio和gradle版本是 ...

  9. Python IO编程

    IO在计算机中指Input/Output,也就是输入和输出 一.文件读写 1.读文件 >>> f = open('/Users/michael/test.txt', 'r') --- ...

  10. C#获得指定目录床架时间、更新时间和最后访问时间等信息的代码

    将做工程过程常用的内容片段备份一次,下面的内容内容是关于C#获得指定目录床架时间.更新时间和最后访问时间等信息的内容,希望能对小伙伴们也有用. using System;using System.IO ...