How to install Sonarqube in ubuntu

Published: 24 January 2023
on channel: Quickloss3
587
15

Update Server:
apt update && apt upgrade -y

Install OpenJDK:
sudo apt-get install openjdk-11-jdk -y

Install and Configure PostgreSQL:
######## i'm changing angled bracket with square bracket #########
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... -O - | sudo apt-key add -
sudo apt install postgresql postgresql-contrib -y
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo passwd postgres
su - postgres
createuser sonar
psql
ALTER USER sonar WITH ENCRYPTED password '123Admin';
CREATE DATABASE sonarqube OWNER sonar;
GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonar;
\q
exit

Download and Install SonarQube:
sudo apt-get install zip -y
wget https://binaries.sonarsource.com/Dist...
sudo unzip sonarqube-9.8.0.63668.zip
sudo mv sonarqube-9.8.0.63668 /opt/sonarqube

Add SonarQube Group and User:
sudo groupadd sonar
sudo useradd -d /opt/sonarqube -g sonar sonar
sudo chown sonar:sonar /opt/sonarqube -R

Configure SonarQube:
sudo nano /opt/sonarqube/conf/sonar.properties

Find the following lines:
#sonar.jdbc.username=
#sonar.jdbc.password=
Uncomment the lines and update password
add line
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube

sudo nano /opt/sonarqube/bin/linux-x86-64/sonar.sh
ass line
RUN_AS_USER=sonar

Setup Systemd service:
sudo nano /etc/systemd/system/sonar.service
paste
------------------------
[Unit]

Description=SonarQube service
After=syslog.target network.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

LimitNOFILE=65536
LimitNPROC=4096

[Install]

WantedBy=multi-user.target
-----------------------------------

sudo systemctl enable sonar
sudo systemctl start sonar
sudo systemctl status sonar

Modify Kernel System Limits:
sudo nano /etc/sysctl.conf
add line
vm.max_map_count=262144
fs.file-max=65536
ulimit -n 65536
ulimit -u 4096

Access SonarQube Web Interface:
http://server_ip:9000

user-admin
pass-admin


Watch video How to install Sonarqube in ubuntu online without registration, duration hours minute second in high quality. This video was added by user Quickloss3 24 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 587 once and liked it 15 people.