SonarQube Installation Guide for Java (2025)

Introduction

This guide provides step-by-step instructions to install SonarQube on Mac, Windows, and Linux for Java static analysis in 2025. SonarQube is a leading tool for code quality and security analysis.

1️⃣ Prerequisites

  • Java 17 or later (LTS recommended)
  • At least 2GB RAM
  • Latest SonarQube Community Edition (or higher)
  • Internet connection for downloading packages

2️⃣ Installation on Mac

  1. Install Java:
    brew install openjdk@17
  2. Download SonarQube from the official site.
  3. Extract the archive:
    tar -xzf sonarqube-*.zip
  4. Navigate to the SonarQube directory:
    cd sonarqube-*
  5. Start SonarQube:
    ./bin/macosx-universal-64/sonar.sh start
  6. Access the dashboard at http://localhost:9000

3️⃣ Installation on Windows

  1. Install Java 17+ (e.g., from Adoptium).
  2. Download SonarQube from the official site.
  3. Extract the ZIP file using Windows Explorer or tar -xf sonarqube-*.zip
  4. Open Command Prompt and navigate to the SonarQube directory:
    cd sonarqube-*
  5. Start SonarQube:
    bin\windows-x86-64\StartSonar.bat
  6. Access the dashboard at http://localhost:9000

4️⃣ Installation on Linux

  1. Install Java:
    sudo apt-get install openjdk-17-jdk (Debian/Ubuntu) or sudo yum install java-17-openjdk (RHEL/CentOS)
  2. Download SonarQube from the official site.
  3. Extract the archive:
    unzip sonarqube-*.zip
  4. Navigate to the SonarQube directory:
    cd sonarqube-*
  5. Start SonarQube:
    ./bin/linux-x86-64/sonar.sh start
  6. Access the dashboard at http://localhost:9000

5️⃣ Post-Installation Steps

  • Default login: admin/admin
  • Change the admin password after first login
  • Install Java plugin if not present
  • Integrate with your build tool (Maven, Gradle, etc.)

FAQ

Download the latest version, stop the server, back up your data, and follow the upgrade instructions in the official documentation.

Yes, SonarQube provides an official Docker image. See the Docker Hub page for details.

Conclusion

SonarQube is easy to install on all major platforms. Follow the steps above to get started with static analysis for your Java projects in 2025!