How to Set up SonarQube on Ie8 18.04 LTS

SonarQube is an free system to consistently examine rule high top quality of programs. It is coded in Coffee terminology and facilitates several data source. You can examine rule look the healthiness of an program for more than 20 development different languages such as Coffee, C, C++, C#, PHP, and web different languages like JavaScript, HTML and CSS. SonarQube can evaluate resource rule, discover protection weaknesses, identify insects and display the outcome on web-based dash panel. You can simply incorporate SonarQube with Expert, Ant, Gradle, MSBuild, LDAP, Effective Listing and GitHub.

In this guide, we will discover how to set up SonarQube on an Ie8 18.04 LTS (Bionic Beaver) web server.

Requirements

  • A web server operating Ie8 18.04.
  • A non-root customer with sudo privileges.

Getting Started

Before beginning, you will need to update your body with the newest edition. You can do this by operating the following command:

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

Once your body is modified, reboot the program to implement the changes.

Install Java

SonarQube is coded in Coffee terminology, so you will need to set up Coffee to your body. First, add the Coffee data source with the following command:

sudo add-apt-repository ppa:webupd8team/java

Next, update the data source and set up Coffee with the following command:

sudo apt-get update -y
sudo apt-get set up oracle-java8-installer -y

Once the Coffee is set up, examine the Coffee edition using the following command:

java -version

Output:

openjdk edition "10.0.2" 2018-07-17
OpenJDK Playback Atmosphere (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3, combined mode)

Install and Set up PostgreSQL

By standard, the newest form of PostgreSQL is not available in the Ie8 18.04 standard data source. So you will need to add the PostgreSQL data source to your body.

You can do this with the following command:

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 -

Next, update the data source and set up PostgreSQL with the following command:

sudo apt-get update -y
sudo apt-get set up postgresql postgresql-contrib

Once the set up is completed, examine the position of PostgreSQL with the following command:

sudo systemctl position postgresql

Output:

? postgresql.service - PostgreSQL RDBMS
 Loaded: packed (/lib/systemd/system/postgresql.service; enabled; resource preset: enabled)
 Active: active (exited) since Sun 2018-12-02 08:49:29 UTC; 4h 30min ago
 Process: 1295 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Primary PID: 1295 (code=exited, status=0/SUCCESS)

Dec 02 08:49:29 ubuntu1804 systemd[1]: Starting PostgreSQL RDBMS...
Dec 02 08:49:29 ubuntu1804 systemd[1]: Began PostgreSQL RDBMS.

Next, change to the postgres customer with the following command:

su - postgres

Next, develop a sonar customer with the following command:

createuser sonar

Next, change to the PostgreSQL spend with the following command:

psql

Next, set protection password for sonar customer and create a sonar data source with the following command:

ALTER USER sonar WITH ENCRYPTED protection password 'password';
CREATE DATABASE sonar OWNER sonar;

Next, exti from the PostgreSQL shell:

q

Install and Set up SonarQube

First, develop a customer for SonarQube with the following command:

sudo adduser sonar

Next, obtain the newest form of SonarQube with the following command:

wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-6.7.6.zip

Once the obtain is completed, unzip the downloadable information file with the following command:

unzip sonarqube-6.7.6.zip

Next, duplicate the produced directory to the /opt with the following command:

sudo cp -r sonarqube-6.7.6 /opt/sonarqube

Next, give possession to the sonar customer with the following command:

sudo chown -R sonar:sonar /opt/sonarqube

Next, you will need to configure SonarQube to run as a sonar customer. You can do this with the following command:

sudo new ipod nano /opt/sonarqube/bin/linux-x86-64/sonar.sh

Make the following changes:

RUN_AS_USER=sonar

Save and shut the information file. Then, start SonarQube standard settings information file and change the data source qualifications with the one we designed earlier:

sudo new ipod nano /opt/sonarqube/conf/sonar.properties

Make the following changes:

sonar.jdbc.username=sonar
sonar.jdbc.password=password
sonar.jdbc.url=jdbc:postgresql://localhost/sonar
sonar.web.host=127.0.0.1
sonar.search.javaOpts=-Xms512m -Xmx512m

Save and shut the information file, when you are completed.

Create Systemd Support information declare SonarQube

Next, you will need to develop a systemd service information file to handle SonarQube service. You can do this with the following command:

sudo new ipod nano /etc/systemd/system/sonar.service

Add the following lines:

[Unit]
Description=SonarQube service
After=syslog.target system.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=sonar
Group=sonar
Restart=always

[Install]
WantedBy=multi-user.target

Save and shut the information file, when you are completed. Then, begin SonarQube service and allow it to begin with on start time with the following command:

sudo systemctl begin sonar
sudo systemctl allow sonar

You can examine the position of SonarQube service with the following command:

sudo systemctl position sonar

Output:

? sonar.service - SonarQube service
 Loaded: packed (/etc/systemd/system/sonar.service; disabled; resource preset: enabled)
 Active: active (running) since Sun 2018-12-02 13:55:34 UTC; 2min 52s ago
 Process: 2339 ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh begin (code=exited, status=0/SUCCESS)
 Primary PID: 2396 (wrapper)
 Tasks: 133 (limit: 2323)
 CGroup: /system.slice/sonar.service
 ??2396 /opt/sonarqube/bin/linux-x86-64/./wrapper /opt/sonarqube/bin/linux-x86-64/../../conf/wrapper.conf wrapper.syslog.ident=SonarQ
 ??2399 java -Dsonar.wrapped=true -Djava.awt.headless=true -Xms8m -Xmx32m -Djava.library.path=./lib -classpath ../../lib/jsw/wrapper-
 ??2445 /usr/lib/jvm/java-8-oracle/jre/bin/java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOc
 ??2545 /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -
 ??2622 /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -

Dec 02 13:55:33 ubuntu1804 systemd[1]: Starting SonarQube service...
Dec 02 13:55:33 ubuntu1804 sonar.sh[2339]: Starting SonarQube...
Dec 02 13:55:34 ubuntu1804 sonar.sh[2339]: Began SonarQube.
Dec 02 13:55:34 ubuntu1804 systemd[1]: Began SonarQube service.

Configure Apache for SonarQube

By standard, SonarQube concentrates on slot 9000. So, you will need to set up and configure Apache as the opposite proxies to gain accessibility to SonarQube using slot 80.

To do so, set up Apache with the following command:

sudo apt-get set up apache2 -y

Next, allow mod_proxy component with the following command:

sudo a2enmod proxy
sudo a2enmod proxy_http

Next, create an Apache exclusive variety information declare SonarQube with the following command:

sudo new ipod nano /etc/apache2/sites-available/sonar.conf

Add the following lines:

<VirtualHost *:80>
 ServerName example.com
 ServerAdmin [email protected]
 ProxyPreserveHost On
 ProxyPass / http://127.0.0.1:9000/
 ProxyPassReverse / http://127.0.0.1:9000/
 TransferLog /var/log/apache2/sonarm_access.log
 ErrorLog /var/log/apache2/sonar_error.log
</VirtualHost>

Replace example.com with your own sector address. Preserve and shut the information file. Then, allow SonarQube exclusive variety information file with the following command:

sudo a2ensite sonar

Finally, reboot Apache and SonarQube plan implement all the changes with the following command:

sudo systemctl reboot apache2
sudo systemctl reboot sonar

By standard, SonarQube shops their records on /opt/sonarqube/logs directory. You can examine SonarQube log with the following command:

sudo end -f /opt/sonarqube/logs/sonar.log

Output:

Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
 Trademark 1999-2006 Tanuki Application, Inc. All Rights Arranged.

2018.12.02 13:55:43 INFO app[][o.s.a.AppFileSystem] Washing or developing temperature directory /opt/sonarqube/temp
2018.12.02 13:55:44 INFO app[][o.s.a.es.EsSettings] Elasticsearch hearing on /127.0.0.1:9001
2018.12.02 13:55:45 INFO app[][o.s.a.p.ProcessLauncherImpl] Release process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
2018.12.02 13:55:45 INFO app[][o.s.a.SchedulerImpl] Patiently awaiting Elasticsearch to be up and running
2018.12.02 13:55:48 INFO app[][o.e.p.PluginsService] no segments loaded
2018.12.02 13:55:48 INFO app[][o.e.p.PluginsService] packed plug-in [org.elasticsearch.transport.Netty4Plugin]
2018.12.02 13:56:34 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2018.12.02 13:56:34 INFO app[][o.s.a.p.ProcessLauncherImpl] Release process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-oracle/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:./lib/server/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.1.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process420500314195865484properties

You can also examine SonarQube web log using the following command:

sudo end -f /opt/sonarqube/logs/web.log

Output:

2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarJava / 4.15.0.12310 / 572454b93016ec73a53fe0e07b2ffdc356d21ba9
2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarPHP / 2.11.0.2485 / 741861a29e5f9a26c6c99c06268facb6c4f4a882
2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarPython / 1.8.0.1496 / 3fe3bc4d0273a5721ea2fb368dc45b1bb82fede3
2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarQube :: Plug-ins :: SCM :: Git / 1.3.0.869 / 4da53e3f9e55f4f2e5796625cb0c5768ed152079
2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarQube :: Plug-ins :: SCM :: SVN / 1.6.0.860 / 2111fdbd1dddda4ad6d4ed6486fd0b18c1010d3b
2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarTS / 1.1.0.1079 / 042c9e65239a47d92d305f9767f730b3cc1e5ed3
2018.12.02 13:57:03 INFO web[][o.s.s.p.ServerPluginRepository] Set up plug-in SonarXML / 1.4.3.1027 / 39588245cecf538bb27be4e496ff303b0143d20b
2018.12.02 13:57:07 INFO web[][o.s.s.p.d.m.c.PostgresCharsetHandler] Confirm that data source charset facilitates UTF8
2018.12.02 13:57:09 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet narrow [email protected] [pattern=UrlPattern{inclusions=[/api/system/migrate_db/*, ...], exclusions=[/api/properties*, ...]}]
2018.12.02 13:57:09 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP plug allowed on slot 9000
2018.12.02 13:57:16 INFO web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties (no proxy)

Access SonarQube

SonarQube is now set up and designed. It’s the perfect a chance to gain accessibility to it through web web browser.

Open your web web browser and kind the URL http://example.com. You will be rerouted to the following page:

SonarQube

Here, simply just click the Log In key. You should see the following page:

Log In

Provide the standard manager consideration details as administration / administration and simply just click the Log In key. You should see the SonarQube standard dash panel in the following page:

SonarCube Dashboard

Congratulations! you have efficiently set up SonarQube on Ie8 18.04 web server. You can now quickly execute automated opinions look the healthiness of an program using SonarQube.

Post Author: Hack3rN3ws

Leave a Reply

Your email address will not be published. Required fields are marked *