linux下安装sql server

本文涉及的产品
云数据库 RDS SQL Server,独享型 2核4GB
简介:

以Centos 7系统为例:

[root@c7 ~]# cat /etc/redhat-release              #系统版本

CentOS Linux release 7.1.1503 (Core) 

[root@c7 ~]# firewall-cmd --state                 #查看firewall状态,关闭firewall

running

[root@c7 ~]# systemctl stop firewalld.service     #关闭

[root@c7 ~]# systemctl disable firewalld.service  #开机不启动

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

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

[root@c7 ~]# systemctl disable firewalld.service  #开机不启动

[root@c7 ~]# firewall-cmd --state                 #已关闭firewall

not running

[root@c7 yum.repos.d]# pwd                        #进入/etc/yum.repos.d下载二个yum源文件

/etc/yum.repos.d

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

[root@c7 yum.repos.d]# wget https://packages.microsoft.com/config/rhel/7/prod.repo

[root@c7 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)

....略

[root@c7 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 

[root@c7 ~]# cd /opt/mssql/bin/                   #进入sql目录

[root@c7 bin]# ls                                 #下面有启动的文件

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

[root@c7 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.

[root@c7 bin]# systemctl status mssql

mssql.service

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

   Active: inactive (dead)


[root@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

wKioL1hBF7exJXTKAACseqfCR4A730.jpg

    使用SQL Management连接数据库

服务器IP

[root@c7 ~]# hostname -I

192.168.2.117

wKioL1hBN36B9LhdAAHIEOqO_4c228.jpg


参考自:

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

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





      本文转自cix123  51CTO博客,原文链接:http://blog.51cto.com/zhaodongwei/1878802,如需转载请自行联系原作者



相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情: https://www.aliyun.com/product/rds/sqlserver
相关文章
|
5天前
|
NoSQL Linux 测试技术
Redis的安装(Linux版)
Redis的安装(Linux版)
42 1
|
15天前
|
缓存 Linux 测试技术
安装【银河麒麟V10】linux系统--并挂载镜像
安装【银河麒麟V10】linux系统--并挂载镜像
77 0
|
15天前
|
Linux C语言
linux yum安装ffmpeg 图文详解
linux yum安装ffmpeg 图文详解
35 0
|
15天前
|
NoSQL Linux Redis
linux 下和win下安装redis 并添加开机自启 图文详解
linux 下和win下安装redis 并添加开机自启 图文详解
17 0
|
15天前
|
Linux
linux yum 安装rar和unrar
linux yum 安装rar和unrar
50 0
|
26天前
|
Java Linux Maven
Linux中安装MAVEN环境配置
Linux中安装MAVEN环境配置
59 3
|
1天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
18 2
|
1天前
|
Linux 开发工具 Android开发
Docker系列(1)安装Linux系统编译Android源码
Docker系列(1)安装Linux系统编译Android源码
3 0
|
1天前
|
Ubuntu Linux 开发工具
WSL2(3)安装Linux headers完美解决方案
WSL2(3)安装Linux headers完美解决方案
3 0
|
2天前
|
Linux 开发工具 C语言
Linux 安装 gcc 编译运行 C程序
Linux 安装 gcc 编译运行 C程序
14 0