How To Install SonarQube On Ubuntu 18.04
How To Install SonarQube On Ubuntu 18.04

Introduction

SonarQube inspects the quality of code of applications and it is an open-source platform that supports multiple databases. We can check the health status of an application for multiple languages like C, C++, Java, PHP, C#, and many web languages including HTML, CSS, and JavaScript.

SonarQube can easily be integrated with Gradle, Ant, Maven, Active directory, Github, and LDAP and can detect bugs that display results on the dashboard.

In this tutorial, you will learn to install and configure SonarQube on Ubuntu 18.04 server.

Prerequisites

  • An Ubuntu 18.04 server up and running.
  • A non-root user with sudo privileges.
  • Memory –  Min 3GB
  • Java version 8
  • Database PostgreSQL


Note: SonarQube has stopped supporting MySQL from release 7.9 and started supporting PgSQL.

Steps to Install SonarQube On Ubuntu 18.04

  • Update your system
  • Create a new user for sonarqube (e.g. sonar) which will only be used to manage sonarqube services
  • Create a new directory to install sonarqube
  • Switch from current directory to sonarqube’s directory
  • Download SonarQube and unzip it
  • Change the permissions and ownership to the sonar user and its directory
  • Edit the below file and configure it to make it run as a sonar user
  • Modify the file and save the changes
  • Create the database and credentials for SonarQube
  • Open the default configuration file for SonarQube
  • Modify the database details with those which we just created above
  • Change the below details

Save and Close the file to apply the changes!

Create a new Systemd Service file for SonarQube

  • Edit the below file and create a systemd service file to maintain the services of SonarQube.
  • Add the below lines into this file
  • Save and Close the file to apply the changes.
  • Start the service and enable it to start at boot time
  • SonarQube is successfully installed now, you can review it by opening the below URL in the browser

    ​​​​​​​Note: The default port for the SonarQube is 9000

  • You will be redirected to the page as below
  • Click on the Log in button and enter the credentials

    Note: The default credentials for SonarQube are “admin/admin”

  • After login, you will be prompted to the below Dashboard page

The SonarQube is now successfully installed and configure.
Thanks!

Conclusion

By following the steps mentioned in above article you can easily install and conconfigure SonarQube on Ubuntu 18.04.

Related Posts