Install SonarQube on Ubuntu
This page walks through a practical SonarQube installation using PostgreSQL on Ubuntu.
Before You Start
- Ubuntu 20.04, 22.04, or 24.04
- At least 4 GB RAM, with 8 GB preferred
- Java 17
Install Java:
sudo apt update
sudo apt install openjdk-17-jdk -y
java -version
Step 1: Install PostgreSQL
sudo apt install postgresql postgresql-contrib -y
Create the database and user:
sudo -u postgres psql
CREATE USER sonar WITH PASSWORD 'sonar';
CREATE DATABASE sonar OWNER sonar;
GRANT ALL PRIVILEGES ON DATABASE sonar TO sonar;
\q
Step 2: Download and Install SonarQube
Download the current package from the official downloads page.
wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-2026.1.2.zip
sudo apt install unzip -y
unzip sonarqube-*.zip
sudo mv sonarqube-* /opt/sonarqube
Step 3: Create a Dedicated User
sudo useradd -r -m -U -d /opt/sonarqube -s /bin/false sonar
sudo chown -R sonar:sonar /opt/sonarqube
Next Step
Continue with database and runtime configuration in configuration.md.