-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathSonarqube_Postgress_Installation
77 lines (60 loc) · 2.3 KB
/
Sonarqube_Postgress_Installation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
In this guide, you will learn how to install SonarQube static code analysis on Ubuntu 22.04 server.
You will also learn how to install PostgreSQL which will be used as the database for SonarQube and the Nginx web server that will be used as the reverse proxy.
- sudo apt update
- sudo apt install default-jdk
- java -version
- wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- sudo apt-get update
- sudo apt-get install postgresql-13
- psql --version
- sudo systemctl is-enabled postgresql
- sudo systemctl status postgresql
- sudo -u postgres psql
- CREATE USER sonarqube WITH PASSWORD 'Password@123';
- CREATE DATABASE sonarqube OWNER sonarqube;
- GRANT ALL PRIVILEGES ON DATABASE sonarqube TO sonarqube;
- \l
- \du
- \q
- sudo useradd -b /opt/sonarqube -s /bin/bash sonarqube
- sudo vi /etc/sysctl.conf
vm.max_map_count=524288
fs.file-max=131072
- sudo sysctl --system
- ulimit -n 131072
- ulimit -u 8192
- sudo vi /etc/security/limits.d/99-sonarqube.conf
sonarqube - nofile 131072
sonarqube - nproc 8192
- sudo apt update
- sudo apt install unzip software-properties-common wget
- wget https://binaries.sonarsource.com/Dist...
- unzip sonarqube-9.9.6.92038.zip
- sudo mv sonarqube-9.9.6.92038 /opt/sonarqube
- sudo chown -R sonarqube:sonarqube /opt/sonarqube
- sudo vi /opt/sonarqube/conf/sonar.properties
sonar.jdbc.username=sonarqube
sonar.jdbc.password=Password@123
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube
sonar.search.javaOpts=-Xmx512m -Xms512m -XX:MaxDirectMemorySize=256m -XX:+HeapDumpOnOutOfMemoryError
sonar.web.host=127.0.0.1
sonar.web.port=9000
sonar.web.javaAdditionalOpts=server
sonar.log.level=INFO
sonar.path.logs=logs
- sudo vi /etc/systemd/system/sonarqube.service
[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=sonarqube
Group=sonarqube
Restart=always
LimitNOFILE=65536
LimitNPROC=4096
[Install]
WantedBy=multi-user.target