Sonarqube installation practice of code Quality Management

Source: Internet
Author: User

1sonarqube introduction 1

1.1Sonarqube Installation Requirements 1

1.1.1 Hardware requirements 1

1.1.2 Platform Requirements 1

1.1.3 Database requirements 1

1.1.4 Browser requirements 1

2 Basic Environment Preparation 2

2.1 test Environment preparation 2

2.1.1 operating System 2

2.1.2 installation software list 2

2.2 Installing and Configuring the Oracle JDK Environment 2

2.2.1 Installing JDK2

2.2.2 Configuring JDK and test 3

2.3 Installing and configuring the Maven build Tool 3

2.3.1 Installing the MAVEN build Tool 3

2.3.2 Configuring maven and testing 4

2.4MySQL data installation and configuration 4

2.4.1mysql installation 4

2.4.2 Configuring MySQL5

2.4.3 starting MySQL5

2.4.4 Creating the database required for Sonarqube 6

3sonarqube installation and configuration 6

3.1sonarqube installation 6

3.2 configuration Sonarqube6

3.3 start Sonarqube6


1Sonarqube Introduction

1.1Sonarqube Installation Requirements

To install sonar, you need to meet the requirements of all aspects, the following are listed according to the official requirements.

1.1.1 Hardware requirements

1.sonarqube need at least 2GB of memory space for efficient operation, but also need 1GB of memory space for the operating system reserved;

2. Plan the hard disk space according to the code amount of your project;

3.the Sonarqube runtime requires a lot of IO operations, so it needs to be installed on hard drives that are more efficient in reading and writing.

1.1.2 Platform Requirements

Java Type version

Oracle JRE7u75+ or 8

OpenJDK7u75+ or 8

IBM JRE does not support


1.1.3 Database requirements

Database type version

SQL Server2008

2012

2014

MySQLSonarQube3.5 starts to support MySQL5.6

SonarQube4.4 started to support MySQL5.7

Only INNODB storage engine is supported, MyISAM does not support

Support for Sonarqube-only Mysql-connecter-java jar packages

Oracle does not support 10G

11G

12G

XE

PostgreSQL8.x

7.6


1.1.4 Browser requirements

Browser version

Microsoft Internet Explorer does not support IE9

IE10 not supported

IE11

Microsoft Edge Latest Version

Mozilla Firefox Latest Version

Google Chrome Latest Version

Safari Latest Version


2 Basic Environment preparation

The entire process is as follows:


2.1 test Environment preparation

In accordance with the installation requirements of sonarqube, we need to do the following preparations, the preparation of the work is sufficient, so that our construction can be completed smoothly.

2.1.1 Operating system

This time the Sonarqube is installed on the CENTOS6U5 64-bit operating system.

2.1.2 installation software at a glance

Here is a list of all the software involved, such as the following table:

Software name version installation location

Oracle JDK1.8.0_65/usr/local/jdk

Apache Maven3.3.9/usr/local/maven

SonarQube4.5.7/usr/local/sonarqube

MySQL5.5.32/application/mysql


2.2 Installing and configuring Oracle JDK Environments

2.2.1 Installing the JDK

The installation of the JDK is simple, just download the corresponding version of the JDK from Oracle and then unzip it to a directory on the system. The download here is omitted, assuming that the JDK package has been downloaded and placed in the/usr/local/src/directory. Next, unzip to the/usr/local directory and rename to/usr/local/jdk, as follows:

[Email protected] ~]# cd/usr/local/src/

[Email protected] src]# TAR-XF jdk-8u65-linux-x64.tar.gz-c/usr/local/

[Email protected] src]# mv/usr/local/jdk1.8.0_65//USR/LOCAL/JDK

2.2.2 Configuring the JDK and testing

After the decompression, you can set the JDK related environment variables, in the/etc/profile file to append the following lines, the operation is as follows:

Java_home=/usr/local/jdk

Jre_home=${java_home}/jre

Class_path=${java_home}/lib:${jre_home}/lib

Path= $PATH: $JAVA _home/bin

Export Java_home

Export Jre_home


Add complete, reload the/etc/profile file, let us set the environment variable to take effect, the operation is as follows:

[Email protected] ~]#. /etc/profile


Next, we test the command line to verify that the Java environment is available and operate as follows:

[Email protected] ~]# java-version

Java Version "1.8.0_65"

Java (TM) SE Runtime Environment (build 1.8.0_65-b17)

Java HotSpot (TM) 64-bit Server VM (build 25.65-b01, Mixed mode)

With the above output, our Java JDK Environment has been configured. Next, configure the Maven tool.

2.3 Installing and configuring the Maven build tool

Apache Maven is a software (especially Java software) project management and automated build tool, provided by the Apache Software Foundation. Based on the concept of the Project object Model (abbreviated: POM), Maven uses a central piece of information to manage the steps of building, reporting, and documenting a project.


Maven can also be used to build and manage projects, such as C#,ruby,scala and other language-written projects. Maven was a sub-project of the Jakarta Project and is now a standalone Apache project hosted by the Apache Software Foundation.

2.3.1 Installing the MAVEN build tool

Maven installation is also very simple, to the official website to download the installation package, to extract the use. This assumes that the MAVEN package has been downloaded and placed in the/USR/LOCAL/SRC directory. Next, unzip the operation as follows:

[Email protected] ~]# cd/usr/local/src/

[Email protected] src]# TAR-XF apache-maven-3.3.9-bin.tar.gz-c/usr/local/

[Email protected] src]# ln-s/usr/local/apache-maven-3.3.9//usr/local/maven

2.3.2 Configuring MAVEN and testing

In the Conf directory of the MAVEN installation directory, the master profile/usr/local/maven/conf/settings.xml of maven is stored, and the Profiles field is added to the

<profile>

<id>sonar</id>

<activation>

<activeByDefault>true</activeByDefault>

</activation>

<properties>

<jdbc.url>jdbc:mysql://127.0.0.1:3306/sonar</sonar.jdbc.url>

</properties>

</profile>

The local MySQL database Sonar library is used here, and if it is a MySQL database on another machine, it can be modified according to the actual situation, and its common format is:

Jdbc:mysql://<mysql_server>:<port>/<db_name>

2.4MySQL data installation and configuration

2.4.1MySQL Installation

This is compiled and installed using MySQL's source code. Before installing, you need to install a dependency package that compiles and installs MySQL, as follows:

[email protected] src]# Yum install-y ncurses-devel libaio-devel cmake

The next step is to compile the installation. Here is the assumption that you have downloaded the MySQL source package, and placed in the/USR/LOCAL/SRC directory, then unzip and compile the installation of MySQL, the operation is as follows:

[Email protected] ~]# cd/usr/local/src/

[Email protected] src]# TAR-XF mysql-5.5.32.tar.gz

[Email protected] src]# CD mysql-5.5.32


Add MySQL user before compiling,

[[email protected] src]# Groupadd MySQL

[[email protected] src]# useradd mysql-s/sbin/nologin-m-G MySQL


The next step is to compile and install

[Email protected] mysql-5.5.32]# CMake. \

-dcmake_install_prefix=/application/mysql-5.5.32 \

-dmysql_datadir=/application/mysql-5.5.32/data \

-dmysql_unix_addr=/application/mysql-5.5.32/sock/mysql.sock \

-ddefault_charset=utf8 \

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \

-DEXTRA_CHARSETS=GBK,GB2312,UTF8,ASCII \

-denabled_local_infile=on \

-dwith_innobase_storage_engine=1 \

-dwith_federated_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwithout_example_storage_engine=1 \

-dwithout_partition_storage_engine=1 \

-dwith_fast_mutexes=1 \

-dwith_zlib=bundled \

-denabled_local_infile=1 \

-dwith_readline=1 \

-dwith_embedded_server=1 \

-dwith_debug=0

If there is no problem, then make and do install operation, here the compilation process omitted, the operation is as follows:

[[email protected] mysql-5.5.32]# make && make install


Compile and install, then set up the MySQL directory soft link, in order to later upgrade MySQL database version,

[Email protected] ~]# ln-s/application/mysql-5.5.32/application/mysql

2.4.2 Configuring MySQL

Default-storage-engine=innodb

Collation-server=utf8_general_ci

init-connect= ' SET NAMES UTF8 '

Character-set-server=utf8

2.4.3 start MySQL

Because it is a newly installed database, there is no data initialized. Next, we use the mysql_install_db script to install MySQL initialization data. The operation is as follows:


2.4.4 Creating the required database for Sonarqube

Mysql> Grant all privileges on * * to ' sonar ' @ ' localhost ' identified by ' sonar ';

Mysql> CREATE DATABASE Sonar default character set UTF8 collate utf8_general_ci;

mysql> flush Privileges;

3Sonarqube installation and configuration

3.1Sonarqube installation

3.2 Configuration Sonarqube

Edit the Sonarqube configuration file/usr/local/sonarqube/conf/sonar.properties and modify the content to read as follows:

Sonar.jdbc.username=sonar

Sonar.jdbc.password=sonar

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useunicode=true&characterencoding=utf8& Rewritebatchedstatements=true&useconfigs=maxperformance

Sonar.web.javaopts=-server

sonar.web.host=192.168.20.133

sonar.web.port=9000


Next modify the/usr/local/sonarqube/conf/wrapper.conf configuration file and modify the following line:

Wrapper.java.command=/usr/local/jdk/bin/java

3.3 Start Sonarqube

[[email protected] ~]#/usr/local/sonarqube/bin/linux-x86-64/sonar.sh start


Paste copied directly from Word, the format is too messy, well-formed documents in the attachment. For the needy comrades to download.

This article is from the "solid-state Drive" blog, make sure to keep this source http://lavenliu.blog.51cto.com/5060944/1785385

Sonarqube installation practice of code Quality Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.