How to install and configure Sonarqube on CentOS 7 step by step guide



In this article we learn about what is Sonarqube and how to setup sonarqube on centos server.

What is Sonarqube?

Sonarqube is free great tool which is most popular tool all over the world and used for source code measurement, code analysis.

Recommended ReadHow to install EPEL repo on CentOS7 / RHEL7 server step by step guide

Install and configuration mariadb database for sonarqube.

To install mariadb database we need to execute the below command.

[root@localhost ~]#yum install mariadb-server mariadb

After installing the database we need to start the mariadb service and enable it at atartup mode using the below command.


[root@localhost ~]#systemctl start marriadb
[root@localhost ~]#systemctl enable marriadb

After start mariadb service we need to secure the database using the following command.


[root@localhost ~]#mysql_secure_installation

Now we login the mysql server and create database for sonarqube and user as below.


[root@localhost ~]# mysql -u root -p
MariaDB [(none)]>CREATE DATABASE sonarqubedb;
MariaDB [(none)]>CREATE USER 'sonarqube'@'localhost' IDENTIFIED BY 'sonar';
MariaDB [(none)]>GRANT ALL PRIVILEGES ON sonarqubedb.* TO 'sonarqube'@'localhost';
MariaDB [(none)]>FLUSH PRIVILEGES;
MariaDB [(none)]>exit

Installation and setup sonarqube server on centos

Before installation and setup sonarqube server we need to install java using yum command and unzip package using the below command.

[root@localhost ~]# yum install java-1.8.0-openjdk unzip –y

After installing java we need to verify the java version using the below command.
[root@localhost ~]# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Then we download the sonarqube package on /opt directory using the below command.

[root@localhost ~]# cd /opt
How to install and configure Sonarqube on CentOS 7 step by step guide
How to install and configure Sonarqube on CentOS 7 step by step guide



Unzip the downloaded file and rename the folder using the below command.

[root@localhost opt]#unzip sonarqube-6.4.zip
[root@localhost opt]#mv sonarqube-6.4 sonarqube

Then open “/opt/sonarqube/conf/sonar.propertiesfile and change the parameter value as below.you can change the value as per your requirement.

sonar.jdbc.username=sonarqube
sonar.jdbc.password=sonar

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false


By default sonar service is running on 9000 port.

If you want to enable iptables on the linux system you must allow 9000 port to accept the request.

Start the sonarqube service on centos

To start sonarqube service we need to go “/opt/sonarqube/bin/linux-x86-64” directory and execute the below command.

[root@localhost bin]#./sonar.sh start

After starting this service we open the browser and type the following url to access the sonar web interface.

http:// server-ip address:9000



That’s all. If this article is helpful please share it!!!!







                       


                                                Share This Article On Whatsapp

                                                                 Support Our Effort


     
Please Donate To Bitcoin Address: [[address]]
Donation of [[value]] BTC Received. Thank You.
[[error]]
SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

3 comments:

  1. what' s version of mariadb did you use?
    I'm using 10.13 but it didn't work.

    ReplyDelete
  2. This is really an amazing post, thanks for sharing such a valuable information with us.
    DevOps Training
    DevOps Online Training
    DevOps Training in Ameerpet

    ReplyDelete
  3. https://youtube.com/channel/UCPGQh38ZZLXbSIJbVtauYPQ
    Linux (Redhat, Centos, Ubuntu)
    Git
    Jenkins
    Maven
    Tomcat
    Nexus
    SonarQube
    Ansible
    Docker
    Kubernetes
    Terraform
    Nagios
    Graffana
    Docker
    AWS
    AWS-DevOps

    ReplyDelete