Installing SonarQube on Linux machine
Please follow the below steps to install sonar.
- Download SonarQube & SonarQube Analyzer(ex. SonarQube Runner) from the below link
- Unzip or untar both compressed files into a folder (ex. /opt).
- SonarQube required Xdebug
- yum install php-pecl-xdebug
- Create a shell script file named ‘sonar-runner.sh’ under ‘/etc/profile.d/’ with the following content
- export SONAR_RUNNER_HOME=/opt/sonar-runner
- export PATH=$SONAR_RUNNER_HOME/bin
- Explanation for the above code - export the bin folder of sonar-runner.
- Create a database for sonar and create user for sonar(if required)
- create database sonar;
- create user ‘sonar’ identified by ‘sonar’
- grant all on sonar.* to ‘sonar’@’%’ identified by ‘sonar’
- grant all on sonar.* to ‘sonar’@’localhost’ identified by ‘sonar’
- flush privileges;
- Change the configuration accordingly in the following files
- /opt/sonar/conf/sonar.properties
- /opt/sonar/conf/wrapper.conf (Change jdk path, if needed)
- /opt/sonar-runner/conf/sonar-runner.properties
- Configuration files listed above are self-explanatory, for updating the configurations
- Try to start sonar by using the following command
- service sonar start
- Verify the sonar installation by hitting http://localhost:9000/ (Url with default port and can be changed in configuration files)
- Default credentials
- Username: admin
- Password: admin
Issue remedies:
- If sonar service status displayed as started, but you are unable to reach the URL. Then, check the port used in the url and configuration, whether both are same.
- Execute the shell script file under sonar/bin directory