Sonarqube Installation on centos 7/Rhel

Sonarqube is opensource continuous code quality integration tool. By using sonarqube we can identifies code vulnerabilities,bugs and code quality. In this recipe i will show you how to install sonarqube on centos 7 and  rhel 7 amazon linux and i will show you how to configure sonarqube with mysql in centos rhel and amazon linux..

Install mysql:

in the following steps i will configure sonarqube with mysql. Download the repository, update and install MySQL

Create db and user for Sonarqube:

Login into MySQL and execute below commands step by step.

to login to MySQL use this command “mysql -u root”

Download and install SonarQube:

Create a user for SonarQube:

Create a new user for SonarQube. Because we cannot run the newer versions of sonarqube as the root user. If you run sonarqube with root user will get error like java.lang.RuntimeException: can not run elasticsearch as root.

Since we are running SonarQube as a separate user, assign proper ownership to SonarQube files.

Open the SonarQube startup script and specify the sonarqube user details.

Configure sonarqube with MySQL database:

open the SonarQube configuration file

vi /opt/sonarqube/conf/ add the below lines

Start SonarQube

You can now start SonarQube by running the following command.

That’s all we have configured sonarqube successfully in centos and rhel.

If you have done everything correctly, You can access sonarqube using http://ipaddress:9000

Note: for sonarqube you need minumum 2gb ram in your server. then only sonarqube will work as expected.

The following are optional

Configuring sonarqube as a Systemd service:

if you want to configure sonar as a systemd service follow below steps

restart the sonar service with systemd:

verify the status with sudo systemctl status sonar

Change sonarqube port and web context:

By default, sonar will run on 9000. If you want to access sonarqube like http://url/sonar follow below steps

if you want to change just port number of sonarqube server, add sonar.web.port=XXX X  to file and restart the sonarqube service.

  • install sonarqube on centos 7
  • how to install sonarqube in centos 6
  • sonarqube installation
  • sonarqube mysql setup
  • sonarqube installation and configuration
  • install sonarqube on amazon linux
  • install sonarqube on rhel7