How to install SonarQube on Ubuntu 18.04 Linux
ALTER USER sonar WITH ENCRYPTED password 'password';
CREATE DATABASE sonarqube OWNER sonar;
GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonar;
\qsudo unzip sonarqube*.zip -d /opt
sudo vi /opt/sonarqube/conf/sonar.prop
uncomment the below lines by removing # and add values highlighted yellow
sonar.jdbc.username=sonar
sonar.jdbc.password=password
sonar.jdbc.url=jdbc:postgresql
Create Sonar as a service(this will enable to start automatically when you restart the server)
Execute the below command:
sudo vi /etc/systemd/system/sonar.serv
add the below code in green color:
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/opt/sonarqube/bin/l
ExecStop=/opt/sonarqube/bin/li
LimitNOFILE=131072
LimitNPROC=8192
User=sonar
Group=sonarGroup
Restart=always
[Install]
WantedBy=multi-user.target
Add the following lines to the bottom of that file:
vm.max_map_count=262144
fs.file-max=65536
Next, we're going to edit limits.conf. Open that file with the command:
At the end of this file, add the following:
sonar - nofile 65536
sonar - nproc 4096
sudo systemctl status sonar
type q now to come out of this mode.
Now execute the below command to see if Sonarqube is up and running. This may take a few minutes.
Now access sonarQube UI by going to browser and enter public dns name with port 9000




