Sonarqube部署

1. 安装JDK11
$ tar xvf jdk-11_linux-x64_bin.tar.gz
$ mv jdk-11 /usr/local/jdk
$ vim /etc/profile
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
$ source /etc/profile
$ java -version
2. 安装PostgreSQL #下载pg9.5 源
$ yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
$ yum install postgresql96-server postgresql96-contrib
#初始化db
$ /usr/pgsql-9.6/bin/postgresql96-setup initdb
#启动服务、开机⾃启
$ systemctl start postgresql-9.6
$ systemctl enable postgresql-9.6
#登录数据库
$ su - postgres
$ psql -U postgres
  
#添加系统服务
$ ALTER USER postgres with encrypted password 'ykibx';
#创建sonarqube⽤户
create user sonarqube with password 'ykibx';
create database sonarqube owner sonarqube;
grant all on database sonarqube to sonarqube;
create schema my_schema;<br>
#开启远程访问
$ vim /var/lib/pgsql/9.6/data/postgresql.conf #listen_addresses = '*'
# vim /var/lib/pgsql/9.6/data/pg_hba.conf
$ systemctl restart postgresql-9.6.service
#pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 trust
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident
host all all 0.0.0.0/0 ident
3.添加系统服务
#添加系统⽤户
useradd sonarqube
passwd sonarqube
#优化系统参数
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -u 65536 sonarqube
ulimit -n 65536 sonarqube
#解压安装包
$ mv sonarqube-7.9.5.zip /home/sonarqube/
$ chown -R sonarqube:sonarqube /home/sonarqube/
$ yum -y install unzip
$ su - sonarqube 
$ unzip sonarqube-7.9.5.zip
#更改配置文件
$ vim sonarqube-7.9.1/conf/sonar.properties

sonar.jdbc.username=sonarqube
sonar.jdbc.password=meiyoumima
sonar.jdbc.url=jdbc:postgresql://127.0.0.1/sonarqube
#启动服务
su sonarqube
bash /home/sonarqube/bin/linux-x86-64/sonar.sh start
#启动服务一定要用sonarqube用户,root会启动失败,可根据日志去定位错误
上一篇:Elasticesearch学习记录


下一篇:Kubernetes-dashboard