2014년 3월 3일 월요일

Get Started With SonarQube On EC2

Requirements(요구 사양 확인)

Prerequisite

The only prerequisite for running SonarQube is to have Java (Oracle JRE 6 onwards) installed on your machine.

Hardware Requirements(하드웨어 요구사양)
  1. The SonarQube web server requires at least 500 Mb of RAM to run efficiently.
  2. The amount of disk space you need will depend on how much code you analyze with SonarQube. As an example, Nemo the public instance of SonarQube, has more than 10 millions lines of code under analysis with 4 years of history. Nemo is currently running on a Amazon EC2 small instance, using  about 10 Gb of drive space

http://docs.codehaus.org/display/SONAR/Requirements

Installation

Install JAVA7 (자바 7 설치)

ubuntu@ip-172-31-31-224:~$ sudo apt-get install openjdk-7-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
0 upgraded, 138 newly installed, 0 to remove and 3 not upgraded.
Need to get 79.2 MB of archives.
After this operation, 181 MB of additional disk space will be used.
Do you want to continue [Y/n]?

Install MySQL (mysql 설치)

~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl
  libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
  mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
  libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed:
  libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl
  libplrpc-perl libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
  mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 13 newly installed, 0 to remove and 3 not upgraded.
Need to get 27.2 MB of archives.
After this operation, 97.5 MB of additional disk space will be used.
Do you want to continue [Y/n]?

Installing the DataBase (DB설치)

make sample scripte for mysql

~$ vi create_database.sql

# Create SonarQube database and user.
#
# Command: mysql -u root -p < create_database.sql
#

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_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;

create database

~$ mysql -u root -p < create_database.sql
Enter password: <—insert your root passwd of mysql

Download

Add the following entry in your /etc/apt/sources.list :

deb http://downloads.sourceforge.net/project/sonar-pkg/deb binary/

Update your local package index and install Sonar:

sudo apt-get update
sudo apt-get install sonar

Sonar native packages

Those packages install standalone version of Sonar into "/opt/sonar" and provide init script, so it can be launched as:

/etc/init.d/sonar start

Change Database


sudo vi /opt/sonar$ sudo vi conf/sonar.properties

#sonar.jdbc.url=jdbc:h2:tcp://localhost:9092/sonar

#----- MySQL 5.x
# Comment the embedded database and uncomment the following line to use MySQL
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true


Restart


$ sudo /etc/init.d/sonar restart
Starting sonar...
Started sonar.


Run!!!


image2014-3-1 17-20-32

http://sonar-pkg.sourceforge.net/

http://docs.codehaus.org/display/SONAR/Installing

http://www.chrishjorth.com/blog/free-aws-ec2-ubuntu-apache-php-mysql-setup/

댓글 없음:

댓글 쓰기