Sonarqube Installation
Sonarqube Installation
1. Install OpenJDK 11
-----------------------------------------------------------------------------------
-------
2. Install and Configure PostgreSQL
Install PostgreSQL.
$ su - postgres
$ createuser sonar
Log in to PostgreSQL.
$ psql
Set a password for the sonar user. Use a strong password in place of
my_strong_password.
Grant all the privileges on the sonarqube database to the sonar user.
Exit PostgreSQL.
\q
$ exit
-----------------------------------------------------------------------------------
------
mv
Move the unzipped files to /opt/sonarqube directory
-----------------------------------------------------------------------------------
------
5. Configure SonarQube
Edit the SonarQube configuration file.
sonar.jdbc.username=sonar
sonar.jdbc.password=my_strong_password
Below those two lines, add the sonar.jdbc.url.
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube
Save and exit the file.
#RUN_AS_USER=
Uncomment the line and change it to:
RUN_AS_USER=sonar
Save and exit the file.
-----------------------------------------------------------------------------------
------
[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
Save and exit the file.
-----------------------------------------------------------------------------------
------
vm.max_map_count=262144
fs.file-max=65536
ulimit -n 65536
ulimit -u 4096
Save and exit the file.
$ sudo reboot
-----------------------------------------------------------------------------------
------
Access SonarQube in a web browser at your server's IP address on port 9000. For
example:
http://IP:9000
Log in with username admin and password admin. SonarQube will prompt you to change
your password.