Skip to content

Sonarqube Installation on Ubuntu 16.04

-== Disclaimer ==-

This is just a custom guide to install and configure SonarQube on Ubuntu 16.04 LTS, this could be more technical and advanced, if you do not understand or don’t know what you are doing, I kindly request you to take extreme caution and the components used here on GCP are billable. SKYDEVOPS/I/WE do not take any responsibility if the guide causes any serious damage or issues, which you have to take full responsibility.

-== Procedure ==-

We shall build a cloud machine on GCP [ Google Cloud Platform ] add the DNS configuration to CloudFlare and create VPN Pool for Firewall configurations on GCP.

-== Installation Guide ==-

Step-01: Update the Package Cache

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

Step-02: Install Oracle Java JDK

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt install oracle-java8-installer

Step-03: Install postgresql DB

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 -
sudo apt-get -y install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresql

Step-04: Change the password for the default PostgreSQL user

sudo passwd postgres

Step-05: Create new user for sonar

su - postgres
createuser sonar
# switch to postgresql prompt
psql
ALTER USER sonar WITH ENCRYPTED password 'StrongPassword';
CREATE DATABASE sonar OWNER sonar;
\q

Step-06: Download Sonar

wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-7.6.zip
sudo unzip sonarqube-7.6.zip -d /opt
sudo mv /opt/sonarqube-7.6 /opt/sonarqube
sudo nano /opt/sonarqube/conf/sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password=StrongPassword
sonar.jdbc.url=jdbc:postgresql://localhost/sonar

Step-07: Install Sonarqube system service

sudo vim /etc/systemd/system/sonar.service

[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

Step-08: Start and enable sonar service

sudo systemctl start sonar
sudo systemctl enable sonar
sudo systemctl status sonar

Step-09: Nginx Reverse Proxy for sonar

server {
    listen 80;
    server_name sonarqube.domain.com;

    location / {
        proxy_pass http://127.0.0.1:9000/;
    }
}

Step-10: Access Sonar 

Access soanr at
sonarqube.domain.com, default username/password are admin/admin

Shashi View All

-== Superman ==-

3 thoughts on “Sonarqube Installation on Ubuntu 16.04 Leave a comment

  1. Hi, your post is interesting and i want to share it in my social media account. But I think you can improve your current google ranks by using Speedrankseo. My brother uses it and it works great. Just google it, it’s very nice tool to bring you a lot of new readers likes me. Keep up the high quality work!

  2. Hi, your post is interesting and i want to share it in my social media account. But I think you can improve your current google ranks by using Speedrankseo. My brother uses it and it works great. Just google it, it’s very nice tool to bring you a lot of new readers likes me. Keep up the high quality work!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: