Linux SonarQube部署

该文详细描述了安装JDK、创建用户、下载并解压SonarQube、安装及启动PostgreSQL数据库、配置数据库用户和权限的过程。接着,它说明了如何调整Linux系统参数,并以sonarqube用户身份启动SonarQube服务,最后提供了访问SonarQubeweb界面的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. 安装jdk

查看相对应jdk版本支持Prerequisitesand overview (sonarqube.org)

创建用户useradd -m sonarqube && echo '0j4tyakIxxxxx' |passwd --stdin sonarqube

下载JDK https://repo.huaweicloud.com/openjdk/

将jdk11的tar解压至/usr/local/下

配置环境变量,

vim /etc/profile

export JAVA_HOME=/usr/local/jdk-11

export CLASSPATH=$JAVA_HOME/lib

export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile

  1. 数据库安装并启动postgresql

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

yum install -y postgresql13-server

/usr/pgsql-13/bin/postgresql-13-setup initdb

systemctl enable postgresql-13

systemctl start postgresql-13

切换postgres用户:sudo su – postgres

登录postgresql:psql

创建数据库用户:createuser sonar with password 'cduVuemxxxxx';

创建数据库:CREATEDATABASE sonar;

授权:GRANTALL PRIVILEGES ON DATABASE sonar TO sonar;

更新数据库密码

ALTER USER postgres WITH PASSWORD 'TPptvuxxxxxx';

\q 退出

Exit到root更新linux用户postgres密码

passwd postgres

TPptvu3ccccc

  1. 解压tar文件

下载地址Download |SonarQube | Sonar (sonarsource.com)

安装的版本为sonar9.8.0

unzip sonarqube-9.8.0.63668.zip

chown -R sonarqube:sonarqube sonarqube-9.8.0.63668

su sonarqube

必须用sonarqube用户去启动sonar

vim/opt/sonar/sonarqube-9.8.0.63668/conf/sonar.properties

sonar.jdbc.username=sonar

sonar.jdbc.password= cduVuemxxxxx

sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonar

sonar.web.host=(本机ip)

sonar.web.port=9000

wq保存

然后exit退到root用户下执行下列的步骤4,

修改vm.max_map_count

echo"vm.max_map_count=262144" >> /etc/sysctl.conf

sysctl -p

修改fs.file-max

echo"fs.file-max = 6553560" >> /etc/sysctl.conf

sysctl -p

修改ulimit

vim/etc/security/limits.d/99-sonarqube.conf

# 增加sonarqube用户大开文件数

sonarqube - nofile 131072

sonarqube - nproc 8192

执行完切换用户 su sonarqube

cd/opt/sonar/sonarqube-9.8.0.63668/bin/linux-x86-64/

./sonar.sh start

  1. web访问http://本机IP:9000

用户名admin

密码admin

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值