PowerShellでSQL DeveloperをWindowsに自動インストール

Developer

初めに

このブログでは、PowerShellスクリプトを利用して SQL Developer を自動インストールする方法を紹介します。特に、クラウド環境で効率的に開発環境を構築したい方や、Computeインスタンス作成時に開発ツールを自動導入したい 方ににとって、一助となれば幸いです。

cloud-init スクリプトに組み込むことで、インスタンスの初期設定時に SQL Developer を自動インストールでき、手動でのセットアップ作業を省略できます。これにより、環境構築のスピードと再現性を大幅に向上させることが可能になります。

環境情報

  • Windows Server 2019 Standard Edition (OCI VM)
  • SQL Devloper 24.3 (Windows 64-bit with JDK 17 included)

ステップ

  1. インストーラのダウンロード (リンク)
  2. インストーラの解凍
  3. インストーラの削除(オプション)
#ps1_sysnative

# Define the URL of the SQL Developer installer
$InstallerFile = "sqldeveloper-24.3.1.347.1826-x64.zip"
$InstallerUrl =  "https://download.oracle.com/otn_software/java/sqldeveloper/" + $InstallerFile

# Define the path where you want to save the installer
$InstallerPath = Join-Path $env:TEMP $InstallerFile

# Download the installer
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $InstallerUrl -OutFile $InstallerPath

# Unzip the installer
Expand-Archive -Path $InstallerPath -DestinationPath "C:\"

# Clean up the installer after installation
Remove-Item $InstallerPath
OCI cloud-initスクリプトで使用する場合は、スクリプトの先頭に#ps1_sysnativeを追加する必要があります。

以上

タイトルとURLをコピーしました