UbuntuServer20.04LTSにSQLServer2019をインストールする

最近WindowsよりmacosよりUbuntuを触っている時間が増えた気がする
以前に
LinuxでSQLServerを動かしてみた
SQLServer 2017 Linux版の環境を構築してみた
で構築してきた環境をUbuntuServer20.04LTS+SQLServer2019で環境を構築しなおした
ついでにAzureDataStudioもインストールしてみる

設定メモ

SQLServer2019をインストールする

$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
$ sudo apt update
$ sudo apt install mssql-server

+--------------------------------------------------------------+
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
+--------------------------------------------------------------+

$ sudo /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
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

Enter the SQL Server system administrator password: 
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 /etc/systemd/system/multi-user.target.wants/mssql-server.service → /lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

$ systemctl status mssql-server.service
● mssql-server.service - Microsoft SQL Server Database Engine
     Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-10-01 05:48:05 JST; 1min 26s ago
       Docs: https://docs.microsoft.com/en-us/sql/linux
   Main PID: 8957 (sqlservr)
      Tasks: 166
     Memory: 686.5M
     CGroup: /system.slice/mssql-server.service
             ├─8957 /opt/mssql/bin/sqlservr
             └─9012 /opt/mssql/bin/sqlservr

10月 01 05:48:08 main sqlservr[9012]: [96B blob data]
10月 01 05:48:09 main sqlservr[9012]: [66B blob data]
10月 01 05:48:09 main sqlservr[9012]: [96B blob data]
10月 01 05:48:09 main sqlservr[9012]: [100B blob data]
10月 01 05:48:09 main sqlservr[9012]: [71B blob data]
10月 01 05:48:09 main sqlservr[9012]: [124B blob data]
10月 01 05:48:09 main sqlservr[9012]: [73B blob data]
10月 01 05:48:09 main sqlservr[9012]: [186B blob data]
10月 01 05:48:09 main sqlservr[9012]: [73B blob data]
10月 01 05:48:09 main sqlservr[9012]: [186B blob data]

mssql-toolsをインストールする

$ sudo su
# curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
# apt update 
# apt install libodbc1
# apt install unixodbc
# apt install unixodbc-dev
# apt install mssql-tools
# /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P Password1!
1> select @@VERSION
2> go
                                                                                                                                                                                                                                                                                                            
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2019 (RTM-CU8) (KB4577194) - 15.0.4073.23 (X64) 
        Sep 23 2020 16:03:08 
        Copyright (C) 2019 Microsoft Corporation
        Express Edition (64-bit) on Linux (Ubuntu 20.04.1 LTS) <X64>                                                                                                        

(1 rows affected)

AzureDataStudioをインストールする

Azure Data Studio のダウンロードとインストールからdeb版をダウンロードする

$ cd ~/Downloads
$ sudo apt install ./azuredatastudio-linux-1.22.1.deb
$ azuredatastudio