• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Install SonarQube on Ubuntu 16.04

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
164
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Using a Different System?
  2. Prerequisites
  3. Step 1: Perform a system update
  4. Step 2: Install JDK
  5. Step 3: Install and configure PostgreSQL
  6. Step 4: Download and configure SonarQube
  7. Step 5: Configure Systemd service
  8. Step 5: Configure reverse proxy
  9. Step 6: Finish install
  10. Want to contribute?

Using a Different System?

  • How to Install SonarQube on CentOS 7

Are we missing a guide for your target system? Request one, or submit your own!


SonarQube is an open source tool for quality system development. It is written in Java and supports multiple databases. It provides capabilities to continuously inspect code, show the health of an application, and highlight newly introduced issues. It contains code analyzers which are equipped to detect tricky issues. It also integrates easily with DevOps.

In this tutorial, we will install the latest version of SonarQube on Ubuntu 16.04.

Prerequisites

  • A Vultr 64-bit Ubuntu 16.04 server instance with at least 2 GB RAM.
  • A sudo user.

Step 1: Perform a system update

Before installing any packages on the Ubuntu server instance, it is recommended to update the system. Log in using the sudo user and run the following commands to update the system.

sudo apt-get update
sudo apt-get -y upgrade

Step 2: Install JDK

Add the Oracle Java repository on the server by running.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Install Oracle JDK by typing:

sudo apt install oracle-java8-installer

You can now check the version of Java by typing:

java -version

Step 3: Install and configure PostgreSQL

Install the PostgreSQL repository.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Install the PostgreSQL database server by running:

sudo apt-get -y install postgresql postgresql-contrib

Start PostgreSQL server and enable it to start automatically at boot time by running:

sudo systemctl start postgresql
sudo systemctl enable postgresql

Change the password for the default PostgreSQL user.

sudo passwd postgres

Switch to the postgres user.

su - postgres

Create a new user by typing:

createuser sonar

Switch to the PostgreSQL shell.

psql

Set a password for the newly created user for SonarQube database.

ALTER USER sonar WITH ENCRYPTED password 'StrongPassword';

Create a new database for PostgreSQL database by running:

CREATE DATABASE sonar OWNER sonar;

Exit from the psql shell:

/q

Switch back to the sudo user by running the exit command.

Step 4: Download and configure SonarQube

Download the SonarQube installer files archive.

wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.4.zip

You can always look for the link to the latest version of the application on the SonarQube download page.

Install unzip by running:

apt-get -y install unzip

Unzip the archive using the following command.

sudo unzip sonarqube-6.4.zip -d /opt

Rename the directory:

sudo mv /opt/sonarqube-6.4 /opt/sonarqube

Open the SonarQube configuration file using your favorite text editor.

sudo nano /opt/sonarqube/conf/sonar.properties

Find the following lines.

#sonar.jdbc.username=
#sonar.jdbc.password=

Uncomment and provide the PostgreSQL username and password of the database that we have created earlier. It should look like:

sonar.jdbc.username=sonar
sonar.jdbc.password=StrongPassword

Next, find:

#sonar.jdbc.url=jdbc:postgresql://localhost/sonar

Uncomment the line, save the file and exit from the editor.

Step 5: Configure Systemd service

SonarQube can be started directly using the startup script provided in the installer package. As a matter of convenience, you should setup a Systemd unit file for SonarQube.

nano /etc/systemd/system/sonar.service

Populate the file with:

[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=forking

ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop

User=root
Group=root
Restart=always

[Install]
WantedBy=multi-user.target

Start the application by running:

sudo systemctl start sonar

Enable the SonarQube service to automatically start at boot time.

sudo systemctl enable sonar

To check if the service is running, run:

sudo systemctl status sonar

Step 5: Configure reverse proxy

By default, SonarQube listens to localhost on port 9000. In this tutorial, we will use Apache as the reverse proxy so that the application can be accessed via the standard HTTP port. Install the Apache web server by running:

sudo apt-get -y install apache2

Enable mod_proxy.

sudo a2enmod proxy
sudo a2enmod proxy_http

Create a new virtual host.

sudo nano /etc/apache2/sites-available/sonar.yourdomain.com.conf

Populate the file with:

<VirtualHost *:80>  
    ServerName sonar.yourdomain.com
    ServerAdmin [email protected]
    ProxyPreserveHost On
    ProxyPass / http://localhost:9000/
    ProxyPassReverse / http://localhost:9000/
    TransferLog /var/log/apache2/sonar.yourdomain.com_access.log
    ErrorLog /var/log/apache2/sonar.yourdomain.com_error.log
</VirtualHost>

Enable the virtual host.

sudo a2ensite sonar.yourdomain.com.conf

Start Apache and enable it to start automatically at boot time:

sudo systemctl start apache2
sudo systemctl enable apache2

If your server is already running, restart it using:

sudo systemctl restart apache2

Step 6: Finish install

Start the SonarQube service:

sudo systemctl start sonar

SonarQube is installed on your server, access the dashboard at the following address.

http://sonar.yourdomain.com

Log in using the initial administrator account, admin and admin. You can now use SonarQube to continuously analyze the code you have written.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How To Create A Blog With Hugo

Next Post

How to Install and Configure Graphite on Ubuntu 16.04

Next Post

How to Install and Configure Graphite on Ubuntu 16.04

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet