Sqlserver2019安装到服务器centos7虚拟机

Sqlserver2019安装到服务器centos7虚拟机或本地虚拟机

题外话:本地虚拟机的话 注意一定是打通上网的状态大同小异 主要是安装到无服务器

第一步购买服务器

注意注意!!!

购买服务器不做解释 必须购买大于4G内存运行的服务器本地的也是必须大于 因为sqlserver2019 必须要求3.5g内存运行上 就算你用破除2g内存改了 后面操作也会报错 所以大于4G内存运行的服务器才是王道

注意注意!!!

系统版本:Centos7.7 ,内存4G(SQL Server内存要求至少2G),硬盘40G,1核CPU

下载地址

SQL Server版本:SQL Server 2019:

https://packages.microsoft.com/rhel/7/mssql-server-2019/mssql-server-15.0.4003.23-3.x86_64.rpm

关闭SELINUX

[root@localhost ~]# sed -i '/^SELINUX/s/enforcing/disabled/g' /etc/selinux/config && setenforce 0

添加软件源并安装依赖包

[root@localhost ~]# curl https://packages.microsoft.com/config/rhel/7/prod.repo -o /etc/yum.repos.d/msprod.repo
[root@localhost ~]# yum -y install mssql-tools unixODBC-devel bzip2 gdb libsss_nss_idmap cyrus-sasl cyrus-sasl-gssapi

在这里插入图片描述

安装SQL Server2019

安装之前上面的地址可以直接下载SQL Server2019,上传到服务器并安装 上传到

首先 cd /
  cd /root
  用xftp7 在本地下载好的直接拖进去 其它方法页可以
  之后 在这个目录中运行
[root@localhost ~]# rpm -ivh mssql-server-15.0.4003.23-3.x86_64.rpm

运行初始化配制

[root@localhost ~]# /opt/mssql/bin/mssql-conf setup 
usermod: no changes
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) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
  7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
  8) 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=2109348&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-8): 3 		#这里选择了Express版本
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&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	#输入Yes接受许可条目

Enter the SQL Server system administrator password: 		#设置SA管理员密码
Confirm the SQL Server system administrator password: 
Configuring SQL Server...

The licensing PID was successfully processed. The new edition is [Express Edition].
ForceFlush is enabled for this instance. 
ForceFlush feature is enabled for log durability.
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.

添加环境变量

[root@localhost ~]# echo 'export PATH=$PATH:/opt/mssql-tools/bin' > /etc/profile.d/mssql.sh 
[root@localhost ~]# source !$
source /etc/profile.d/mssql.sh

防火墙添加服务

[root@localhost ~]# firewall-cmd --permanent --add-service=mssql 
success
[root@localhost ~]# firewall-cmd --reload
success

解决错误 FirewallD is not running

如果错误 一般都是显示没有开 安装sqlerver2019的话可以不用在意

也就是这个错误

可以这样解决 执行systemctl status firewalld

需要开启防火墙即可

systemctl start firewalld 使用后可以设置了

如果到时候执 行命令行工具连接测试 报错的话 建议就再把防火墙关掉

关闭防火墙:systemctl stop firewalld

这是使用命令
开启防火墙:systemctl start firewalld

关闭防火墙:systemctl stop firewalld

查看防火墙状态:systemctl status firewalld 

开启后再执行

命令行工具连接测试

[root@localhost ~]# sqlcmd -S localhost -U sa
Password: 
# 显示系统数据库
1> select name,database_id from sys.databases;
# 执行
2> go
name                                                                                                                             database_id
-------------------------------------------------------------------------------------------------------------------------------- -----------
master                                                                                                                                     1
tempdb                                                                                                                                     2
model                                                                                                                                      3
msdb                                                                                                                                       4

(4 rows affected)
# 查看软件版本
1> SELECT @@VERSION
2> go
                                                                                                                                                                                                                                                                                                            
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2019 (RTM-CU1) (KB4527376) - 15.0.4003.23 (X64) 
	Dec  6 2019 14:53:33 
	Copyright (C) 2019 Microsoft Corporation
	Express Edition (64-bit) on Linux (CentOS Linux 7 (Core))                                                                                                      

(1 rows affected)
1>

在客户端连接数据库

打开

在这里插入图片描述

在这里插入图片描述

如果链接不上的话 一般就算就是没有添加端口或者密码错误

设置服务器的安全组

在这里插入图片描述

不管是什么服务器都记得添加1433的端口

本地服务器的设置

在这里插入图片描述

(二)为微软SQL服务器(MSSQLServer)配置相应协议。

(1)依次选择:开始-〉所有程序-〉Microsoft SQL Server 2008-〉配置工具-〉SQL Server配置管理器,如下图所示:

在这里插入图片描述

(2)打开SQL Server配置管理器后,选择SQL Server网络配置下面的MSSQLSERVER,然后看右边里面的TCP/IP是否为“已启用”,如下图所示:在这里插入图片描述

在这里插入图片描述

这样就大公告成啦 连接后

在这里插入图片描述

就能连接成功啦!!! 撒花本文章是自己学习结合网上文章完成的,就是自己留着自己以后学习使用的喔!勿喷!!!!

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值