sonarqube安装7.9.1版本
SonarQube是一种自动代码审查工具,可检测代码中的错误,漏洞和代码味道。它可以与您现有的工作流程集成,以实现跨项目分支和请求请求的连续代码检查
在https://www.sonarqube.org/downloads/选择版本,本文选择稳定版本7.9.1
前提准备
1.jdk环境准备
此版本不支持jdk8,安装jdk11版本
[root@localhost local]# java -version
java version "11" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
2.安装数据库
准备PostgreSQL数据库,本文选择使用9.5
[root@localhost ~]# yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[root@localhost ~]# yum -y install postgresql95
[root@localhost ~]# yum install postgresql95-server -y
[root@localhost ~]# /usr/pgsql-9.5/bin/postgresql95-setup initdb
[root@localhost ~]# systemctl enable postgresql-9.5
[root@localhost ~]# systemctl start postgresql-9.5
一、配置数据库信息
1.使用postgres用户登录(PostgresSQL安装后会自动创建postgres用户,无密码)
[root@jenkins2 ~]# su - postgres
-bash-4.2$
2.登录postgresql数据库
-bash-4.2$ psql -U postgres
psql (9.5.19)
Type "help" for help.
3.创建用户和数据库并授权
postgres=# create user sonarqube with password '123456';
CREATE ROLE
postgres=# create database sonarqube owner sonarqube;
CREATE DATABASE
postgres=# grant all on database sonarqube to sonarqube;
GRANT
postgres=# create schema my_schema;
CREATE SCHEMA
postgres=# ALTER USER postgres with encrypted password '123456';
ALTER ROLE
4.退出数据库
postgres=# \q
5.开启远程访问
-bash-4.2$ vi /var/lib/pgsql/9.5/data/postgresql.conf
将这行listen_addresses = 'localhost'
改为listen_addresses = '*'
-bash-4.2$ vi /var/lib/pgsql/9.5/data/pg_hba.conf
增加如下图所示的行
-bash-4.2$ l