Skip to content

Instantly share code, notes, and snippets.

@rasheedamir
Last active May 29, 2023 15:58
Show Gist options
  • Select an option

  • Save rasheedamir/11460beef67bc6b58d61 to your computer and use it in GitHub Desktop.

Select an option

Save rasheedamir/11460beef67bc6b58d61 to your computer and use it in GitHub Desktop.

Revisions

  1. rasheedamir revised this gist Dec 9, 2014. No changes.
  2. rasheedamir revised this gist Dec 6, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -146,4 +146,8 @@ mvn sonar:sonar
    ## Configure SonarQube in IntelliJ
    http://docs.codehaus.org/display/SONAR/SonarQube+in+IntelliJ
    http://docs.codehaus.org/display/SONAR/SonarQube+in+IntelliJ
    ## Configure SonarQube in Eclipse
    http://docs.codehaus.org/display/SONAR/SonarQube+in+Eclipse
  3. rasheedamir revised this gist Dec 6, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -142,4 +142,8 @@ sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncodi
    mvn clean install
    mvn sonar:sonar
    ```
    * Now go to your sonar and you will find your project!
    * Now go to your sonar and you will find your project!
    ## Configure SonarQube in IntelliJ
    http://docs.codehaus.org/display/SONAR/SonarQube+in+IntelliJ
  4. rasheedamir revised this gist Dec 5, 2014. No changes.
  5. rasheedamir revised this gist Dec 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Create Amazon EC2 Instance

    * Ensure that inbound MySQL port is opened
    * Ensure that inbound `MySQL` port `3306` is opened
    * `chmod 700 "keypair-name.pem"`

    ## Install MySQL
  6. rasheedamir revised this gist Dec 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ sudo apt-get update
    sudo apt-get install oracle-java7-installer
    ```
    ## Install Web Server
    ## Install Sonar
    ##### Install
    * Add the following entry in your /etc/apt/sources.list: `cd /etc/apt/` then `sudo vim sources.list` then `press o` then copy
  7. rasheedamir revised this gist Dec 3, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -141,4 +141,5 @@ sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncodi
    ```bash
    mvn clean install
    mvn sonar:sonar
    ```
    ```
    * Now go to your sonar and you will find your project!
  8. rasheedamir revised this gist Dec 3, 2014. 1 changed file with 46 additions and 2 deletions.
    48 changes: 46 additions & 2 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ sudo apt-get update
    sudo apt-get install oracle-java7-installer
    ```
    ## Installing the Web Server
    ## Install Web Server
    ##### Install
    * Add the following entry in your /etc/apt/sources.list: `cd /etc/apt/` then `sudo vim sources.list` then `press o` then copy
    @@ -97,4 +97,48 @@ sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncodi
    ##### Start
    * `cd /opt/sonar/bin` `sudo sh sonar.sh start` `sudo sh sonar.sh stop`
    * `cd /opt/sonar/log` `tail -f sonar.log`
    * `ps -ef | grep sonar`
    * `ps -ef | grep sonar`
    ## Analyzing with Maven
    * Adding following in your `.m2/settings.xml`
    ```bash
    <settings>
    <profiles>
    <profile>
    <id>sonar</id>
    <activation>
    <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
    <sonar.jdbc.url>
    jdbc:mysql://www.myserver.com:3306/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true&amp;useConfigs=maxPerformance
    </sonar.jdbc.url>
    <sonar.jdbc.username>sonar</sonar.jdbc.username>
    <sonar.jdbc.password>sonar</sonar.jdbc.password>
    <sonar.host.url>
    http://www.myserver.com/sonar/
    </sonar.host.url>
    </properties>
    </profile>
    </profiles>
    </settings>
    ```
    * Add following `sonar-maven-plugin` in the project `pom` file
    ```bash
    <!--
    SonarQube™ is an open source platform for Continuous Inspection of code quality.
    The Maven Plugin triggers the code analyzers.
    -->
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>2.4</version>
    </plugin>
    ```
    * Run these commands
    ```bash
    mvn clean install
    mvn sonar:sonar
    ```
  9. rasheedamir revised this gist Dec 2, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    ## Create Amazon EC2 Instance

    `chmod 700 "keypair-name.pem"`
    * Ensure that inbound MySQL port is opened
    * `chmod 700 "keypair-name.pem"`

    ## Install MySQL

  10. rasheedamir revised this gist Dec 2, 2014. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,18 @@ FLUSH PRIVILEGES;
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
    * To verify the database has been created: `show databases;` you should see database with name `sonar`
    * Modify my.cnf
    ```bash
    sudo nano /etc/mysql/my.cnf
    find the line:
    bind-address = 127.0.0.1
    and change it to:
    bind-address = 0.0.0.0
    ```
    then restart mysql
    ## Install Java
    ```bash
  11. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -30,11 +30,11 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio

    ```bash
    vi create_database.sql

    Create SonarQube database and user.

    Command: mysql -u root -p < create_database.sql
    ```

    ```bash
    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';
  12. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    #### Create Amazon EC2 Instance
    ## Create Amazon EC2 Instance

    `chmod 700 "keypair-name.pem"`

    #### Install MySQL
    ## Install MySQL

    To install MySQL, run the following command from a terminal prompt:
    * `sudo apt-get install mysql-server`
    @@ -46,15 +46,15 @@ FLUSH PRIVILEGES;
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
    * To verify the database has been created: `show databases;` you should see database with name `sonar`
    #### Install Java
    ## Install Java
    ```bash
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    ```
    #### Installing the Web Server
    ## Installing the Web Server
    ##### Install
    * Add the following entry in your /etc/apt/sources.list: `cd /etc/apt/` then `sudo vim sources.list` then `press o` then copy
  13. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -67,6 +67,16 @@ sudo apt-get install oracle-java7-installer
    * `sudo nano sonar.properties`
    * Comment the embedded database and uncomment the line to use MySQL
    ```bash
    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
    ```
    ##### Configure WebServer
    * `sonar.web.context=/sonar`
    * `sonar.web.port=9000`
  14. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -28,18 +28,19 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio

    * Here is a [MYSQL Script](https://github.com/SonarSource/sonar-examples/blob/master/scripts/database/mysql/create_database.sql)

    ```bash
    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 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;
    ```
    * To run the script: `sudo mysql -u root -p < create_database.sql`
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
  15. rasheedamir revised this gist Nov 28, 2014. No changes.
  16. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -35,12 +35,11 @@ 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 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;

    * To run the script: `sudo mysql -u root -p < create_database.sql`
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
  17. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -28,12 +28,12 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio

    * Here is a [MYSQL Script](https://github.com/SonarSource/sonar-examples/blob/master/scripts/database/mysql/create_database.sql)

    ~$ vi create_database.sql
    vi create_database.sql

    Create SonarQube database and user.

    Command: mysql -u root -p < 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;

  18. rasheedamir revised this gist Nov 28, 2014. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,21 @@ The MySQL daemon will be stopped, and you will be prompted to enter a new passwo
    Create an empty schema and a sonarqube user. Grant this sonarqube user permissions to create, update and delete objects for this schema. The charset of the database has to be set to "UTF-8" and the language (database and user) to "English".

    * Here is a [MYSQL Script](https://github.com/SonarSource/sonar-examples/blob/master/scripts/database/mysql/create_database.sql)

    ~$ 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;

    * To run the script: `sudo mysql -u root -p < create_database.sql`
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
    * To verify the database has been created: `show databases;` you should see database with name `sonar`
  19. rasheedamir revised this gist Oct 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,7 @@ sudo apt-get install oracle-java7-installer
    * `sonar.web.context=/sonar`
    * `sonar.web.port=9000`

    ##### Starting!
    ##### Start
    * `cd /opt/sonar/bin` `sudo sh sonar.sh start` `sudo sh sonar.sh stop`
    * `cd /opt/sonar/log` `tail -f sonar.log`
    * `ps -ef | grep sonar`
  20. rasheedamir revised this gist Oct 3, 2014. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -53,6 +53,10 @@ sudo apt-get install oracle-java7-installer
    * Comment the embedded database and uncomment the line to use MySQL

    ##### Configure WebServer
    * `sonar.web.host=192.0.0.1`
    * `sonar.web.context=/sonar`
    * `sonar.web.port=9000`
    * `sonar.web.port=9000`

    ##### Starting!
    * `cd /opt/sonar/bin` `sudo sh sonar.sh start` `sudo sh sonar.sh stop`
    * `cd /opt/sonar/log` `tail -f sonar.log`
    * `ps -ef | grep sonar`
  21. rasheedamir revised this gist Oct 3, 2014. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -52,3 +52,7 @@ sudo apt-get install oracle-java7-installer
    * `sudo nano sonar.properties`
    * Comment the embedded database and uncomment the line to use MySQL

    ##### Configure WebServer
    * `sonar.web.host=192.0.0.1`
    * `sonar.web.context=/sonar`
    * `sonar.web.port=9000`
  22. rasheedamir revised this gist Oct 3, 2014. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -41,7 +41,14 @@ sudo apt-get install oracle-java7-installer

    #### Installing the Web Server

    ##### Install
    * Add the following entry in your /etc/apt/sources.list: `cd /etc/apt/` then `sudo vim sources.list` then `press o` then copy
    `deb http://downloads.sourceforge.net/project/sonar-pkg/deb binary/` then `press ESC` then write `:wq!` then `press ENTER`
    * `sudo apt-get update`
    * `sudo apt-get install sonar`
    * `sudo apt-get install sonar`

    ##### Configure Database
    * Go to `/opt/sonar/conf`
    * `sudo nano sonar.properties`
    * Comment the embedded database and uncomment the line to use MySQL

  23. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -37,4 +37,11 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    ```
    ```

    #### Installing the Web Server

    * Add the following entry in your /etc/apt/sources.list: `cd /etc/apt/` then `sudo vim sources.list` then `press o` then copy
    `deb http://downloads.sourceforge.net/project/sonar-pkg/deb binary/` then `press ESC` then write `:wq!` then `press ENTER`
    * `sudo apt-get update`
    * `sudo apt-get install sonar`
  24. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -36,5 +36,5 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio
    ```bash
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer maven git-core
    sudo apt-get install oracle-java7-installer
    ```
  25. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,8 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio

    #### Install Java

    ```bash
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer maven git-core
    sudo apt-get install oracle-java7-installer maven git-core
    ```
  26. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -31,3 +31,8 @@ Create an empty schema and a sonarqube user. Grant this sonarqube user permissio
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
    * To verify the database has been created: `show databases;` you should see database with name `sonar`

    #### Install Java

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer maven git-core
  27. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,10 @@ If you would like to change the MySQL root password, in a terminal enter:

    The MySQL daemon will be stopped, and you will be prompted to enter a new password.

    Create an empty schema and a sonarqube user. Grant this sonarqube user permissions to create, update and delete objects for this schema. The charset of the database has to be set to "UTF-8" and the language (database and user) to "English". Here is a [MYSQL Script](https://github.com/SonarSource/sonar-examples/blob/master/scripts/database/mysql/create_database.sql)
    Create an empty schema and a sonarqube user. Grant this sonarqube user permissions to create, update and delete objects for this schema. The charset of the database has to be set to "UTF-8" and the language (database and user) to "English".

    * Here is a [MYSQL Script](https://github.com/SonarSource/sonar-examples/blob/master/scripts/database/mysql/create_database.sql)
    * To run the script: `sudo mysql -u root -p < create_database.sql`
    * To verify the user has been created: `SELECT User FROM mysql.user;` you should see user with name `sonar`
    * To verify the database has been created: `show databases;` you should see database with name `sonar`

  28. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -22,4 +22,6 @@ If the server is not running correctly, you can type the following command to st
    If you would like to change the MySQL root password, in a terminal enter:
    * `sudo dpkg-reconfigure mysql-server-5.5`

    The MySQL daemon will be stopped, and you will be prompted to enter a new password.
    The MySQL daemon will be stopped, and you will be prompted to enter a new password.

    Create an empty schema and a sonarqube user. Grant this sonarqube user permissions to create, update and delete objects for this schema. The charset of the database has to be set to "UTF-8" and the language (database and user) to "English". Here is a [MYSQL Script](https://github.com/SonarSource/sonar-examples/blob/master/scripts/database/mysql/create_database.sql)
  29. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,5 @@ If the server is not running correctly, you can type the following command to st

    If you would like to change the MySQL root password, in a terminal enter:
    * `sudo dpkg-reconfigure mysql-server-5.5`

    The MySQL daemon will be stopped, and you will be prompted to enter a new password.
  30. rasheedamir revised this gist Sep 28, 2014. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Install & Configure SonarQube.md
    Original file line number Diff line number Diff line change
    @@ -15,3 +15,10 @@ Once the installation is complete, the MySQL server should be started automatica

    When you run this command, you should see the following line or something similar:
    * `tcp 0 0 localhost:mysql *:* LISTEN 2759/mysqld`

    If the server is not running correctly, you can type the following command to start it:
    * `sudo service mysql restart`

    If you would like to change the MySQL root password, in a terminal enter:
    * `sudo dpkg-reconfigure mysql-server-5.5`
    The MySQL daemon will be stopped, and you will be prompted to enter a new password.