- 1.PostgreSQL12离线安装
- 1.1 设置yum软件源(联网 *** 作)
- 1.2 下载PostgreSQL12依赖包
- 1.3 安装PostgreSQL12
- 1.4 初始化数据据
- 1.5 设置开机启动与启动
- 1.6 修改密码
- 2.安装SonarQube准备
- 2.1 创建用户
- 2.2 *** 作系统优化
- 2.3 数据库创建sonar用户
- 2.4 修改配置文件
- 3.离线安装SonarQube
- 3.1 准备SonarQube安装包
- 3.2 解压
- 3.3 修改用户和用户组
- 3.4 修改配置文件
- 3.5 ES存储路径
- 3.5 启动
- 3.6 登录
- 3.7 汉化
- 4.sonar-scanner安装
- 4.1 解压
- 4.2 修改配置文件
- 4.3 配置环境变量
- 4.4 验证部署成功
1.2 下载PostgreSQL12依赖包wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm --no-check-certificate
yum install pgdg-redhat-repo-latest.noarch.rpm
rm -rf pgdg-redhat-repo-latest.noarch.rpm
或者
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
1.3 安装PostgreSQL12mkdir /root/postgresql12
cd /root/postgresql12
yum install --downloadonly --downloaddir=./ postgresql12-server postgresql12 postgresql12-contri
把下载下来的rpm包,打包导入内网,根据以下rpm包安装步骤进行安装:
1.4 初始化数据据rpm -ivh postgresql12-libs-12.9-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql12-12.9-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql12-server-12.9-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql12-contrib-12.9-1PGDG.rhel7.x86_64.rpm
1.5 设置开机启动与启动/usr/pgsql-12/bin/postgresql-12-setup initdb
1.6 修改密码systemctl enable postgresql-12
systemctl start postgresql-12
# 登录postsql su - postgres psql # 修改用户密码 alter user postgres with password 'bigdata123'; # 退出 q exit2.安装SonarQube准备 2.1 创建用户
2.2 *** 作系统优化groupadd sonar
useradd sonar -g sonar
2.3 数据库创建sonar用户sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -u 4096 sonar
ulimit -n 65536 sonar
# 登录postsql su - postgres psql # 查看数据库 l # 创建数据库和用户,并把数据库分配给该用户,并授予权限 create database sonar; create user sonar; alter user sonar with password 'sonar'; alter role sonar createdb; alter role sonar superuser; alter role sonar createrole; alter database sonar owner to sonar; # 退出 q exit2.4 修改配置文件
vim /var/lib/pgsql/12/data/pg_hba.conf,将ident全部改为md5
3.离线安装SonarQube 3.1 准备SonarQube安装包重启 PostgreSQL服务
systemctl restart postgresql-12
在联网节点下载,然后传入内网:
3.2 解压wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.9.3.48735.zip
3.3 修改用户和用户组unzip sonarqube-8.9.3.48735.zip -d /opt/software/
3.4 修改配置文件chown -R sonar:sonar /opt/software/sonarqube-8.9.3.48735/
3.5 ES存储路径vim /opt/software/sonarqube-8.9.3.48735/conf/sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://127.0.0.1/sonar
sonar.web.host=0.0.0.0
sonar.web.port=9000
3.5 启动mkdir -p /data/sonarqube/data
mkdir -p /data/sonarqube/temp
chown -R sonar:sonar /data/
3.6 登录启动
su sonar /opt/software/sonarqube-8.9.3.48735/bin/linux-x86-64/sonar.sh start
查看状态
su sonar /opt/software/sonarqube-8.9.3.48735/bin/linux-x86-64/sonar.sh status
停止
su sonar /opt/software/sonarqube-8.9.3.48735/bin/linux-x86-64/sonar.sh stop
查看日志
tail -f /opt/software/sonarqube-8.9.3.48735/logs/sonar.20211129.log
使用 admin/admin 登录,登陆后修改密码:admin/admin123
安装完成后,重启:su sonar /opt/software/sonarqube-8.9.3.48735/bin/linux-x86-64/sonar.sh restart
4.2 修改配置文件unzip sonar-scanner-cli-4.6.2.2472-linux.zip -d /opt/software/
4.3 配置环境变量vim /opt/software/sonar-scanner-4.6.2.2472-linux/conf/sonar-scanner.properties
sonar.host.url=http://jenkins.com:9000
sonar.sourceEncoding=UTF-8
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://127.0.0.1/sonar
4.4 验证部署成功vim /etc/profile
export SONAR_HOME=/opt/software/sonarqube-8.9.3.48735
export SONAR_RUNNER_HOME=/opt/software/sonar-scanner-4.6.2.2472-linux
export PATH=$PATH:$SONAR_RUNNER_HOME/bin
export PATH=$PATH:$SONAR_HOME/bin
source /etc/profile
sonar-scanner -h
[root@jenkins conf]# sonar-scanner -h INFO: INFO: usage: sonar-scanner [options] INFO: INFO: Options: INFO: -D,--define Define property INFO: -h,--help Display help information INFO: -v,--version Display version information INFO: -X,--debug Produce execution debug output
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)