網頁

2024/2/20

Linux 安裝SonarScanner CLI

在Linux安裝SonarScanner CLI。


安裝環境:

  • Rocky Linux 9.2 (Blue Onyx)


安裝

/usr/local目錄下建立sonarqube目錄並前往該目錄。

/usr/local/sonarqube目錄下輸入wget <sonar-scanner-cli-download-url>下載SonarScanner CLI zip檔到目前目錄。 <sonar-scanner-cli-download-url>是SonarScanner CLI zip檔的url位址,例如目前官網Linux 64-bit的為https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip

# wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
--2024-02-21 11:45:42--  https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
Resolving binaries.sonarsource.com (binaries.sonarsource.com)... 13.35.35.62, 13.35.35.113, 13.35.35.77, ...
Connecting to binaries.sonarsource.com (binaries.sonarsource.com)|13.35.35.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 47123720 (45M) [binary/octet-stream]
Saving to: ‘sonar-scanner-cli-5.0.1.3006-linux.zip’

sonar-scanner-cli-5.0.1.3006-linux.zip                              100%[===================================================================================================================================================================>]  44.94M  36.7MB/s    in 1.2s

2024-02-21 11:45:44 (36.7 MB/s) - ‘sonar-scanner-cli-5.0.1.3006-linux.zip’ saved [47123720/47123720]

接著輸入unzip sonar-scanner-cli-5.0.1.3006-linux.zip將下載回來的zip檔解壓縮到當前目錄。

# unzip sonar-scanner-cli-5.0.1.3006-linux.zip
Archive:  sonar-scanner-cli-5.0.1.3006-linux.zip
...

前往解壓縮後的目錄sonar-scanner-5.0.1.3006-linux/bin,執行./sonar-scanner --version或執行/usr/local/sonarqube/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner --version檢視版本資訊代表安裝成功。

# /usr/local/sonarqube/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner --version
INFO: Scanner configuration file: /usr/local/sonarqube/sonar-scanner-5.0.1.3006-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 5.0.1.3006
INFO: Java 17.0.7 Eclipse Adoptium (64-bit)
INFO: Linux 5.14.0-284.30.1.el9_2.x86_64 amd64


沒有留言:

張貼留言