mssql-server.sh 1.52 KB
Newer Older
1 2 3
#!/bin/sh

PKGNAME=mssql-server
4
SUPPORTEDARCHES="x86_64"
5 6 7
DESCRIPTION="MS SQL Server 2019 from the official site"

DEBREPO="deb http://ftp.ru.debian.org/debian/ stretch main"
8 9

if [ "$1" = "--remove" ] ; then
10
    epm remove $PKGNAME
11 12 13 14 15
    echo
    echo "Check data directory /var/opt/mssql if you need remove it too."
    exit
fi

16 17
. $(dirname $0)/common.sh

18

19 20
serv mssql-server stop

21 22 23
dname="$(epm print info -s)"
dversion="$(epm print info -v)"

24
case "$(epm print info -d)" in
25
  AstraLinux*)
26 27 28 29 30 31
    # we have libc++1-9, but this package requires libc++1
    epm ar $DEBREPO ; epm update
    epm install libc++1
    epm install https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019/pool/main/m/mssql-server/mssql-server_1*_amd64.deb
    epm rr $DEBREPO ; epm update
    ;;
32
  ALTLinux)
33
    epm install --repack https://packages.microsoft.com/rhel/8/mssql-server-2019/Packages/m/mssql-server-[0-9]*.x86_64.rpm || fatal
34
    ;;
35 36 37
  Debian|Ubuntu)
    epm install https://packages.microsoft.com/$dname/$dversion/mssql-server-2019/pool/main/m/mssql-server/mssql-server_1*_amd64.deb
    ;;
38
  *)
39
    fatal "$(epm print info -d) is not supported yet."
40 41 42
    ;;
esac

43
if [ -z "$auto" ] ; then
44
    esu /opt/mssql/bin/mssql-conf setup accept-eula
45 46 47 48 49 50 51 52
    serv mssql-server on
else
cat <<EOF
Run follow commands manually for complete the setup:
    # /opt/mssql/bin/mssql-conf setup accept-eula
    # serv mssql-server on
EOF
fi
53 54 55 56 57 58 59


cat <<EOF

Use follow command to check the connection to the MS SQL server:
$ /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -Q 'sp_databases'
EOF