Install SonarQube with MySQL database on CentOS - saviovettoor/DevOps-wiki GitHub Wiki
- Download the latest build from http://www.sonarqube.org/downloads/
- Unzip the downloaded file.
unzip <downloaded_sonar_zip> -d /opt/- Refer Install-and-Setup-MySQL-5.6-on-CentOS for MySQL installation and Setup
- Login as root use and run below queries
]# mysql -u root -p
mysql> CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> CREATE USER 'sonarqube' IDENTIFIED BY 'password';
mysql> GRANT ALL ON sonarqube.* to sonarqube@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
Edit **sonar.properties** files at <base_dir>/sonarqube/conf
* Update sonar database **sonar.jdbc.username** and **sonar.jdbc.password** properties. Uncomment below lines and update the credentials if required.
sonar.jdbc.username=sonarqube
sonar.jdbc.password=password
* Update Database connection - Uncomment **sonar.jdbc.url** property and update the hostname and port if required
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
* Navigate to sonarqube bin directory
]#cd <base_path>/sonarqube/bin/linux-x86-64
update configure SonarQube to run as a sonarqube user
make the change in sonar.sh
change RUN_AS_USER=sonarqube
Make sure that "sonarqube" user you have created
]#adduser sonarqube
Otherwise when you start sonar you will see following error.
groups: sonarqube: no such user
chown: invalid user: ‘sonarqube:sonarqube’
su: user sonarqube does not exist
- Navigate to sonarqube bin directory
# cd <base_path>/sonarqube/bin/linux-x86-64
- Start Sonarqune
# ./sonar.sh start
Note: The initial startup takes some time. Please check the log <base_path>/sonarqube/logs/sonar.log for the startup status
- Stop sonarqube
# ./sonar.sh stop
Open the url http://HOSTMACHINE_IP>:9000/setup on your browser and wait for the process to complete. The page will be automatically redirected to http://HOSTMACHINE_IP:9000/ once the database setup is complete.
Browse http://localhost:9000/ for the sonar WebUI
Note: the default admin credentials for sonarqube is admin/admin
* Get the plugins from http://docs.sonarqube.org/display/SONAR/Plugin+Library
* Copy the plugins jar files to <base_path>/sonarqube/extensions/plugins/ directory
* Restart the sonarqube
* Once the webui is up, login as admin and open the settings page. You'll be able to see all plugins there.
Note: If the plugin is not compatible with the sonarquve version that you are running, you'll be seeing that in the error logs.