sonarqube安装
文章目录[隐藏]
虚拟机IP为192.168.72.137 1核2G
我的环境为ubuntu 20.04
root@lili:/etc/netplan# lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
更新系统包
root@lili:~# apt update
root@lili:~# apt upgrade -y
如果报错,可参考我的另一篇文章修改apt源为国内源
ubuntu20.04切换apt源
安装java 11(有就不需要安装了)
root@lili:/etc/netplan# java
Command 'java' not found, but can be installed with:
apt install default-jre # version 2:1.11-72, or
apt install openjdk-11-jre-headless # version 11.0.20.1+1-0ubuntu1~20.04
apt install openjdk-13-jre-headless # version 13.0.7+5-0ubuntu1~20.04
apt install openjdk-16-jre-headless # version 16.0.1+9-1~20.04
apt install openjdk-17-jre-headless # version 17.0.8.1+1~us1-0ubuntu1~20.04
apt install openjdk-8-jre-headless # version 8u382-ga-1~20.04.1
root@lili:/etc/netplan# apt install openjdk-11-jdk
root@lili:/etc/netplan# java -version
openjdk version "11.0.20.1" 2023-08-24
OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu120.04, mixed mode)
root@lili:/etc/netplan#
修改系统配置(不修改会报错)
修改配置文件
vi /etc/sysctl.conf
最下面加入
vm.max_map_count=262144
fs.file-max=65536
sysctl -p 使配置生效
修改配置文件
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
pgsql安装
root@lili:/opt#

创建sonar 数据库和用户
postgresql安装完后会自动创建postgres用户 su - postgres切换进去
root@lili:/opt# su - postgres
psql 进入命令行模式
postgres@lili:~$ psql
psql (12.16 (Ubuntu 12.16-0ubuntu0.20.04.1))
Type "help" for help.
postgres=# create user sonar with password '123456';
CREATE ROLE
postgres=# create database sonar owner sonar;
CREATE DATABASE
postgres=# \q
修改配置
cp /etc/postgresql/10/main/pg_hba.conf{,.bak}
vi /etc/postgresql/10/main/pg_hba.conf
将 peer ident 改为 trust ,改了6行

重启并设置开机启动(root下执行)
root@lili:/opt# systemctl restart postgresql.service
root@lili:/opt# systemctl enable postgresql.service
sonarqube压缩包安装方式
root@lili:/opt/sonarqube# adduser sonar
Adding user `sonar' ...
Adding new group `sonar' (1001) ...
Adding new user `sonar' (1001) with group `sonar' ...
Creating home directory `/home/sonar' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for sonar
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
root@lili:/opt/sonarqube#
root@lili:/opt/sonarqube#wget -c https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.9.1.44547.zip
root@lili:/opt/sonarqube# unzip sonarqube-8.9.1.44547.zip
root@lili:/opt/sonarqube# chown -R sonar:sonar sonarqube-8.9.1.44547
配置数据库连接
root@lili:/opt/sonarqube#su - sonar
sonar@lili:/opt/sonarqube#vim sonarqube-8.9.1.44547/conf/sonar.properties
启动
sonar@lili:/opt/sonarqube#cd sonarqube-8.9.1.44547/sonarqube/bin/linux-x86-64/
sonar@lili:linux-x86-64# ./sonar.sh start
Starting SonarQube...
Started SonarQube.
如果有报错,可查看logs 目录下的日志
访问
http://192.168.72.137:9000/
username:admin
password: admin
登陆后修改密码为123456


版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。
转载请注明来源:sonarqube安装 - 多知在线