목요일, 6월 13, 2024
HomeLinuxSonar Qube 설치

Sonar Qube 설치

Sonar Qube 설치

 

java 1.8

tar xf jdk-8u121-linux-x64.tar.gz
mv jdk1.8.0_121 /usr/lib/jvm
ln -s /usr/lib/jvm/jdk1.8.0_121 /usr/lib/jvm/java
echo "##################################################################################" >> /etc/profile
echo "#  $WORK_DATE "                                                                     >> /etc/profile
echo "#  add environment variable "                                                       >> /etc/profile
echo "##################################################################################" >> /etc/profile
echo "JAVA_HOME=/usr/lib/jvm/java"                                                        >> /etc/profile
echo "export JAVA_HOME"                                                                   >> /etc/profile
echo "PATH=\$JAVA_HOME/bin:\$PATH"                                                        >> /etc/profile
source /etc/profile
java -version

nginx install

yum install nginx

vi /etc/nginx/nginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    include /etc/nginx/conf.d/*.conf;
}

vi /etc/nginx/conf.d/virtual.conf

        server {
                listen 80;
                server_name localhost;
    client_max_body_size 200M;
    
                location / { 
                        proxy_pass              http://admin-was;
                        proxy_set_header        Accept-Encoding   "";
                        proxy_set_header        Host $http_host;
                        proxy_set_header        X-NginX-Proxy true;
                        proxy_set_header        X-Real-IP $remote_addr;
                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_set_header        X-Forwarded-Proto $scheme;
                        proxy_redirect          off;
                }
                location /sonarqube {
                        proxy_pass              http://sonarqube;
                        proxy_set_header        Accept-Encoding   "";
                        proxy_set_header        Host $http_host;
                        proxy_set_header        X-NginX-Proxy true;
                        proxy_set_header        X-Real-IP $remote_addr;
                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_set_header        X-Forwarded-Proto $scheme;
                        proxy_redirect          off;
                }
        }
        upstream admin-was{
                ip_hash;
                server 10.0.0.40:8080;
        }
        upstream sonarqube{
                ip_hash;
                server 10.0.0.40:9003;
        }

mysql 5.6 install

apt-get install mysql-server

create database

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_bin; 
GRANT ALL PRIVILEGES ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonarPwd';

vi /etc/my.cnf

[mysqld]
max_allowed_packet=1G
innodb_log_file_size=128M

sonarqube install

wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.7.zip
unzip sonarqube-6.7.zip

vi sonarqube-6.7/conf/sonar.properties

sonar.jdbc.username=sonar
sonar.jdbc.password=sonarPwd
sonar.jdbc.url=jdbc:mysql://10.0.0.100:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false&maxAllowedPacket=134217728
sonar.web.context=/sonarqube
sonar.web.port=9003
sonar.ce.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
sonar.search.javaOpts=-Xms512m \
 -Xmx512m \
 -XX:+HeapDumpOnOutOfMemoryError

sonarqube-6.7/bin/linux-x86-64/sonar.sh start

http://localhost/sonarqube 접속

프로젝트 생성
Administration → Project → Management 클릭

sonarqube001 sonarqube002 sonarqube003 sonarqube004 sonarqube005 sonarqube006 sonarqube007 sonarqube008 sonarqube009
Language plugin 설치
Administration → Marketplace 클릭

sonarqube010

Previous article
Next article
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Time limit exceeded. Please complete the captcha once again.

Most Popular