【ubuntu 18.04】安装sonarqube9.2.4


1. 官网

https://docs.sonarqube.org/8.9/setup/install-server/

2. 安装Java环境

https://www.cnblogs.com/fireblackman/p/15683754.html

3. 下载安装包文件

https://www.sonarqube.org/downloads/

4. 系统环境配置

sudo vim /etc/sysctl.conf
# 添加如下内容 vm.max_map_count
=262144 # 生效 sudo /sbin/sysctl -p
sudo vim /etc/security/limits.conf
# 添加下面配置
* soft nofile 65536
* hard nofile 131071
* soft nproc 65536
* hard nproc 65536

5. 安装配置postgres

安装:https://www.cnblogs.com/fireblackman/p/15740550.html

创建数据库及用户:https://www.cnblogs.com/fireblackman/p/15740695.html

6. 解压安装包文件并配置

cd ~
unzip sonarqube-9.2.4.50792.zip

修改sonar.properties, 部分主要配置如下:

cd sonarqube-9.2.4.50792
vim conf/sonar.pro# Property values can:
# - be overridden by environment variables. The name of the corresponding environment variable is the
#   upper-cased name of the property where all the dot ('.') and dash ('-') characters are replaced by
#   underscores ('_'). For example, to override 'sonar.web.systemPasscode' use 'SONAR_WEB_SYSTEMPASSCODE'.
# - be encrypted. See https://redirect.sonarsource.com/doc/settings-encryption.html

#--------------------------------------------------------------------------------------------------
# DATABASE
#
# IMPORTANT:
# - The embedded H2 database is used by default. It is recommended for tests but not for
#   production use. Supported databases are Oracle, PostgreSQL and Microsoft SQLServer.
# - Changes to database connection URL (sonar.jdbc.url) can affect SonarSource licensed products.

# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonarqube
sonar.jdbc.password=123456......
#----- PostgreSQL 9.6 or greater
# By default the schema named "public" is used. It can be overridden with the parameter "currentSchema".
sonar.jdbc.url=jdbc:postgresql://192.168.11.43:5432/sonarqube
.....
# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
sonar.web.host=0.0.0.0

# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
# sonar.web.context=/sonarqube
# TCP port for incoming HTTP connections. Default value is 9000.
sonar.web.port=9000......
# Elasticsearch port for incoming HTTP connections. Default is 9001. Use 0 to get a free port.
# As a security precaution, should be blocked by a firewall and not exposed to the Internet.
sonar.search.port=9002......
# Paths to persistent data files (embedded database and search index) and temporary files.
# Can be absolute or relative to installation directory.
# Defaults are respectively /data and /temp
sonar.path.data=data
sonar.path.temp=temp

......

修改vim conf/wrapper.conf

vim conf/wrapper.conf
# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:
wrapper.java.command=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
#wrapper.java.command=java


#
# DO NOT EDIT THE FOLLOWING SECTIONS
#


#********************************************************************
# Wrapper Java
#********************************************************************
......

7. 启动

bash bin/linux-x86-64/sonar.sh start

其他操作

bash bin/linux-x86-64/sonar.sh restart
bash bin/linux-x86-64/sonar.sh stop

8. 访问http://192.168.10.99:9000/

账号密码:admin/admin

初次登录需要修改密码

密码忘记了怎么办:https://www.cnblogs.com/fireblackman/p/15741427.html

9. 到此完成,XDM