#!/bin/bash
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2023/06/12
<<!
The system supports the Sql Server 2019 2022 deployment in rpm mode,ubuntu(20.04, not included 22.04), centos,redhat,oracle(7,8,9),rockylinux,almalinux(8,9), suse(12,15)
# Official website automated script reference
https://learn.microsoft.com/en-us/sql/linux/sample-unattended-install-redhat?view=sql-server-ver16
# download Linux all sql server package
https://packages.microsoft.com/
# SQL server Linux repo
https://packages.microsoft.com/config/
# ubuntu To execute this script
ln -sf bash /bin/sh
!
install_sqlserver() {
# Check if the script is being run as root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root."
exit 1
fi
# Check the CentOS/Red Hat version
if [[ -f /etc/redhat-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
# Check the oralce Linux version
elif [[ -f /etc/oracle-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
# Check the Rock Linux version
elif [[ -f /etc/rocky-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
# Check the AlmaLinux version
elif [[ -f /etc/almalinux-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
# Check the ubuntu version
elif [[ -f /etc/os-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
# Check the suse version
elif [[ -f /etc/SuSE-release ]]; then
OS=$(cat /etc/*release* | grep "^PRETTY_NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
# Check the Debian version
elif [[ -f /etc/os-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+' | head -n1)
# Check the Fedora version
elif [[ -f /etc/fedora-release ]]; then
OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
VERSION=$(cat /etc/*release* | grep -oE '[0-9]+' | head -n1)
else
echo -e "\033[31mThis script only supports $OS $VERSION...\033[0m"
exit 1
fi
# Check the SQL Server version
#if ! command -v sqlservr &> /dev/null; then
if [ ! -d "/opt/mssql" ]; then
echo -e "\033[32mInstalling SQL Server for $OS $VERSION...\033[0m"
case $VERSION in
# CentOS/RedHat/oracle 7 install Sql Server 2019
7.?)
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
echo Installing SQL Server...
sudo yum install -y net-tools vim
sudo yum install -y bzip2 cyrus-sasl cyrus-sasl-gssapi gdb libatomic libsss_nss_idmap libtirpc python3 python3-libs python3-pip python3-setuptools cyrus-sasl-lib
sudo yum install -y mssql-server
sudo ACCEPT_EULA=Y yum install -y mssql-tools unixODBC unixODBC-devel
sudo yum install -y mssql-server-fts
firewall-cmd --zone=public --add-port=1433/tcp --permanent && firewall-cmd --reload
;;
# CentOS/RedHat/oracle/RockLinux/AlmaLinux 8 install Sql Server 2022
8.?)
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2022.repo
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
echo Installing SQL Server...
sudo yum install -y net-tools vim
sudo yum install -y gc gdb libatomic_ops libipt python3-pip gdb-headless python36 bzip2 cyrus-sasl-gssapi cyrus-sasl libatomic libbabeltrace python3-setuptools chkconfig guile platform-python-pip
sudo yum install -y mssql-server
sudo ACCEPT_EULA=Y yum install -y mssql-tools unixODBC unixODBC-devel
sudo yum install -y mssql-server-fts
firewall-cmd --zone=public --add-port=1433/tcp --permanent && firewall-cmd --reload
;;
# CentOS/RedHat/oracle/RockLinux/AlmaLinux 9 install Sql Server 2022
9.?)
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/9.0/mssql-server-2022.repo
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/9.0/prod.repo
echo Installing SQL Server...
sudo yum install -y net-tools vim
sudo yum install -y gc gdb libatomic_ops libipt python3-pip gdb-headless python36 bzip2 cyrus-sasl-gssapi cyrus-sasl libatomic libbabeltrace python3-setuptools chkconfig guile platform-python-pip
sudo yum install -y mssql-server
sudo ACCEPT_EULA=Y yum install -y mssql-tools unixODBC unixODBC-devel
sudo yum install -y mssql-server-fts
firewall-cmd --zone=public --add-port=1433/tcp --permanent && firewall-cmd --reload
;;
# ubuntu 20.04,22.04 Linux install Sql Server 2019
20.0?|22.0?)
sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
repoargs="$(curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)"
sudo add-apt-repository "${repoargs}"
repoargs="$(curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list)"
sudo add-apt-repository "${repoargs}"
sudo apt-get install -y gdb gdbserver libatomic1 libbabeltrace1 libc++1 libc++1-10 libc++abi1-10 libc6 libc6-dbg libcc1-0 libdw1 libsasl2-modules-gssapi-mit libsss-nss-idmap0
sudo apt-get install -y autoconf automake autotools-dev binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 gcc gcc-9 gcc-9-base libasan5 libbinutils libc-dev-bin libc6-dev libcrypt-dev libctf-nobfd0 libctf0 libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libltdl-dev libmpc3 libodbc1 libquadmath0 libtool libtsan0 libubsan1 linux-libc-dev m4 manpages-dev msodbcsql17 odbcinst odbcinst1debian2
sudo apt-get install -y net-tools vim
sudo apt-get install -y mssql-server
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc unixodbc-dev
sudo apt-get install -y mssql-server-fts
sudo ufw allow 1433/tcp
sudo ufw reload
;;
# Debian 10, 11
10|11)
echo "Not supported by official website"
;;
# Fedora 31,32,33
31|32|33)
echo "Not supported by official website"
;;
# SUSE 12 install Sql Server 2019
12.?)
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2019.repo
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/prod.repo
sudo zypper --gpg-auto-import-keys refresh
sudo SUSEConnect -p sle-sdk/12.4/x86_64
echo Installing SQL Server...
sudo zypper install -y net-tools vim
sudo zypper install -y mssql-server
sudo ACCEPT_EULA=Y zypper install -y mssql-tools unixODBC-devel
sudo zypper install -y mssql-server-fts
sudo SuSEfirewall2 open INT TCP 1433
sudo SuSEfirewall2 stop
sudo SuSEfirewall2 start
;;
# SUSE 15 install Sql Server 2022
15.?)
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/15/mssql-server-2022.repo
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/15/prod.repo
sudo zypper --gpg-auto-import-keys refresh
sudo SUSEConnect -p sle-sdk/15.3/x86_64
echo Installing SQL Server...
sudo zypper install -y net-tools vim
sudo zypper install -y mssql-server
sudo ACCEPT_EULA=Y zypper install -y mssql-tools unixODBC-devel
sudo zypper install -y mssql-server-fts
sudo SuSEfirewall2 open INT TCP 1433
sudo SuSEfirewall2 stop
sudo SuSEfirewall2 start
;;
*)
echo -e "\033[31mUnsupported $OS $VERSION...\033[0m"
exit 1
;;
esac
#initialized_database
echo "SQL Server initialized_database $OS $VERSION..."
initialized_database
echo -e "\033[32mSQL Server for $OS $VERSION successful
没有合适的资源?快使用搜索试试~ 我知道了~
SQL-Server-all-auto
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共7个文件
ps1:6个
sh:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 155 浏览量
2024-06-11
15:50:24
上传
评论
收藏 18KB ZIP 举报
温馨提示
Windows Server 支持 SQL Server 2012 SQL Server 2014 SQL Server 2016 SQL Server 2017 SQL Server 2019 SQL Server 2022 Linux Redha支持系列,ubuntu,suse
资源推荐
资源详情
资源评论
![text/x-java](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![application/x-dosexec](https://img-home.csdnimg.cn/images/20210720083343.png)
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![ini-development](https://img-home.csdnimg.cn/images/20210720083646.png)
![text/plain](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 7 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/bf28e381a2434b56a90036bba031ae6c_hanzheng260561728.jpg!1)
CIAS
- 粉丝: 988
- 资源: 297
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- JavaScript dom操作 访问和修改元素 示例代码
- TSM9933DCS-RL-VB一款2个P-Channel沟道SOP8的MOSFET晶体管参数介绍与应用说明
- 这是一个大数据实战项目
- 车辆信息系统(GUI)
- petr公版256-704输入J5上板结果
- TSM9434DCS-RL-VB一款2个P-Channel沟道SOP8的MOSFET晶体管参数介绍与应用说明
- 基于NIUSHOP V6使用NIUCLOUD-ADMIN底层框架设计的一款快速可以开发企业级应用的软件系统
- 课程设计:基于C++的学生管理系统项目源码.zip(教程+源代码+附上详细代码说明)
- TSM4953DCS-RL-VB一款2个P-Channel沟道SOP8的MOSFET晶体管参数介绍与应用说明
- 爬虫项目-搜索淘宝商品代码实战
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)