SonarQube Install
Reference URL
Installation Steps
Prerequisite packages and PostgreSQL
$ sudo apt install -y default-jdk postgresql zip wget$ wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.7.1.42226.zipthe binary.$ sudo su - postgres -c "createuser <db_username>"$ sudo -u postgres psql=# ALTER USER <db_username> WITH PASSWORD 'new_password';;=# CREATE DATABASE sonardb WITH TEMPLATE = template0 ENCODING 'UTF8';=# GRANT ALL PRIVILEGES ON DATABASE sonardb TO <db_username>;
SonarQube installation
In /etc/sysctl.conf, add a line
vm.max_map_count=262144and reboot the server. To verify after rebooting, run sysctl vm.max_map_count. See https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html for details.$ sudo adduser sonar$ sudo unzip <sonarqube_zip_file> -d /optrename exploded folder to /opt/sonarqube and
$ sudo chown -R sonar: /opt/sonarqubeModify /opt/sonarqube/conf/sonar.properties with correct DB values
Create the /etc/systemd/system/sonarqube.service, ensuring it runs as sonar user. We can initially put
RestartSec=360under [Service] and change this once everything is ok.$ sudo systemctl start sonarqubeand monitor logs in /opt/sonarqube/logs/ folder, especially sonar.log and web.log files for errors.The webpage can be access with http://hostname:9000 with default username password admin / admin
$ sudo systemctl enable sonarqubeif everything is ok.