CentOS7離線安裝SQL Server 2017

来源:http://www.cnblogs.com/fishparadise/archive/2017/12/18/8057650.html
-Advertisement-
Play Games

SQL Server on Linux也發佈一段時間了,官方上支持Red Hat, SUSE, Ubuntu。手上沒有以上Linux版本,選用了與Red Hat最接近的CentOS7.4來進行安裝和測試。 1. 環境 Linux: CentOS Linux release 7.4.1708 (Cor ...


SQL Server on Linux也發佈一段時間了,官方上支持Red Hat, SUSE, Ubuntu。手上沒有以上Linux版本,選用了與Red Hat最接近的CentOS7.4來進行安裝和測試。

 

1. 環境

Linux: CentOS Linux release 7.4.1708 (Core) 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/mssql-server-14.0.900.75-1.x86_64.rpm

 

2.2 yum安裝

[root@134test /opt/sqlserver2017]# yum localinstall mssql-server-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-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/mssql-server-agent-14.0.900.75-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. 參考

https://www.microsoft.com/en-us/sql-server/sql-server-2017
https://docs.microsoft.com/zh-cn/sql/linux/quickstart-install-connect-red-hat
https://packages.microsoft.com/rhel/7/mssql-server/
https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-troubleshooting-guide        
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 引言 在上一篇 "大數據學習系列之四 Hadoop+Hive環境搭建圖文詳解(單機)" 和之前的 "大數據學習系列之二 HBase環境搭建(單機)" 中成功搭建了Hive和HBase的環境,併進行了相應的測試。本文主要講的是如何將Hive和HBase進行整合。 Hive和HBase的通信意圖 Hiv ...
  • 一 前言 一直對InnoDB引擎的啟動過程不太瞭解,查資料整理了下InnoDB引擎啟動的過程和關閉過程,後續會整理些有關redo undo 的知識點。 二 思維導圖 三 參考文章 MySQL運維內參 ...
  • SQL Select 語句完整的執行順序:1、from 子句組裝來自不同數據源的數據;2、where 子句基於指定的條件對記錄行進行篩選;3、group by 子句將數據劃分為多個分組;4、使用聚集函數進行計算;5、使用 having 子句篩選分組;6、計算所有的表達式;7、select 的欄位;8... ...
  • 序列 是資料庫生成的一系列數值 1 2 3 4 用於實現id 自增長使用 mySql 實現id 自增長 設置 auto_increment oracle資料庫 藉助於序列 創建序列語法 create sequence 序列名 序列的屬性 nextval --下一個值 currval --當前值 特點... ...
  • 這個系列大致想跟大家分享以下篇章: 1、mongo 3.4分片集群系列之一:淺談分片集群 2、mongo 3.4分片集群系列之二:搭建分片集群--哈希分片 3、mongo 3.4分片集群系列之三:搭建分片集群--哈希分片 + 安全 4、mongo 3.4分片集群系列之四:搭建分片集群--哈希分片 + ...
  • 事務(Transaction):ts,一般是指要做的或所做的事情。 例如:轉賬問題。 mysql> create table ac (id int primary key auto_increment, -> ac_name char(10),ac_money int); Query OK, 0 r ...
  • 好記性不如爛筆頭,給自己不中用的大腦寫點東西,省的每次都要去扒。 查詢 單表查詢 SELECT column_name,column_nameFROM table_name; #去重SELECT DISTINCT column_nameFROM table_name; tips:去重可以單列也可以多 ...
  • [20171218]varchar2(4000)如何保存.txt--//以前寫的,不知道為什麼被刪除了,現在補上.如果一行能被存儲於一個數據塊(data block)中,那麼其行頭(row header)所需容量將不少於 3 位元組(byte)。在行頭信息之後依次儲存的是各列的列長(column le ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...