Full installation in 5 steps
Step 1 - Install the database
Apache Derby is embedded by default with Sonar. It does not need any installation. It's great for demos and tests but we advice you to use a robust database for real use. The following are currently supported : MySQL 5.x, Oracle 10g XE, SQL Server 2005. It may work on other versions.
We recommend to create *an UTF-8 database* named 'sonar' accessed by a specific user 'sonar'. Here is an example with MySQL :
Tables and indexes are automatically created when browsing the first time to the homepage (see step 3).
Step 2 - Install the server
Download and unzip the [distribution|http://sonar.codehaus.org/downloads/].
Step 3 - Configure the database
If you do not use the default embedded database, edit conf/sonar.properties to configure the database access. Templates are available for MySQL and Oracle. Just uncomment them and comment the first four lines dedicated to derby.
* sonar.jdbc.url : the URL of the database
* sonar.jdbc.driver : the class of the driver
* sonar.jdbc.user : the username (default is 'sonar')
* sonar.jdbc.password : the password (default is 'sonar')
Example for MySQL :
For commercial databases, copy the JDBC driver to /extensions/jdbc-driver/[YOUR DATABASE]/. MySql and jTDS for SqlServer drivers are already provided.
Step 4 - Start the server
Mode 1 - Start the standalone application
The default listen port is 9000 and the context path is /, so the web server listens to [http://localhost:9000]. To change these parameters, edit the file conf/sonar.properties. Here is an example to listen to [http://localhost:80/sonar] :
Execute the following script to start the server :
* on linux/mac : bin/[YOUR PLATEFORM]/sonar.sh start
* on windows : bin/windows-x86-32/StartSonar.bat
Note that you can also run as a NT service with bin/windows-x86-32/InstallNTService.bat then bin/windows-x86-32/StartNTService.bat
You can now browse to [http://localhost:9000] and follow the setup instructions.
Mode 2 - Deploy on application server
More details on the page [SONAR:Deploy on application server]
Step 5 - Configure Maven2
Sonar uses a Maven2 plugin to analyze sources and to inject measures into the database. That's why database properties must be defined into the Maven2 configuration. Edit the [settings.xml|http://maven.apache.org/settings.html] file, located into $MAVEN_HOME/conf or ~/.m2, and add the four parameters from step 2.
If data collection and server are on different boxes, set the server host with the property 'sonar.host.url'.