Last active
August 22, 2023 13:08
-
-
Save Thecarisma/74cfdcf7818e9a17b6448919d4a11c2f to your computer and use it in GitHub Desktop.
Script to setup sonar-scanner on a Linux computer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SONAR_QUBE_HOST="$1" | |
if [[ "$SONAR_QUBE_HOST" == "" ]]; | |
then | |
SONAR_QUBE_HOST=http://34.89.91.40:9000 | |
fi | |
# download and install sonar-scanner | |
apt-get update | |
apt-get install unzip wget -y | |
mkdir /downloads/sonarqube -p | |
cd /downloads/sonarqube | |
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip | |
unzip sonar-scanner-cli-4.2.0.1873-linux.zip | |
mv sonar-scanner-4.2.0.1873-linux /opt/sonar-scanner | |
# configure sonar host and configuration | |
echo sonar.host.url=$SONAR_QUBE_HOST>/opt/sonar-scanner/conf/sonar-scanner.properties | |
echo sonar.sourceEncoding=UTF-8>>/opt/sonar-scanner/conf/sonar-scanner.properties | |
cat /opt/sonar-scanner/conf/sonar-scanner.properties | |
# add sonar-scanner to PATH | |
echo \#/bin/bash\\nexport PATH="\$PATH:/opt/sonar-scanner/bin">/etc/profile.d/sonar-scanner.sh | |
cat /etc/profile.d/sonar-scanner.sh | |
# load new PATH variable | |
. /etc/profile.d/sonar-scanner.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To install sonar-scanner from the sh terminal with the script
From URL