windows安装sonarqube

  • 1.docker安装postgres
docker pull postgres
mkdir C:\Users\wb227\Desktop\test\sonarqube\postgres\postgresql
mkdir C:\Users\wb227\Desktop\test\sonarqube\postgres\data
docker network create sonarqube
docker run --name postgres -d -p 5432:5432 --net sonarqube -v C:\Users\wb227\Desktop\test\sonarqube\postgres\postgresql:/var/lib/postgresql -v C:\Users\wb227\Desktop\test\sonarqube\postgres\data:/var/lib/postgresql/data -v /etc/localtime:/etc/localtime:ro -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -e POSTGRES_DB=sonar -e TZ=Asia/Shanghai --restart always --privileged=true --network-alias postgres postgres:latest
  • 2.docker安装sonarqube
# 镜像查看地址:https://hub.docker.com/_/sonarqube/tags
docker pull sonarqube:9.4.0-community
mkdir -p C:\Users\wb227\Desktop\test\sonarqube\sonarqube
 docker run -d --name sonarqube sonarqube:9.4.0-community
 docker cp sonarqube:/opt/sonarqube/conf C:\Users\wb227\Desktop\test\sonarqube\sonarqube
 docker cp sonarqube:/opt/sonarqube/data C:\Users\wb227\Desktop\test\sonarqube\sonarqube
 docker cp sonarqube:/opt/sonarqube/logs C:\Users\wb227\Desktop\test\sonarqube\sonarqube
 docker cp sonarqube:/opt/sonarqube/extensions C:\Users\wb227\Desktop\test\sonarqube\sonarqube
 docker stop sonarqube
 docker rm sonarqube
 vim C:\Users\wb227\Desktop\test\sonarqube\sonarqube\conf\sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
去掉 sonar.jdbc.url 注释,配置url
#----- PostgreSQL 9.3 or greater
# By default the schema named "public" is used. It can be overridden with the parameter "currentSchema".
sonar.jdbc.url=jdbc:postgresql://postgres:5432/sonar
docker run -d --name sonarqube -p 9000:9000 -e ALLOW_EMPTY_PASSWORD=yes -e SONARQUBE_DATABASE_USER=sonar  -e SONARQUBE_DATABASE_NAME=sonar  -v SONARQUBE_DATABASE_PASSWORD=sonar -e SONARQUBE_JDBC_URL="jdbc:postgresql://postgres:5432/sonar" --net sonarqube --privileged=true  --restart always  -v C:\Users\wb227\Desktop\test\sonarqube\sonarqube\logs:/opt/sonarqube/logs  -v C:\Users\wb227\Desktop\test\sonarqube\sonarqube\conf:/opt/sonarqube/conf  -v C:\Users\wb227\Desktop\test\sonarqube\sonarqube\data:/opt/sonarqube/data -v C:\Users\wb227\Desktop\test\sonarqube\sonarqube\extensions:/opt/sonarqube/extensions sonarqube:9.4.0-community
  • 3.修改windows配置
wsl -d docker-desktop
sysctl -w vm.max_map_count=262144
  • 4.插件下载
https://toscode.gitee.com/zzulj/sonar-pdf-plugin/tags
# 下载版本 v4.0.1
下载好对应的插件jar后放置到C:\Users\wb227\Desktop\test\sonarqube\sonarqube\extensions\plugins目录下

你可能感兴趣的:(docker,windows,sonarqube)