centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

centos7 安装sql

It was a paradigm shift in December 2016, when Microsoft made their SQL Server database available for Linux; it was the first time in history that Microsoft ever designed SQL Server to run on a non-Windows operating system. SQL Server vNext was released for public preview so the user community could test and deploy SQL Server on a Linux operating system. Microsoft took a major step in diversifying the database technology into the non-windows platform for the first time.

2016年12月,这是一次范式转变,当时Microsoft将其SQL Server数据库提供给Linux。 这是微软有史以来第一次设计SQL Server在非Windows操作系统上运行。 SQL Server vNext已发布,以供公众预览,因此用户社区可以在Linux操作系统上测试和部署SQL Server。 微软首次迈出了重要的一步,将数据库技术多样化到非Windows平台中。

介绍 (Introduction)

The close integration of various data sources under one umbrella called Hadoop – Big Data enabled DBAs to handle data and its data structures on the available platforms. It’s a great opportunity for the SQL community members to try MS SQL on the non-windows platform.

在名为Hadoop – Big Data的保护下,各种数据源的紧密集成使DBA可以在可用平台上处理数据及其数据结构。 对于SQL社区成员来说,这是在非Windows平台上尝试MS SQL的绝佳机会。

SQL Server on Linux can potentially provide customers with even more flexibility in their data solution. SQL Server’s proven enterprise experience and capabilities is a valuable asset to Enterprise Linux customers around the world. It’s expanding the database market to meet the needs and be on par with the changing trends in technology.

Linux上SQL Server可以为客户提供更大的数据解决方案灵活性。 SQL Server久经考验的企业经验和功能是全球Enterprise Linux客户的宝贵资产。 它正在扩展数据库市场以满足需求,并与技术的变化趋势保持一致。

This article is an effort to detail the instructions for the installation of SQL Server vNext on Linux. The article also includes several basic Linux commands, thereby being helpful in understanding the process of installation and configuration.

本文旨在详细说明在Linux上安装SQL Server vNext的说明。 本文还包括几个基本的Linux命令,从而有助于理解安装和配置过程。

This article is a comprehensive guide for the installation and configuration of MSSQL; it includes:

本文是有关MSSQL的安装和配置的全面指南。 这包括:

  • Introduction and understanding of how SQL Server run on Linux

    介绍和了解SQL Server如何在Linux上运行
  • Challenges and complications in building and managing SQL Server on Linux

    在Linux上构建和管理SQL Server的挑战和复杂性
  • Curating the MSSQL Server installation using Linux commands

    使用Linux命令整理MSSQL Server安装
  • Detailed installation procedure

    详细的安装步骤

先决条件 (Pre-requisites)

  • Basic understanding of Linux

    对Linux的基本了解
  • Access to CentOS/RHEL Software Libraries

    访问CentOS / RHEL软件库
  • At least 4 GB RAM

    至少4 GB RAM
  • At least 8 GB of hard disk space

    至少8 GB的硬盘空间

SQL Server如何在Linux上运行? (How Does SQL Server Run on Linux?)

Microsoft has provided great insight on how they were able to port SQL Server to run natively on Linux introducing what is known as Platform Abstraction Layer (“PAL”). The Microsoft Research Team set out to bring full functionality, performance, and scale value of the SQL Server RDBMS to Linux. The Microsoft Research Drawbridge acts as an abstraction layer between the OS and the application layers. Drawbridge explored a new approach to process virtualization and isolation. It’s a form of virtualization, specifically for application sandboxing. In fact, it’s very hard to provide a capable SQL version outside of windows within the stipulated time, hence MSR (Microsoft Research) team decides to integrate SQL Server’s existing platform layer SOS (SQL Server Operating System) with Drawbridge to create what we call as the SQLPAL. The SOS provides robust memory management, thread scheduling, and IO services. Creating SQLPAL enabled the full functional SQL version to run on Linux. Please read the reference section for more information.

微软提供了极大的见解,介绍了他们如何能够移植SQL Server使其在Linux上本地运行,从而引入了平台抽象层(“ PAL”)。 微软研究团队着手将SQL Server RDBMS的全部功能,性能和扩展价值带入Linux。 Microsoft Research吊桥充当OS和应用程序层之间的抽象层。 Drawbridge探索了一种新的方法来处理虚拟化和隔离。 这是一种虚拟化形式,专门用于应用程序沙箱。 实际上,在规定的时间内在Windows之外提供功能强大SQL版本非常困难,因此MSR(微软研究院)团队决定将SQL Server的现有平台层SOS(SQL Server操作系统)与Drawbridge集成在一起,以创建我们所谓SQLPAL。 SOS提供强大的内存管理,线程调度和IO服务。 创建SQLPAL可使完整功能SQL版本在Linux上运行。 请阅读参考部分以获取更多信息。

基本的Linux命令 (Basic Linux Commands)

Below are the few basic Linux commands which will help SQL administrator understand the process of installation of SQL Server and to troubleshoot unforeseen issues during the configuration.

以下是一些基本的Linux命令,这些命令将帮助SQL管理员了解SQL Server的安装过程并解决配置过程中无法预料的问题。

Linux命令 (Linux Commands)

Command Usage Description
uname uname -a Linux find out the current running kernel version
ls ls /directory_path List files
cp cp src_file_path /destination_directory_path Copy files
mv mv src _file_path
/destination_directory_path
Renames a file or moves it from one directory to another directory
rm rm file_path Delete files
ln ln file_path /destination_directory_path Link files
cd cd /Directory_path Change directory
pwd pwd Print current directory name or Present Working Directory
mkdir mkdir /new_directory_path Create directory
rmdir rmdir /directory_path Delete directory
cat cat /file_path View files
chown chown user_name file_path Change file owner
chgrp chgrp group_name /file_path Change file group
chattr sudo chattr +i/-i /file_path Change advanced file attributes
ifconfig ifconfig Set/display network information/ IP address
systemctl systemctl start/stop/reload/mask/unmask <servicename>
systemctl status mssql-server
If you are running as a non-root user, you will have to use sudo since this will affect the state of the operating system
lscpu lscpu CPU/hardware information
lspci lspci List all PCI devices
fdisk fdisk -l List installed hard disk and size
free free -m free and used memory in the system
wget wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo wget is a free utility for non-interactive download of files from the web
The simplest way to use wget is to simply provide it with the location of a file to download over HTTP.
yum yum install/remove/update mssql-server -y The yum command is the primary tool for getting, installing, deleting, querying, and otherwise managing Red Hat Enterprise Linux RPM software packages
命令 用法 描述
ame 优名 Linux找出当前正在运行的内核版本
ls ls / directory_path 列出档案
cp cp src_file_path / destination_directory_path 复制档案
MV mv src _file_path
/ destination_directory_path
重命名文件或将其从一个目录移动到另一目录
R M rm file_path 删除文件
ln ln file_path / destination_directory_path 连结档案
光盘 cd /目录路径 变更目录
密码 密码 打印当前目录名称或当前工作目录
麦克迪尔 mkdir / new_directory_path 建立目录
rmdir rmdir /目录路径 删除目录
猫/ file_path 查看文件
wn chown user_name file_path 变更档案拥有者
chgrp chgrp group_name / file_path 变更档案群组
聊天室 须藤chattr + i / -i / file_path 更改高级文件属性
ifconfig ifconfig 设置/显示网络信息/ IP地址
系统控制 systemctl启动/停止/重新加载/掩码/取消掩码<服务名称>
systemctl状态mssql-server
如果您以非root用户身份运行,则必须使用sudo,因为这会影响操作系统的状态
lscpu lscpu CPU /硬件信息
lspci lspci 列出所有PCI设备
磁盘 fdisk -l 列出已安装的硬盘和大小
* *-m 系统中的可用内存和已用内存
get wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo wget是一个免费实用程序,用于从网络非交互式下载文件
使用wget的最简单方法是简单地为其提供文件的位置,以通过HTTP下载。
百胜 yum安装/删除/更新mssql-server -y yum命令是获取,安装,删除,查询和管理Red Hat Enterprise Linux RPM软件包的主要工具。

在CentOS 7上安装MSSQL Server (Install MSSQL Server on CentOS 7)

CentOS is an Enterprise-class Linux Distribution derived from sources freely provided to the public by Red Harm Inc. for Red Hat Enterprise Linux.

CentOS是企业级Linux发行版,其派生自Red Harm Inc.免费提供给公众以使用Red Hat Enterprise Linux。

This section covers how to install and configure MSSQL in the RHEL based Linux distribution CentOS.

本节介绍如何在基于RHEL的Linux发行版CentOS中安装和配置MSSQL。

  • List the available repositories: mssql-server.rep and prod.repo

    列出可用的存储库: mssql-server.rep和prod.repo
  • Install wget utility to download the files

    安装wget实用程序以下载文件
  • Download the repositories

    下载资料库
  • Move the repositories /etc/yum.repos.d/

    移动存储库/etc/yum.repos.d/
  • Install the MSSQL database service using yum, a package management tool for RPM-based Linux systems

    使用yum安装MSSQL数据库服务,yum是基于RPM的Linux系统的软件包管理工具
  • Configure the MSSQL instance by accepting the license agreement

    通过接受许可协议来配置MSSQL实例
  • Check the MSSQL service status

    检查MSSQL服务状态
  • Setup the firewall configuration to listen TCP port 1433

    设置防火墙配置以侦听TCP端口1433
  • List the IP address

    列出IP地址
  • Access the instance using another Windows machines using SSMS

    使用SSMS使用其他Windows计算机访问实例

Microsoft has created a repository to download the SQL Server libraries. You can access it at here.

Microsoft已创建一个存储库来下载SQL Server库。 您可以在这里访问它。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

Let’s get starteded by installing wget, a free utility to non-interactively download files from the Web. The simplest way to use wget is to simply provide it with the location of the file to download over HTTP.

让我们开始安装wget ,这是一个免费的实用程序,用于从Web上非交互式下载文件。 使用wget的最简单方法是简单地为它提供文件的位置,以通过HTTP下载。

If you’re running as a non-root user, you will have to use sudo, since this will affect the state of the operating system.

如果您以非root用户身份运行,则必须使用sudo ,因为这会影响操作系统的状态。

sudo yum -y install wget

sudo yum -y安装wget

OR

要么

yum -y install wget

yum -y安装wget

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

Download mssql-server.repo using wget

使用wget下载mssql-server.repo

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

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

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

Download prod.repo using wget

使用wget下载prod.repo

wget https://packages.microsoft.com/config/rhel/7/prod.repo

wget https://packages.microsoft.com/config/rhel/7/prod.repo

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

Now, move the files to the /etc/yum.repos.d/ directory so that it can be used with yum command

现在,将文件移动到/etc/yum.repos.d/目录,以便可以与yum命令一起使用

mv *.repo /etc/yum.repos.d/
ls /etc/yum.repos.d/

mv * .repo /etc/yum.repos.d/
ls /etc/yum.repos.d/

OR

要么

wget –directory-prefix=/etc/yum.repos.d/
https://packages.microsoft.com/config/rhel/7/mssql-server.repo
ls /etc/yum.repos.d/

wget –directory-prefix = / etc / yum.repos.d /
https://packages.microsoft.com/config/rhel/7/mssql-server.repo
ls /etc/yum.repos.d/

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

The libraries have now been downloaded and moved the respective directories. We’re ready for the installation procedures

现在已经下载了库并移动了相应的目录。 我们已经准备好安装程序

yum –y install mssql-server

yum –y安装mssql-server

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

The installation process will perform the basic checks such as for dependencies, memory, disk space, etc., followed by the download of the required packages. The installation will start automatically, once the download completes.

安装过程将执行基本检查,例如相关性,内存,磁盘空间等,然后下载所需的软件包。 下载完成后,安装将自动开始。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

[[email protected]]# /opt/mssql/bin/mssql-conf setup

[root @ localhost]#/ opt / mssql / bin / mssql-conf设置

That would complete the setup; it’s to accept the license agreement and set up the SA password.

这样就完成了设置; 接受许可协议并设置SA密码。

Make sure to specify a strong password for the SA account (such as it being at least 8 characters long, has uppercase and lowercase letters, numeric characters and/or other non-alphanumeric symbols).

确保为SA帐户指定一个强密码(例如,密码长度至少为8个字符,具有大小写字母,数字字符和/或其他非字母数字符号)。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

Run the following command to ensure the SQL Server service is running:

运行以下命令以确保SQL Server服务正在运行:

[[email protected]]# systemctl status mssql-server

[root @ localhost]#systemctl状态mssql-server

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

防火墙配置 (Firewall configuration)

Here’s how we enable the firewall to listen to the TCP port

这是我们使防火墙能够侦听TCP端口的方法

  • Run setup using the command, setup

    使用命令setup运行安装程序
  • Select System Services

    选择系统服务
  • Click Run Tool

    单击运行工具
  • Choose firewalld.service

    选择firewalld.service
  • Click OK

    点击确定
  • Open the SQL Server port on the firewall

    打开防火墙上SQL Server端口

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

[[email protected]]# firewall-cmd –zone=public –add-port=1433/tcp –permanent
[[email protected]]# firewall-cmd –reload

[root @ localhost]#firewall-cmd –zone = public –add-port = 1433 / tcp –permanent
[root @ localhost]#Firewall-cmd –重新加载

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

获取IP地址 (Get the IP address)

Fetch the IP address of the server using the ifconfig command.

使用ifconfig命令获取服务器的IP地址。

[[email protected]]# ifconfig

[root @ localhost]#ifconfig

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

Ping both, the Windows and the Linux servers.

ping Windows和Linux服务器。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

使用安装在另一台Windows计算机上SQLCMD或SSMS连接Linux MSSQL实例 (Connect Linux MSSQL instance using SQLCMD or SSMS installed on another Windows machine)

Connect the MSSQL instance using SQLCMD.

使用SQLCMD连接MSSQL实例。

The sqlcmd utility is a command line utility used for interactive execution of Transact-SQL statements.

sqlcmd实用程序是用于交互式执行Transact-SQL语句的命令行实用程序。

  • The server option (-S) identifies the instance of Microsoft SQL Server to which sqlcmd connects.

    服务器选项( -S )标识sqlcmd连接到的Microsoft SQL Server实例。
  • Authentication options (-U and -P) specify the credentials that sqlcmd uses to connect to the instance of SQL Server.

    身份验证选项( -U和-P )指定sqlcmd用于连接到SQL Server实例的凭据。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

使用SSMS连接 (Connecting using SSMS)

When using SQL Server Authentication, logins are created in the SQL Server and are not based on Windows user accounts. Both, the username and the password, are created on the SQL Server and are stored in the SQL Server. Users connecting using SQL Server Authentication must provide their credentials (username and password) every time they connect to the instance.

使用SQL Server身份验证时,登录名是在SQL Server中创建的,并不基于Windows用户帐户。 用户名和密码均在SQL Server上创建并存储在SQL Server中。 使用SQL Server身份验证进行连接的用户每次连接到实例时都必须提供其凭据(用户名和密码)。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

从SSMS查询MSSQL实例 (Querying MSSQL Instance from SSMS )

SQL Server Management Studio (SSMS) remains a Windows-only feature. Although, we can connect to a Linux SQL Server instance from the Windows SSMS. Developers can also use the database tools in Visual Studio, that allow queries, table design, stored procedure editing, and more.

SQL Server Management Studio(SSMS)仍然是仅Windows功能。 虽然,我们可以从Windows SSMS连接到Linux SQL Server实例。 开发人员还可以使用Visual Studio中的数据库工具,该工具允许进行查询,表设计,存储过程编辑等。

centos7 安装sql_在Linux Distribution CentOS 7上安装SQL Server vNext CTP

摘要 (Summary)

According to reports, we SQL DBAs have to wait until mid of 2017 to get our hands on the official version of SQL Server on Linux. Meanwhile, we can catch the free preview of SQL Server on Linux. In this article, I have tried to include every step needed to setup MSSQL on Linux. This is certainly a great initiative from Microsoft, and I strongly encourage you to try SQL Server on Linux.

据报道,我们SQL DBA必须等到2017年中才能获得Linux上SQL Server正式版的使用权。 同时,我们可以在Linux上免费预览SQL Server。 在本文中,我尝试包括在Linux上设置MSSQL所需的所有步骤。 这当然是Microsoft的一项伟大举措,我强烈建议您在Linux上尝试SQL Server。

翻译自: https://www.sqlshack.com/installation-of-sql-server-vnext-ctp-on-linux-distribution-centos-7/

centos7 安装sql