AWS Documentation

  1. Home
  2. Docs
  3. AWS Documentation
  4. Amazon Linux 2 SonarQube 9.3

Amazon Linux 2 SonarQube 9.3

This AMI provides a SonarQube server.

This AMI supports following versions.

  • Amazon Linux 2 AMI (HVM)
  • SonarqQube 9.3
  • nginx 1.20

Web Server

We prepared SSL/TLS, so you can access to top page using https://.

When we access SonarQube top page, you will receive certificate error like this image below. It is due to the fact that the setting for SSL/TLS on Web server is self-signed dummy certificate.

For simplicity, click on the Advanced button, and click Proceed to {ip-address} (unsafe) to access SonarQube or type thisisunsafe in browser if you use Google chrome.

If you want to set up a CA signed certificate, please refer to the following document for Step 2: Obtain a CA-signed Certificate

Once you proceed, you will see login screen.

SonarQube initial password

You can find SonarQube initial password from EC2 management console System Log.

You can also SSH into your instance and find the login credential using the following command.

$ cat /home/ec2-user/credentials
////////////////////credentials info////////////////////
--- SonarQube
----- User: admin
----- Password : admin
--- PostgreSQL
----- User: sonarqube
----- Password : 1OyoszoecyBlc8rg
////////////////////////////////////////////////////////

Log in to SonarQube.

Login ID: admin

Password: admin

Then you can change an admin password.

Create a new project and start analysis

Create your project from your favorite platform or you can create a project manually.

This instruction will show you how to create and set up a project manually.

Choose “Manually”. Input your “Project display name” and “Project key”, then click “Set Up”.

You can choose your CI. In this instruction, choose “Locally”.

Generate SonarQube token in the next page, input your token key and click “Generate” as below.

Click “Continue”, and select project’s language and OS on your local computer. Download and unzip the Scanner.

macOS and Linux

After download the SonarQube Scanner zip file, extract into /usr/local for example.

$ sudo unzip -d /usr/local sonar-scanner-cli-*.zip

Go to your project root and run sonnar-scanner. You can copy command line parameters below.

NOTE: We use non-ssl(http) url for -Dsonar.host.url option in the example below.

$ cd YOUR_PROJECT_ROOT

$ /usr/local/sonar-scanner-*/bin/sonar-scanner \
  -Dsonar.projectKey=sonarqube-test \
  -Dsonar.sources=. \
  -Dsonar.host.url=http://18.207.184.109 \
  -Dsonar.login=ceec106b1500685c8cf44ad428e9d231de7b5349

Windows

After download the SonarQube Scanner zip file, extract into c:\sonar-scanner for example. Go to your project root and run sonnar-scanner. You can copy command line parameters below.

NOTE: We use non-ssl(http) url for -Dsonar.host.url option in the example below.

cd YOUR_PROJECT_ROOT

"c:\sonar-scanner\bin\sonar-scanner.bat" ^
  -D"sonar.projectKey=sonarqube-test" ^
  -D"sonar.sources=." ^
  -D"sonar.host.url=http://18.207.184.109" ^
  -D"sonar.login=ceec106b1500685c8cf44ad428e9d231de7b5349" 

NOTE: As we installed self-signed dummy SSL certificate for test purpose, we have to make Sonar Scanner client to trust our self-signed dummy certificate, or use non-ssl(http) url for -Dsonar.host.url option. We strongly recommend to register static domain and setup trusted certificate in production. For SSL configuration, please refer to Tutorial: Configure SSL/TLS on Amazon Linux 2

For more details about SonarQube and SonarQube Scanner, please refer to SonarQube Documentation

Reference

  1. Tutorial: Install a LAMP Web Server on Amazon Linux 2
  2. Tutorial: Configure SSL/TLS on Amazon Linux 2
  3. Amazon EC2 Instance IP Addressing
  4. SonarQube Documentation

How can we help?