linux下安装sql server

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下安装sql server相关的知识,希望对你有一定的参考价值。

以Centos 7系统为例:

[[email protected]c7 ~]# cat /etc/redhat-release              #系统版本

CentOS Linux release 7.1.1503 (Core) 

[[email protected] ~]# firewall-cmd --state                 #查看firewall状态,关闭firewall

running

[[email protected] ~]# systemctl stop firewalld.service     #关闭

[[email protected] ~]# systemctl disable firewalld.service  #开机不启动

rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘

rm ‘/etc/systemd/system/basic.target.wants/firewalld.service‘

[[email protected] ~]# systemctl disable firewalld.service  #开机不启动

[[email protected] ~]# firewall-cmd --state                 #已关闭firewall

not running

[[email protected] yum.repos.d]# pwd                        #进入/etc/yum.repos.d下载二个yum源文件

/etc/yum.repos.d

[[email protected] yum.repos.d]# wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo

[[email protected] yum.repos.d]# wget https://packages.microsoft.com/config/rhel/7/prod.repo

[[email protected] yum.repos.d]# yum search mssql           #查看源信息,已有包信息

mssql-server.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine

mssql-server-ha.x86_64 : Microsoft(R) SQL Server(R) Relational Database Engine

mssql-tools.x86_64 : Tools for Microsoft(R) SQL Server (R)

....略

[[email protected] yum.repos.d]# yum install -y mssql-server mssql-tools    #安装服务和工具

...略

已安装:

  mssql-server.x86_64 0:14.0.1.246-6

已安装:

  mssql-tools.x86_64 0:14.0.1.246-1 

[[email protected] ~]# cd /opt/mssql/bin/                   #进入sql目录

[[email protected] bin]# ls                                 #下面有启动的文件

compress-dump.sh  generate-core.sh  mssql-conf  sqlpackage  sqlservr  sqlservr-setup  sqlservr-telemetry

[[email protected] bin]# ./sqlservr-setup                   #执行此文件,依照提示设置密码等信息

Microsoft(R) SQL Server(R) Setup


You can abort setup at anytime by pressing Ctrl-C. Start this program

with the --help option for information about running it in unattended

mode.


Please enter a password for the system administrator (SA) account:         设置密码

Please confirm the password for the system administrator (SA) account:     确认密码


Setting system administrator (SA) account password...


Do you wish to start the SQL Server service now? [y/n]: y                   开启服务

Do you wish to enable SQL Server to start on boot? [y/n]: y                 开机启动服务

ln -s ‘/usr/lib/systemd/system/mssql-server.service‘ ‘/etc/systemd/system/multi-user.target.wants/mssql-server.service‘

ln -s ‘/usr/lib/systemd/system/mssql-server-telemetry.service‘ ‘/etc/systemd/system/multi-user.target.wants/mssql-server-telemetry.service‘


Setup completed successfully.

[[email protected] bin]# systemctl status mssql

mssql.service

   Loaded: not-found (Reason: No such file or directory)

   Active: inactive (dead)


[[email protected]c7 ~]# sqlcmd -S localhost -U sa

Password: 

1> select db_name();

2> go

                                                                                                                                

--------------------------------------------------------------------------------------------------------------------------------

master  

    查看使用CPU和内存高的进程

# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

技术分享


参考自:

https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-red-hat

http://www.cnblogs.com/hengwei/p/6076199.html


本文出自 “赵东伟的博客” 博客,请务必保留此出处http://zhaodongwei.blog.51cto.com/4233742/1878802

以上是关于linux下安装sql server的主要内容,如果未能解决你的问题,请参考以下文章

Linux安装SQL Server 2017

Linux下安装SqlServer 2017SQL Server on Linux

Centos 7.3下 Linux For SQL Server安装及配置介绍

Centos 7.3下 Linux For SQL Server安装及配置介绍

Red Hat Enterprise Linux 7.2下使用RPM包安装SQL Server vNext

Linux环境下用Docker搭建SQL SERVER开发环境