Installing SonarQube on Windows
A complete walkthrough for installing SonarQube on a Windows environment, including Java prerequisites, database setup, service configuration, and verifying your first project analysis.
Prerequisites and System Requirements
Before installing SonarQube on Windows, administrators must ensure their system meets specific prerequisites. While the installation works on any 64-bit version of Windows, including Windows 10, two critical components must be configured first: Java and a supported database. For SonarQube versions 9.9 and later, including version 10, JDK 17 is required. Users can choose between Oracle JDK or OpenJDK, and installation can be verified by running the java -version command in the command prompt to confirm the correct version is active.
Database Configuration
SonarQube requires a supported database backend, with options including PostgreSQL, Microsoft SQL Server, and Oracle. Before proceeding with the SonarQube installation, users must create a dedicated database schema and user account with appropriate permissions. For SQL Server specifically, additional configuration is necessary: the database collation must be case-sensitive and accent-sensitive, and read committed snapshot isolation must be enabled. The designated SonarQube user account requires create, update, and delete permissions within the schema and database to ensure proper functionality.
Downloading and Extracting SonarQube
Users can download SonarQube from the official website, which displays the latest version and allows selection of preferred editions, including Developer Edition and Community Edition. For production environments, the long-term support version is also available. Once downloaded, the installation zip file should be extracted to the desired directory—commonly the C:\ root directory on Windows systems. The extracted folder contains all necessary files and includes a conf directory where database configuration occurs.
Configuration and Database Connection
The critical configuration step involves editing the sonar.properties file located in the conf directory. Here, administrators must configure the database connection parameters, including sonar.jdbc.username and sonar.jdbc.password with the credentials of the SonarQube database user created earlier. The JDBC URL must be customized to specify the host and database name. For SQL Server users, additional SSL-related parameters such as encrypt=true, trustServerCertificate, and hostNameInCertificate must be configured if SSL is enabled by default on the database server.
Starting SonarQube and Initial Setup
To start SonarQube on Windows, users navigate to the installation directory's bin/windows-x86-64 folder and execute the StartSonar.bat file. During the first startup, SonarQube will create necessary database tables, which may extend the initialization time. Once the console displays "SonarQube was operational," the application is ready for use. Users access SonarQube through a web browser at localhost:9000 and log in with the default credentials (username: admin), after which they must change the password. Commercial editions such as Developer Edition require license activation; users receive a server ID to share with their account representative in exchange for a license key.
Production Deployment and Maintenance
For production environments, SonarQube should be configured as a Windows service rather than run manually. Additionally, administrators should implement HTTP proxy security measures, particularly when deploying on cloud platforms such as Azure or AWS. Troubleshooting guidance can be found in the application logs located in the installation directory's logs folder, with sonar.log and web.log being the primary files to review for most common issues. Once setup is complete, users can begin scanning code through available wizards that guide integration with various DevOps platforms or manual code analysis.
Key Takeaways
- Prerequisites are essential: JDK 17 and a supported database (PostgreSQL, SQL Server, or Oracle) must be installed and configured before SonarQube installation begins
- Database configuration requires attention to detail: Users must create appropriate schemas, users, and permissions, with database-specific settings like case-sensitive collation for SQL Server
- Configuration happens in sonar.properties: Database connection parameters including JDBC URL, username, and password must be properly configured before startup
- First startup takes longer: Initial execution creates database tables, so users should expect extended startup time on first run
- Production deployments require additional steps: Running as a service and implementing security measures like HTTP proxies are recommended for production environments