# https://blog.csdn.net/a772304419/article/details/106582198
# mysql> create database sonar default character set utf8;
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;
mkdir /opt/sonar
cp -r sonarqube-8.9.6.50800/* /opt/sonar
useradd sonar
chown -R sonar. /opt/sonar
# SonarQube8.9.6 requires Java 11 to run
# sonarqube7.8是最后一个支持jdk8及mysql的版本
vim /opt/sonar/conf/sonar.properties
# mysql
# 新版的SonarQube(7.9+)只支持以下数据库:
# Microsoft SQL Server、Oracle、PostgreSQL、H2 (默认的嵌入式数据库)
# 不再支持MySQL,请更换数据库。
sonar.jdbc.username=root
sonar.jdbc.password=123456
sonar.jdbc.url=jdbc:mysql://192.168.145.20:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBat
chedStatements=true&useConfigs=maxPerformance&useSSL=fals
# 启动
su sonar /opt/sonar/bin/linux-x86-64/sonar.sh start
su sonar /opt/sonar/bin/linux-x86-64/sonar.sh stop
su sonar /opt/sonar/bin/linux-x86-64/sonar.sh status
# 查看日志
tail -f /opt/sonar/logs/sonar.logs
# token
Analyze "dmgeo": 31936c9eec6df7413d57ab4b497b7a968cc05f2d
The token is used to identify you when an analysis is performed. If it has been compromised, you can revoke it at any point of time in your user account.
# 6.7.7 token
dmgeo: 80342e2337ceded71adb02bbd0414421bdd661ab
mvn sonar:sonar \
-Dsonar.host.url=http://192.168.145.29:9000 \
-Dsonar.login=80342e2337ceded71adb02bbd0414421bdd661ab
mvn sonar:sonar \
-Dsonar.projectKey=dmgeo \
-Dsonar.host.url=http://192.168.145.29:9000 \
-Dsonar.login=31936c9eec6df7413d57ab4b497b7a968cc05f2d
# 汉化
cp sonar-l10n-zh-plugin-1.28-SNAPSHOT.jar /opt/sonarqube-7.8/extensions/plugins
# 改下如下两个配置
vim /etc/sysctl.conf
vm.max_map_count = 262144
sysctl -p
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效
登录后使用ulimit -S -n/ulimit -H -n查看
sonarqube安装、配置、汉化教程
最新推荐文章于 2025-06-26 13:01:05 发布