1. Install postgresql (because sonarqube does not support Mysql from 7.9 and only supports sqlserver, oracle, postgresql)
See the link below
https://blog.csdn.net/zetion_3/article/details/113253392
2. Download the sonarqube software
https://www.sonarqube.org/downloads/
Download the community version (free)
3. Download jdk (note here is the corresponding jdk version)
For JDK download and installation, please refer to the following link
https://blog.csdn.net/zetion_3/article/details/112306797
I am using sonarqube-8.6.0, and the JDK requirement is above 11. If the JDK version is wrong, the following error will be displayed
4. Modify the configuration file
Unzip sonarqube to /usr/local/
vim /usr/local/sonarqube/conf/sonar.properties
# 数据库连接信息
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword
sonar.jdbc.url=jdbc:postgresql://localhost/sonardb
# 配置Elasticsearch 数据地址,默认在
sonar.path.data=/var/sonarqube/data
sonar.path.temp=/var/sonarqube/temp
# 配置web端信息
sonar.web.host=0.0.0.0
sonar.web.port=9000
# 起始路径这里如果配置了访问需要http://IP:9000/sonarqube才能访问可以不加直接IP:9000即可访问
sonar.web.context=/sonarqube
5. File permission modification (If elasticsearch is not modified, it cannot be started with root)
New sonarqube user dedicated to use in sonarqube
useradd sonarqube
Modify the sonarqube file to sonarqube
chown -R sonarqube.sonarqube /usr/local/sonarqube
6. Start
su - sonarqube
cd /usr/local/sonarqube/bin/linux-x86-64
sh sonar.sh start
Check the log (both web and sonar logs) to see if it is activated
If the following appears, it indicates that the normal startup is completed
7. Common errors
1. The reason for not supporting Mysql, just change to oracle, sqlserver, postgrasql
2.Elasticsearch reports an error
Modify the following configuration files to restart (you may not be able to load the server if you want to restart the server)
Under normal circumstances, the following files are not configured, so they can be added manually at the end. This line is as follows:
sonar.jdbc.url=jdbc:postgresql://127.0.0.1/sonardb
vim /etc/security/limits.conf
* soft nproc 4096
* hard nproc 4096
* hard nofile 65536
* soft nofile 65536
vim /etc/security/limits.d/90-nproc.conf
* soft nproc 4096
* soft nproc 4096
vim /etc/sysctl.conf
vm.max_map_count=655360
Also if prompted
Is it because the postgresql database configuration is added after ? currentSchema=my_schema
Delete the above line to configure the database, see the configuration above as long as
The finished port is as follows
5432 for postgresql
9000 is the application port
Access IP: 9000 can enter the login page and use admin/admin to log in