Today, I will continue to introduce the relevant knowledge of Linux operation and maintenance. The main content of this article is the installation and configuration of Sonar.
1. Sonar download and installation
The download of sonar can go to the website: https://www.sonarqube.org/downloads/ , the page is as follows:
we choose the appropriate version to download, after the download is complete, we will detox the downloaded Sonar installation package to /usr /local/ directory and rename it to sonar.
In addition, the installation and configuration of Sonar requires a JAVA environment, so we also need to prepare the JAVA environment in advance.
Second, the database configuration
Next, we configure the database.
Note that the Sonar version I have here is 5.6, and the version requirement for the MySQL database is also at least 5.6. When we install the database, we need to select the version that can match Sonar for installation. After the database installation is complete, enter the database, let's create the Sonar library, authorize it, and execute the command:
create database sonar character set utf8 collate utf8_general_ci;
grant all on sonar.* to 'soanr'@'localhost' identified by 'sonar';
grant all on sonar.* to 'sonar'@'%' identified by 'sonar';
The execution is as follows: In
this way, our Sonarqube is installed and configured.
3. Sonar configuration
Then, let's configure Sonar's configuration file, open the /usr/loca/sonar/conf/ directory, and find that there are two configuration files in it. We open sonar.properties and modify the following 5 parameters:
1. sonar.jdbc.username
Specify Sonar's database username
2, sonar.jdbc.password
specify Sonar's database password
3, sonar.jdbc.url
specify Sonar's database connection address. We can use the default parameter here, but we must pay attention that when we open the comment, we must open the comment of MySQL instead of the comment line of other configurations.
4. sonar.web.host
specifies the local IP address that Sonar monitors.
5. sonar.web.port
specifies the port number that Sonar listens to.
The completed configuration file is as follows:
So far, Sonar has been configured.
4. Sonar starts
Finally, let's start Sonar. In the /usr/local/sonar/bin/linux-x86-64/ directory, there is the sonar startup script sonar.sh, and we execute the command:
/usr/local/sonar/bin/linux-x86-64/sonar.sh start
to complete.
After the installation is complete, it is found that port 9000 is opened on the local device, as shown below:
We tried to access this port, and the result is as follows:
Original is not easy, please explain the source: https://blog.csdn.net/weixin_40228200