Easy guide to install SonarQube on Ubuntu 16.04

Do You Need SonarQube?


  1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 2GB RAM and 1 Core processor.
  2. A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  3. Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  4. Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  5. Set up your server’s hostname and create user with root privileges.
  6. Install Apache, MySQL and PHP by following this tutorial

Set Up Your ECS Server

Update Your Ubuntu System

# sudo apt update && sudo apt upgrade

Install add-apt-repository

# sudo apt-get install -y software-properties-common

Install Java JDK

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

Install unzip

# sudo apt-get install unzip

Install PostgreSQL

# 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

Create Directory and Set Permissions

# sudo mkdir /opt/sonar
# sudo chown -R aareez:aareez /opt/sonar

Install SonarQube

# cd /opt/sonar
# sudo wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-7.2.1.zip
# ls -li
# sudo unzip sonarqube-7.2.1.zip

Create and Configure Database

# sudo passwd postgres
# su - postgres
# createuser sqube
# psql
ALTER USER sqube WITH ENCRYPTED password '654321Ab';
# exit

Configure SonarQube

# cd /opt/sonar
# sudo nano sonarqube-7.2.1/conf/sonar.properties

Configure Reverse Proxy for SonarQube

# sudo a2enmod proxy
# sudo a2enmod proxy_http
# sudo nano /etc/apache2/sites-available/softpedia.xyz.conf
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:80>
ServerName www.softpedia.xyz
ServerAdmin admin@softpedia.xyz
ProxyPreserveHost On
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://www.softpedia.xyz/
# sudo a2ensite softpedia.xyz.conf
# sudo systemctl start apache2
# sudo systemctl enable apache2
# sudo adduser sonar
# sudo chown -R sonar:sonar /opt/sonar
# sudo nano /opt/sonar/sonarqube-7.2.1/bin/linux-x86-64/sonar.sh
# opt/sonar/sonarqube-7.2.1/bin/linux-x86-64/sonar.sh start
# /opt/sonar/sonarqube-7.2.1/bin/linux-x86-64/sonar.sh stop




Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Enclave Protocol — Workflow

How I built my first web-app project in 48 hours

Time Complexity of Creating a Heap (or Priority Queue)

Design Principles on Android

Why ‘Requirement Analysis’ is important for testers?

Forget Estimating, Start Counting Instead

Projection = Stories Remaining divided by Stories Done This Week

#SideNotes — Stack — Abstract Data Type and Data Structure

A Student’s Guide to Software Engineering Internship Interviews:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

In the business perspective: what are the benefits and drawbacks of adopting Kubernetes?

Log in to Linux Virtual Machine from windows

How to configure Two Node High Availability Cluster On RHEL/CentOS