Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation steps for Linux sonarqube8.2

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Download address of Community Edition: https://www.sonarqube.org/downloads/

Environment introduction: (this article uses Oracle jdk 11.0.6 and postgreSQL 12)

1. Decompress the package

Unzip sonarqube-8.2.0.32929.zip

2. Create postgreSQL users after installation, they will automatically create postgres users, su-postgres, to switch in.

Psql # enters command line mode

Create database sonar; # create sonar database

Create user sonar; # create sonar user

Alter user sonar with password 'postgres'; # set the sonar user password (otherwise you will lose access to the database)

Alter role sonar createdb;alter role sonar superuser;alter role sonar createrole; # authorizes sonar

Alter database sonar owner to sonar; # change the owner of the sonar database (this step is required, otherwise sonarqube will fail to connect)

Psql enters command line mode

\ l View the database

\ du view users

3. Modify the system configuration

You can't use root!

Switching users must be su-username

After switching users, don't forget to authorize this user to your sonarQube root directory

Change some system configuration

Execute the following commands as needed to make the kernel parameters meet the sonar installation requirements

# you can view these values using the following command:

Sysctl vm.max_map_count

Sysctl fs.file-max

Ulimit-n

# you can set dynamically for the current session by running the following command as root:

Sysctl-w vm.max_map_count=262144

Sysctl-w fs.file-max=65536

Ulimit-n 65536

# in order to set these values more permanently, / etc/sysctl.d/99-sonarqube.conf (or / etc/sysctl.conf file) must be modified

# add the following two lines at the end of the file

Vi / etc/sysctl.conf

Vm.max_map_count=262144

Fs.file-max=65536

# add ulimit-n 65536 at the end of / etc/profile file

Vi / etc/profile

Ulimit-n 65536 # run # source / etc/profile after saving to make it effective

Source / etc/profile

Create a sonar user

Useradd sonar

Passwd sonar

Set your own password.

Directory authorization

Chown-R sonar:sonar / usr/local/sonarqube-8.2.0.32929/

4. Set up access to the database

Vim / usr/local/sonarqube-8.2.0.32929/conf/sonar.properties

Configure the IP and port of your machine, and save and exit.

5. Configure Elasticsearch storage path

By default, Elasticsearch data is stored in $SONARQUBE-HOME / data, but it is not recommended for production instances. Instead, you should store this data in another location, preferably in a dedicated volume with fast I / O. In addition to maintaining acceptable performance, this also simplifies the upgrade of SonarQube

Vim / usr/local/sonarqube-8.2.0.32929/conf/sonar.properties

The user used to start SonarQube must have read and write access to these directories

Mkdir-p / data/sonarqube/data

Mkdir-p / data/sonarqube/temp

Chown-R sonar:sonar / data/

6. Installation and use of Sonar-Scanner scanners it is impossible to scan items with SonarQube alone, so you still need to install sonar-scanner

Official download address: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/

# drop it under / usr/local/ to decompress

Unzip sonar-scanner-cli-4.2.0.1873-linux.zip

Cd sonar-scanner-4.2.0.1873-linux/

Vim conf/sonar-scanner.propertie # change the configuration

After saving and exiting, create a soft connection and change the sonar-scanner to global to use

Ln-s / usr/local/sonar-scanner-4.2.0.1873-linux/bin/sonar-scanner / usr/bin/sonar-scanner

7. Start the service

Su-sonar Don't forget to cut users

Cd / usr/local/sonarqube-8.2.0.32929/

Bin/linux-x86-64/sonar.sh

Access the web interface

Account password: admin/admin

Install the Chinese version, and then click restart

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report