SonarQube 설정
【OS】
이번은 CentOS6.6_x86_64판을 사용. 자세한 내용은 아래를 참조하십시오.
htp : // 전혀 s. 세르 ゔ ぇ 루 마누아 l. 코m/
사전 준비
설정에 필요한 패키지를 미리 설정해 둘 필요가 있다. 다음을 모두 설정한다.
시스템 변경이 발생하기 때문에 관리자 권한이 필수. root에 su 해 두는 것.
【YUM 패키지 관리】
yum -y install yum-plugin-fastestmirror
yum -y update
yum -y groupinstall "Base""Development tools""Japanese Support"
[RPMforge 리포지토리 추가]
rpm --import htp : // 오 pt. sw. 베/RPM-GPG-케 Y. 다g. txt
rpm -ivh htp : // 오 pt. sw. 베 / 레세 t / 에 l6 / 인 / x86_64 / rpm 펑 게 / RPMS / rpm 펑 게 0 5.3-1. 예 l6. rf. x86_64. rpm
[EPEL 리포지토리 추가]
rpm --import htp // dl. 푸드라 p로지ぇct. 오 rg / pu b / 에페 l / RPM - GPG - 케 Y - 에페 L - 6
rpm -ivh htp // dl. 후도라 p로지ぇct. rg/pu b/에페l/6/x86_64/에페l-레아세-6-8. 아 rch. rpm
[ELRepo 리포지토리 추가]
rpm --import htps //w w. 엘 리포. rg/RPM-GPG-케 Y-에 리포. 오 rg
rpm -Uvh h tp // w w. 엘 리포. 오 rg / 에 l 레포 ぇ 아세 - 6-6. 예 l6. 엘 리포. 아 rch. rpm
[Remi 리포지토리 추가]
rpm --import htp // rpms. 흠 흠 ぇ t. 이 m / RPM - GPG - Y Y Remi
rpm -ivh htp // rpms. 흠 흠 ぇ t. 코 m/엔테 rp 리세/레미-레아세-6. rpm
【SELinux 무효화】
getenforce
Enforcing ←SELinux 사용
setenforce 0
getenforce
Permissive ←SELinux 비활성화
vi/etc/sysconfig/selinux
SELINUX=enforcing
SELINUX = disabled ← 변경 (시작시 비활성화)
【iptables로 HTTP를 허가】
vi/etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT ← 추가
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Iptables 재부팅
service iptables restart
【MySQL 설정】
CentOS 빌드 시 기본적으로 설치된 버전을 제거합니다.
yum erase mysql*
rpm 추가
yum install htp : //에서 v. mysql. 코 m / 게 t / mysql - 캬무에 ty - ぇ 아세 - l6-5. 아 rch. rpm
MySQL5.6 설치
yum install mysql mysql-devel mysql-server mysql-utilities
확인
mysql –-version
mysql Ver 14.14 Distrib 5.6.15, for Linux (x86_64) using EditLine wrapper
기본 문자 세트를 utf8로 설정
vi/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
character-set-server=utf8
"# 任意設定"
innodb_file_per_table
query-cache-size=16M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
default-character-set=utf8
기동·자동 기동 설정service mysqld start
chkconfig mysqld on
MySQL 초기 설정
[root@www ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
root パスワードを設定
Set root password? [Y/n] y
New password: # 設定するパスワードを入力
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
匿名ユーザーは削除
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
root のリモートログインは無効
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
テストデータベースは削除
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
特権情報リロード
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
root で接続確認
[root@www ~]# mysql -u root -p
Enter password:# 設定したパスワードで認証
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
ユーザ一覧表示
mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | ***************************************** |
| root | 127.0.0.1 | ***************************************** |
+------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)
データベース一覧表示
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
mysql> exit
Bye
DB 설정
root 비밀번호 변경
mysql -u root
SET PASSWORD FOR root@localhost=password('***'); ←root 비밀번호 설정
EXIT;
SonarQube용 설정
mysql -u root -p 암호
CREATE DATABASE sonar CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;
exit;
【JAVA】
CentOS 빌드 시 기본적으로 설치된 버전을 제거합니다.
yum erase java*
최신 버전을 넷에서 입수 (rpm 버전)하고 설치
rpm –ivh jdk-8u45-linux-x64.rpm
버전 확인
java –version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
■JAVA_HOME 설정vi/etc/profile
export JAVA_HOME=/usr/java/default
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
【Maven】최신판을 넷에서 입수해/opt에 배치
tar zxvf apache-maven-3.3.3.tar.gz
mv apache-maven-3.3.3/opt
■MAVEN_HOME 설정
vi/etc/profile
export M3_HOME=/opt/apache-maven-3.3.3
M3=$M3_HOME/bin
export PATH=$M3:$PATH
【Tomcat】최신 버전을 인터넷에서 구해/usr/local/tomcat에 배치
tar zxvf apache-tomcat-8.0.23.tar.gz
mv apache-tomcat-8.0.23/usr/local/tomcat
■ TOMCAT_HOME 설정
vi/etc/profile
JAVA_HOME=/usr/java/default
CATALINA_HOME=/usr/local/tomcat
export JAVA_HOME CATALINA_HOME
■관리 사용자 작성・권한 부여useradd -s/sbin/nologin tomcat
chown -R tomcat:tomcat/usr/local/tomcat
■ 자동 스크립팅
vi/etc/init.d/tomcat
"#!/bin/bash"
"#"
"#Startup script for the Tomcat Servlet Container"
"#"
"#chkconfig: 2345 35 65"
"#description: Tomcat is the servlet container that is used in the official \"
"# Reference Implementation for the Java Servlet and JavaServer \"
"# Pages technologies"
TOMCAT_USER=tomcat
CATALINA_HOME=/usr/local/tomcat
. /etc/rc.d/init.d/functions
prog=tomcat
start() {
echo -n $"Starting $prog: "
daemon --user $TOMCAT_USER $CATALINA_HOME/bin/startup.sh > /dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
fi
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
daemon --user $TOMCAT_USER $CATALINA_HOME/bin/shutdown.sh > /dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
fi
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
"# See how we were called."
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
INSTANCES=ps --columns 512 -aef|grep java|grep tomcat|grep org.apache.catalina.startup.Bootstrap|wc -l
if [ $INSTANCES -eq 0 ]; then
echo $prog is stopped
RETVAL=3
else
if [ $INSTANCES -eq 1 ]; then
echo $prog is running 1 instance...
else
echo $prog is running $INSTANCES instances...
fi
RETVAL=0
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|status|help}"
exit 1
esac
exit $RETVAL
cd/etc/init.d
chmod +x tomcat
./tomcat start
자동 시작
/sbin/chkconfig --add tomcat
【SonarQube】
리포지토리 추가
wget -O/etc/yum.repos.d/sonar.repo ㅡㅡㅡㅜㅜㅜㅜㅜ 그렇게 r세후레. 네 t/p로지ぇct/소나 rpkg/rpm/소나 r. 레포
설치
yum -y install sonar
■Config 설정
vi/opt/sonar/conf/sonar.properties
"# User credentials."
"# Permissions to create tables, indices and triggers must be granted to JDBC user."
"# The schema must be created first."
"#sonar.jdbc.username=sonar←コメントを外す"
sonar.jdbc.username=sonar
"#sonar.jdbc.password=sonar←コメントを外す"
sonar.jdbc.password=sonar
"#"
"#"
"#----- MySQL 5.x"
"# Only InnoDB storage engine is supported (not myISAM)."
"# Only the bundled driver is supported."
"#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance←コメントを外す"
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
"#"
"#"
"#----- WEB SERVER"
"# By default, ports will be used on all IP addresses associated with the server."
"#sonar.web.host=0.0.0.0←コメントを外し、IPを設定"
sonar.web.host=192.168.194.39
"#"
"# TCP port for incoming HTTP connections. Disabled when value is -1."
"#sonar.web.port=9000←コメントを外す"
sonar.web.port=9000
■SONAR_HOME 설정vi/etc/profile
SONAR_HOME=/opt/sonar
PLATFORM=linux-x86-64
■ SonarQube 시작service sonar start
chkconfig sonar on
브라우저로 접속 확인. ID:admin PW:admin으로 로그온을 실시해, 각종 설정을 실시한다.
[settings] → [updatecenter]에서 일본어 팩을 선택하고 [설치] 버튼을 클릭
SonarQube 재부팅(service sonar restart)
다시 로그온 실시로 일본어 표기로 변경된다.
사용 방법은 별도로 작성합니다.
Reference
이 문제에 관하여(SonarQube 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/nagomu1985/items/a7021e382a0e40d0e153텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)