Try Out SonarQube

You've heard about how SonarQube can help you write cleaner and safer code, and now you're ready to try it out for yourself. This guide shows you how to install a local instance of SonarQube and analyze a project. Installing a local instance gets you up and running quickly, so you can experience SonarQube first hand.

Once you're ready to set up a production instance, take a look at the Install SonarQube documentation.

Installing a local instance of SonarQube

You can evaluate SonarQube using a traditional installation with the zip file or you can spin up a Docker container using one of our Docker images. Click the method you prefer below to expand the installation instructions:

From the zip file

  1. Download the SonarQube Community Edition zip file.
  2. As a non-root user, unzip it, let's say in C:\sonarqube or /opt/sonarqube.
  3. As a non-root user, start the SonarQube Server:

    # On Windows, execute:
    C:\sonarqube\bin\windows-x86-64\StartSonar.bat
    
    # On other operating systems, as a non-root user execute:
    /opt/sonarqube/bin/[OS]/sonar.sh console
    

If your instance fails to start, check your logs to find the cause.

From the Docker image

Find the Community Edition Docker image on Docker Hub.

  1. Start the server by running:
$ docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest

Once your instance is up and running, Log in to http://localhost:9000 using System Administrator credentials:

  • login: admin
  • password: admin

Analyzing a Project

Now that you're logged in to your local SonarQube instance, let's analyze a project:

  1. Click the Create new project button.
  2. Give your project a Project key and a Display name and click the Set Up button.
  3. Under Provide a token, select Generate a token. Give your token a name, click the Generate button, and click Continue.
  4. Select your project's main language under Run analysis on your project, and follow the instructions to analyze your project. Here you'll download and execute a Scanner on your code (if you're using Maven or Gradle, the Scanner is automatically downloaded).

After successfully analyzing your code, you'll see your first analysis on SonarQube:

successful analysis