SonarQubeTM is made of 3 components:
- A Database that stores the configuration and results of quality analyses
- A Web Server that is used to navigate the results of the analyzes and make configuration
- A Client that will run source code analyzers to compute data on projects
SonarQubeTM supports several database engines.
If you simply want to run a quick test or do a demo, you can use the H2 (Apache Derby prior to SonarQubeTM 3.2) database that's shipped with SonarQubeTM and doesn't require any installation on your part. However, H2 (Derby prior to SonarQubeTM 3.2) must not be used for production.
To use one of the other databases, you simply need to create a schema and a sonarqube user and give the user permissions to create, update and delete objects in the schema. Tables and indexes will be created automatically when you launch SonarQubeTM for the first time. A sample script to create the schema and the user and to grant the necessary permissions in MySQL can be found here.
Installing SonarQubeTM Server
- Prior to the installation, check the requirements.
- Download and unzip the distribution (note that native packages are also available for Linux distributions, see this documentation page for more details).
If you're not using the default embedded database, you need to edit SONAR_HOME/conf/sonar.properties to configure the database properties. Templates are available for every supported database. Just uncomment and configure the template you need and comment out the lines dedicated to H2 (Derby prior to version 3.2):
sonar.jdbc.url: the URL of the database
sonar.jdbc.user: the username
sonar.jdbc.password: the password
For Oracle, copy the JDBC driver into the SONAR_HOME/extensions/jdbc-driver/oracle directory. Drivers for the other supported databases are already provided. (Do not replace the provided drivers; they are the only ones supported).
Starting SonarQubeTM Server
The default port is 9000, the default context path is / and SonarQubeTM listens by default to all network interfaces: '0.0.0.0'. Once launched, the SonarQubeTM web server is available on http://localhost:9000. Parameters can be changed in the SONAR_HOME/conf/sonar.properties file:
Execute the following script to start the server:
- On Linux/Mac OS: bin/<YOUR OS>/sonar.sh start
- On Windows: bin/windows-x86-32/StartSonar.bat
- Read Installing on AIX, HPUX or Solaris for other platforms
You can now browse to http://localhost:9000.
Advanced Installation Features
- Deploying SonarQubeTM on a Tomcat or Jetty
- Running SonarQubeTM as a Service on Windows or Linux
- Running SonarQubeTM behind a Proxy
There are different clients available for launching analyses:
- Sonar Runner: recommended as the default one, see installation and configuration guide.
- Maven: recommended for projects built with Maven, see installation and configuration guide.
- Ant Task: recommended for projects built with Ant, see installation and configuration guide.
- Gradle: recommended for projects built with Gradle, see installation and configuration guide.
- CI Engine: see Jenkins plugin or Hudson plugin or Bamboo plugin or AnthillPro plugin. Note that other CI engines can be used even if there is no SonarQubeTM plugin available.