wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.5.zip -P /usr/local/src
CentOS6 + OpenJDK8 + MySQL7
sudo yum install java-1.8.0-openjdk -y
Refer to install Mysql: http://blog.csdn.net/wh211212/article/details/53105335
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON sonar.* TO 'sonar'@'127.0.0.1' IDENTIFIED BY '@Aniusonar..0';
FLUSH PRIVILEGES
sudo yum install unzip -y
cd /usr/local/src
unzip sonarqube-6.5.zip -d /opt/
cd /opt && mv sonarqube-6.5 sonarqube
cd /opt/sonarqube/conf/
# Edit sonar.properties
sonar.web.javaOpts=-Xmx4G -Xms2G -XX:MaxMetaspaceSize=256M -XX:+HeapDumpOnOutOfMemoryError
# Edit wrapper.conf
wrapper.java.initmemory=64
wrapper.java.maxmemory=128
cd /opt/sonarqube/bin/linux-x86-64/./sonar.sh start
. /sonar.sh stop
server {
listen 80;
server_name sonar.aniu.so; #customize
access_log /var/log/nginx/sonar.aniu.so.access.log main;
error_log /var/log/nginx/error/sonar.aniu.so.error.log;
location /{
root /opt/sonarqube;
index index.html index.htm index.php;}
error_page 404/404.html;
error_page 500502503504/50x.html;
location =/50x.html {
root /usr/share/nginx/html;}
location ~{
proxy_pass http://0.0.0.0:9009;}}
Default login: username admin password admin
vi /etc/init.d/sonar
#
#! /bin/sh
#
# rc file for SonarQube
#
# chkconfig:3459610
# description: SonarQube system(www.sonarsource.org)
#
### BEGIN INIT INFO
# Provides: sonar
# Required-Start: $network
# Required-Stop: $network
# Default-Start:345
# Default-Stop:0126
# Short-Description: SonarQube system(www.sonarsource.org)
# Description: SonarQube system(www.sonarsource.org)
### END INIT INFO
/usr/bin/sonar $*
# ln -s /opt/sonaruube/bin/linux-x86-64/sonar.sh /usr/bin/sonar
# chmod 755/etc/init.d/sonar
# chkconfig --add sonar