Easy guide to install SonarQube on Ubuntu 16.04

Do You Need SonarQube?

Prerequisites

  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';
CREATE DATABASE sqube OWNER sqube;
\q
# 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/
</VirtualHost>
# 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

Lesson 42: The Counting Sort Algorithm

One way to create Bot — Slack

A World Full of Traditional Software and Developers: How Cartesi Bridges the Gap

System and Hardware Information using Python — PyShark

Building a data pipeline using BeautifulSoup, Apache Kafka, Apache Spark Streaming and MySQL

MySQL — The Architecture

Agile Development Without the Bullshit

Fission: A Deep Dive Into Serverless Kubernetes Frameworks (2)

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

Deploy Root Certificates to Debian-based Linux systems with Ansible

Automate Kubernetes Cluster Using Ansible

Kali GUI on AWS with NICE DCV

Kali desktop