How To Install SonarQube 6 Code Quality On Redhat 7/8

We can install sonarqube on centos 7/8. we can also create a sonarqube service to start and stop it. Let’s see, how to install sonarqube on centos 7.

SonarQube is an open-source platform that is designed to continuously check the code quality to perform an automatic review with static analysis of code to detect the bugs, code smell, and security vulnerabilities.

Sonarqube requirements at least 2 GB of RAM and 1 GB ram for the Operating systems. It also requires excellent read/write on the hard drive to perform the operations.

Check Out: How To Install Brave Browser On Ubuntu 20.04/19.10

How To Install Sonarqube 6 On CentOS / Redhat 7/8:

Sonarqube 6 required the Java version 8 installed on the Linux. You can use the below link to download it.


Once you have downloaded the Package, we need to extract it to the below location.

unzip -d /opt/

Now go the location using /opt/sonarqube-6.7.6/conf and take a backup of the original files.

cp wrapper.conf wrapper.conf-org 

Change the owner of the SonarQube directory folder.

chown -R sonarqube:sonarqube /opt/sonarqube-6.7.6

Create a user using useradd sonarqube and set the password with the command passwd sonarqube

Check Out: How To Force Quit Application Running on Windows 8/10

Before starting the configuration for sonarqube, we need to set a few parameters for Elasticsearch.

sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536

Create a database for Sonarqube:

I will use MySQL as a database server for Sonarqube. You can also other databases as well. I have installed the database on the same server.

mysql> CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> grant all privileges on sonar.* to 'sonar'@'localhost' identified by 't0res#fQ3cr3t';
mysql> flush privileges;

Check if you’re able to access the database using the above credentials.

mysql -u sonar -h localhost -p

you must be able to log in if not, you need to check the permission.

Check Out: How To Configure Samba Server For File Sharing On CentOS 7

Sonarqube Installation configuration:

Open the and add the below parameters.


Set the java path in the /opt/sonarqube-6.7.6/conf/wrapper.conf file.

you need to check the java path in your machine and changed it. You can use whereis java command to find the path.

Check Out: How To Edit Hosts File For Changes In Windows 7/10

Once you have configured the settings, you have to open the port 9001 in the firewall rules.

firewall-cmd --permanent --add-port=9001/tcp
firewall-cmd --reload

Create a service for Sonarqube:

We need to manually create service for sonarqube if you don’t want to run it using from the directory

vim /etc/systemd/system/sonarqube.service 
Description=SonarQube service

ExecStart=/bin/nohup java -Xms32m -Xmx32m -jar /opt/sonarqube-6.7.6/lib/sonar-application-6.7.6.jar


Start and enable the service using the below commands.

systemctl start sonarqube && systemctl enable sonarqube

create sonarqube service

Go to the browser and hit the URL:

sonarqube install

Log in using the username admin and password admin. 

sonarqube java version requirements

That’s it. Create sonarqube service

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment