Wednesday, August 14, 2019

Building Linux Kernel from Scratch in Ubuntu

Hi,

In this post we are going to deal with building Linux kernel from scratch

Prerequisites
Name Version Download Page Direct Link
Linux Kernel 5.2.8 Linux Kernel Download Page Click here to Download

You must be asking when there are plenty of online resources available to build linux kernel why should we have an other one talking about the same.

Well the answer is pretty simple, this blog is an other way to have linux kernel built in a precise manner which is to the point of building it with no blah blah blah.....

Lets get it started...

From the prerequisites section, download the require softwares and put those in one of your favourite locations...If not open a terminal and navigate to the location you prefer and fire the command below
> wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.8.tar.xz

Mostly we will be using terminal to perform the operations.

NOTE : this article was written when linux kernel was at version 5.2.8

The procedure is going to be similar to forth coming versions of linux kernel and to some extent of the past version of kernel as well.

Now is the time verify the kernel that we have downloaded in order to do that proceed as described below...

1. Installing Development Tools
Before we build the kernel, it is required to install or required to have the supporting software in place.

The development tools packages need to installed and can be done via the following way
> sudo apt-get install build-essential
> sudo apt-get install libncurses-dev
> sudo apt-get install bison
> sudo apt-get install flex
> sudo apt-get install libssl-dev
> sudo apt-get install libelf-dev

The above command set can be executed in one single line as given below but I have split it up to have good view of what we are installing
> sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev

2. Extracting the linux kernel package
Open a terminal and navigate to the location where you have downloaded the kernel package, use the following command to untar the file
> unxz -v linux-5.2.8.tar.xz
OR
> xz -d -v linux-5.2.8.tar.xz

3. Linux kernel package verification
The first step in the verification process is to get the signature, but how to get that?, well do not worry...use the command below to get the signature
> wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.8.tar.sign
the above operation can be verified as verified from a image below...


we have not yet verified the signature of the downloaded kernel package...

In order to verify it, use the following command
> gpg linux-5.2.8.tar.sign

The response of the above command execution would be as follows...


The above response is a normal one and to verify the signature, grab the pgp key form pgpserver as given below..

Use the RSA key from the GPG server to verify the signature, In order to do that use the following command
> gpg --recv-keys 6092693E
The command execution would be as follows....


Do not be panic, this is quite an usual response of the execution, if you get any other responses apart form "bad URI" or "bad Signature"  which is also fine.

Now untar the file using the following command....
> tar -xfv linux-5.2.8.tar

4. Features and Modules Configuration

Before we build the kernel we have to build the features and select the modules required, this is a daunting task for a new comer.

We do have a shortcut to perform the operation, use the copy command to copy the existing config file using the following command(s)
> cd linux-5.2.8
> cp -v /boot/config-$(uname -r) .config

The execution of the above command would be resulted as follows


5. Kernel Configurations
Kernel configuration is the next process involved in building the kernel, the following command would help us to configure it from a GUI like window, run the command form the command line as mentioned below...
> make menuconfig
the above command would result something like the one given below...



Pick the appropriate one form the option to configure the kernel.

6. Compiling the Kernel
 This is a long process, form the linux kernel directory that we are going to build, fire the following command to compile the kernel.
> make
depending the no of cores available and to make the compiling process faster we can compile the kernel with the following command as well
> make -j 4
or
> make -j $(nproc)
relax till the process is completed.

7. Installing Kernel Modules
To install the kernel modules fire the command below...
> sudo make modules_install

8. Install the Kernel
To install the kernel, fire the command below...
> sudo make install
The above command will install three file as part the process under /boot directory.... namely,

1. config-5.2.8
2. initrd.img-5.2.8
3. vmlinuz-5.2.8

the image given below would justify that too...



This confirms the installation of kernel in to the system.

Well that is it, hope you had great time reading it.

Thanks.

Saturday, August 10, 2019

Running Multiple Instances of MySql in ubuntu 16.04

Hi,

In this post we will discuss about having multiple instances of mysql on a server machine.

I am trying  to establish the objective here using MySql-5.7.25 on Ubuntu, you can do the same with other version of MySql as well

If you do not have one, you can refer an other article of mine to install MySql Server, the link to it is given below

MySql Server Installation in Ubuntu

1. Disabling mysqld in AppArmor 
The first and foremost is disabling mysqld using AppArmor tool, Ubuntu is shipped with this tool by default and if not you can install the same using the following web page as reference...

Installation of AppArmor

Create a link to "usr.sbin.mysqld" in disable folder as follows...

Move to folder "/etc/apparmor.d/disable" and provide the command below to have mysql daemon disabled at the start up
> sudo ln -s ../usr.sbin.mysqld usr.sbin.mysqld

RESTART YOUR MACHINE

2. Creating Directories and Files

The second step is to create required directories for each instances of mysql, the following commands would help to create those directories for you.

I have chosen "/opt" directory as my location to put the directories in but, you can choose to have your convenient location to create directories...

The below commands would ask to provide the password before the execution, provide the one associated with the account.

Creating directories for Instance One
> sudo mkdir -p /opt/mysql/one/data
> sudo mkdir -p /opt/mysql/one/log
> sudo touch /opt/mysql/one/log/mysql.log
> sudo chown -R mysql:mysql /opt/mysql/one
> sudo /usr/sbin/mysqld --initialize --explicit_defaults_for_timestamp --user=mysql --basedir=/opt/mysql/one --datadir=/opt/mysql/one/data

Creating directories for Instance Two
> sudo mkdir -p /opt/mysql/two/data
> sudo mkdir -p /opt/mysql/two/log
> sudo touch /opt/mysql/two/log/mysql.log
> sudo chown -R mysql:mysql /opt/mysql/two
> sudo /usr/sbin/mysqld --initialize --explicit_defaults_for_timestamp --user=mysql --basedir=/opt/mysql/two --datadir=/opt/mysql/two/data

Creating directories for Instance Three
> sudo mkdir -p /opt/mysql/three/data
> sudo mkdir -p /opt/mysql/three/log
> sudo touch /opt/mysql/three/log/mysql.log
> sudo chown -R mysql:mysql /opt/mysql/three
> sudo /usr/sbin/mysqld --initialize --explicit_defaults_for_timestamp --user=mysql --basedir=/opt/mysql/three --datadir=/opt/mysql/three/data

3. Editing my.cnf file (/etc/mysql/my.cnf)

The third step is to update the file called "my.cnf" file which you can locate under the folder "/etc/mysql"

The following are the details to be provided for each instance of MySql in "my.cnf", these entries are called group entries where each entry corresponds to an instance of mysql

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = multi_admin
password = password
log = /var/log/mysqld_multi.log
[mysqld1]
skip-grant-tables
user = mysql
port = 3306
datadir = /opt/mysql/one/data
socket = /opt/mysql/one/one-mysql.sock
pid-file = /opt/mysql/one/one-mysql.pid
log-error = /opt/mysql/one/log/mysql.log
[mysqld2]
skip-grant-tables
user = mysql
port = 4406
datadir = /opt/mysql/two/data
socket = /opt/mysql/two/two-mysql.sock
pid-file = /opt/mysql/two/two-mysql.pid
log-error = /opt/mysql/two/log/mysql.log
[mysqld3]
skip-grant-tables
user = mysql
port = 5506
datadir = /opt/mysql/three/data
socket = /opt/mysql/three/three-mysql.sock
pid-file = /opt/mysql/three/three-mysql.pid
log-error = /opt/mysql/three/log/mysql.log

Start the Instances

After the configuration update is finished at "my.cnf", the immediate next step is to start the instance to check its function.

The command given below would help you to achieve starting an instance, if you are successful please perform the same actions for other instances as well...

NOTE: do not forget to change the socket file parameter...

> sudo mysqld_multi start
> mysql -u root -S /opt/mysql/default/default-mysql.sock -p
mysql> use mysql
mysql> UPDATE user SET authentication_string=PASSWORD('admin') WHERE User='root';
mysql> FLUSH PRIVILEGES;

4. Granting SHUTDOWN privilege to multi_admin USER

This step discuss granting shutdown privileges to multi_admin user, to provide the same kill the running mysql instances using "ps-aux | grep mysql"

remove "skip-grant-tables" parameter from every group in my.cnf file

now your my.cnf file should look something as below

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = multi_admin
password = password
log = /var/log/mysqld_multi.log
[mysqld1]
user = mysql
port = 3306
datadir = /opt/mysql/one/data
socket = /opt/mysql/one/one-mysql.sock
pid-file = /opt/mysql/one/one-mysql.pid
log-error = /opt/mysql/one/log/mysql.log
[mysqld2]
user = mysql
port = 4406
datadir = /opt/mysql/two/data
socket = /opt/mysql/two/two-mysql.sock
pid-file = /opt/mysql/two/two-mysql.pid
log-error = /opt/mysql/two/log/mysql.log
[mysqld3]
user = mysql
port = 5506
datadir = /opt/mysql/three/data
socket = /opt/mysql/three/three-mysql.sock
pid-file = /opt/mysql/three/three-mysql.pid
log-error = /opt/mysql/threelog/mysql.log

5. Start an instance

After removing the "skip-grant-tables" parameter from the group in "my.cnf" each instance of MySql will be identified by numbers based  on the position they appear in the configuration file.

To start the first instance, issue the following command
> sudo mysqld_multi start 1
login as root using the following command on instance 1 to check whether the connection establishment is fine.
> mysql -u root -S /opt/mysql/default/default-mysql.sock -p
provide the password of the root user

We can conclude the connection is fine, the the terminal window appears with mysql prompt.

6. Reset the password of root

This is final step and also an optional step to have, If you want to reset the root users password you can perform resetting the password using the following commands.
mysql> SET PASSWORD = PASSWORD('admin');
mysql> GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost' IDENTIFIED BY '<password-provided-in-my.cnf-for-multi_admin>';

Thursday, August 8, 2019

Xeams : The Extended Mail and Messaging Server Installation in Ubuntu 16.04

Hi,

In this blog article, we are going to see how to install Xeams extended mail and messaging server in ubuntu 16.04

There would not be much deviation from the installation procedure between version of Opertating System, the same procedure can be adopted for other OSes with little bit or no tweaks...

So, lets start the show....

Prerequisites
Name Version Download Page Direct Link
Java 1.7 N/A N/A
Xeams 7.0 Xeams Downloads Page Click to Download Directly

From the above prerequisite section we are going to discuss only about the installation of Xeams but not Java.

To Install Java, there are plenty of resource available online, Please refer the one appropriate to you.

1. Installation of Xeams Mail Server
Form the downloads page or using the direct link, download the Xeams extended Mail and Messaging server and put it in a preferred location you like. What you download would be a .tar file, please extract the same

Open a terminal and navigate to the folder where you have extracted the package.

At the prompt, fire the following command to install the Mail Server
> ./Install.sh
The execution of the above command would ask certain questions, If you like you can answer those or leave it blank to have the server configured with default values....

Please sit back and relax till the execution completes, which would hardly take a minute.

This installation would also install a service, which takes care of starting the service at the machine startup.

You can find the service at the below mentioned location...

/etc/init.d/xeams

Well this concludes the installation of Xeams extended Mail and Messaging server.

2.  Server Configuration

In order to configure the server, open a browser and hit the following address in the address bar

http://localhost:5272

The server configuration requires certain details in order to function correctly, which would also ask you to set the administrator account to maintain the server.

Administrator Details
The first page asks you the details for a administrator, provide the same and click next to proceed.



Server Type
The next configuration item is the server type, select the one appropriate to you, In my case I have selected the standalone type and click next to proceed.



Domain Setup
The third items is the domain setup, you can key in the domain name if you have one and click next to proceed.



Verification
The last part is the verification page, Please check the details which you have provided are correct



Logout from the application using logout menu item in Home Menu and Log back in.

You would see the administrator control panel page like the one given in the image below...



There are plenty other options to configure, have a walk thru if you want to configure the required features for the installation

Well this concludes the article

Hope you liked it, Thanks.

Wednesday, August 7, 2019

How to set up DevNull SMTP Server for your development and testing environment

Hi,

In this post we are going to see how to install a DevNull SMTP server for our development/testing environment...

Many of us as developers would always encounter a situation during development/testing, the mailing feature of the application. We have different ways of setting up SMTP Server locally but those are very time consuming or the server package would require a lot of configuration to be done.

But with DevNull it will be like a cake walk to have SMTP server installed locally with minimal or no configurations.

For details you can refer the following site to have more details about DevNull

Official Site of DevNull

Let us go straight into the business of installing DevNull SMTP server in our development/testing environment

1. Installation
1. Please download DevNull SMTP server package using the link given below and hold it in your preferred location.

Direct Link : Download DevNull SMTP Server

2. Open an terminal and navigate to the folder where you have downloaded DevNull server package

3. At the prompt, fire the command as given below...
> java -jar DevNullSmtp.jar

2. Usages

Graphical User Interface Option
If you want the Graphical User Interface along with SMTP server, then fire the command below
> java -jar DevNullSmtp.jar

the result of the command execution would result something like the image given below...


the GUI has three important parts to be talked about....

1. The Listening PORT
2. Control to start the server
3. Place holder to save  the mail messages

The port and place holder items are configurable and we can change that anytime according to our needs.

The default port is "25", in order to have the server run make sure you do not have any service running at port 25, if you have then change the port value of DevNull SMTP Server to any other value other than "25" eg "2025"

Console Option

DevNull provides another option to have the server run as console application, to achieve that run the following command at the prompt..
> java -jar DevNullSmtp.jar -console

The above command comes with a variety of switches whose discription is given below...

'-d' switch : Holds domain names from where the email comes

'-p' switch : Holds the port value of the server

'-s' switch : Holds the location where mail messages are stored.

'-h' switch : List the options with its descriptions.

Command with '-d' Switch
> java -jar DevNullSmtp.jar -console -d first.com, second.com

Command with '-p' Switch
> java -jar DevNullSmtp.jar -console -p 2025

the '-h' option would list down all the options that server contains...
> java -jar DevNullSmtp.jar -h

Well this concludes the installation of DevNull SMTP Server

Hope you had good time reading it.

Thanks.

How to set up FakeSMTP Server for your development and testing environment

Hi,

In this post we are going to see how to install a fake SMTP server for our development/testing environment...

Many of us as developers would always encounter a situation during development/testing, the mailing feature of the application. We have different ways of setting up SMTP Server locally but those are very time consuming or the server package would require a lot of configuration to be done.

But with FakeSMTP it will be like a cake walk to have SMTP server installed locally with minimal or no configurations.

For details you can refer the following site to have more details about FakeSMTP

Official Site of Fake SMTP

Let us go straight into the business of installing FakeSMTP server in our development/testing environment

1. Installation
1. Please download FakeSMTP server package using the link given below and hold it in your preferred location.

Direct Link : Download FakeSMTP Server

2. Extract the package

3. Open an terminal and navigate to the folder where you have extracted FakeSMTP server package

4. At the prompt, fire the command as given below...
> java -jar fakeSMTP-2.0.jar
This article was written at the time when FakeSMTP was at version 2.0, please change the name of the jar file accordingly in case if you have different version of FakeSMTP

2. Usages

Graphical User Interface Option
If you want the Graphical User Interface along with SMTP server, then fire the command below
> java -jar fakeSMTP-2.0.jar

the result of the command execution would result something like the image given below...



the GUI has three important parts to be talked about....

1. The PORT
2. Control to start the server
3. Place holder to save  the mail messages

The port and place holder items are configurable and we can change that anytime according to our needs.

The default port is "25", in order to have the server run make sure you do not have any service running at port 25, if you have then change the port value of FakeSMTP to any other value other than "25" eg "1024"

Background Task Option

FakeSMTP provides another option to have the server run as back ground task, to achieve that run the following command at the prompt..
> java -jar fakeSMTP-2.0.jar -b -p 2525 -a 127.0.0.1
Let us discuss the command line arguments of the above command...

'-b' switch : Indicates that the server should run as background task

'-p' switch : Holds the port value of the server

'-a' switch : Holds the IP Address, in this case the IP address is the loopback address.

You can also specify the place holder to save the mail messages with the following command.
> java -jar fakeSMTP-2.0.jar -b -o <NAME-OF-THE-FOLDER> -p 2525 -a 127.0.0.1
the switch '-o' stands for Output Folder 

If you do not want to save the mail messages in a folder you could also do that via a switch as given below...
> java -jar fakeSMTP-2.0.jar -b -m -p 2525 -a 127.0.0.1

the --help option would list down all the options that server contains...
> java -jar fakeSMTP-2.0.jar --help

Well this concludes the installation of FakeSMTP Server

Hope you had good time reading it.

Thanks.

Tuesday, August 6, 2019

Installing SonarQube - 4.5.7 and Generating PDF Reports of the Analysis For an Ant Based Project in Ubuntu

Hi,

In this post, I am going to talk about how to perform static code analysis of any java project based on ANT build.

The Prerequisites section lists the items that we should have in place to preform the source code analysis and sonarqube is depending on.

Prerequisites
Name Version Download Page Direct Link
SonarQube 4.5.7 SonarQube Download Page Click to Download Directly
SonarQube Ant Task 2.5 SonarQube Ant Task Download Page Click to Download Directly
SonarQube Scanner API 2.8 SonarQube Scanner API Download Page Click to Download Directly
jsr305 3.0.0 jsr305-3.0.0.jar Download Page Click to Download Directly
Sonar PDF Report Plugin 1.4 Sonar PDF Report Plugin Download Page Click to Download Directly
Apache Ant 1.9.14 Apache Ant Click to Download Directly
MySql 5.7.26 MySql N/A

From the prerequisites section... I will be discussing the installation of first three items and for the last two, you can refer online for the installation of same.

1. Installation of MySql Server
If you have one already you can skip this section else you can check an other post of mine, the link to the post is given below. .

Installation of MySql Server on Ubutu

2. Creating Database for SonarQube
Login into mysql server, make sure you have the administrator privileges, In my case I am going to use the root account. Open up a Terminal and fire fire the command below
> mysql -u root -p
the above command would prompt you for password to key in, provide the password associated with the account, if the login is successful, then the mysql prompt would appear on the terminal.

At the mysql prompt, create a database using any name of your choice....
mysql> create database sonarqube;
create a user to access the database that we just created and grant full access to the user, the root account is sufficient to access the database, but it is not advisable to share or use the administrator account....

command to create a user
mysql> create user sonarqube identified by 'password';

command to give full access on the database 'sonarqube'
mysql> grant all privileges on sonarqube.* to 'sonarqube' identified by 'password'

2. Installation of SonarQube
Download SonarQube using the direct link given at the prerequisite section, and extract it to one of your favourite locations, make sure the location where you extract sonarqube has write permissions...

2.1 Updating SonarQube's Configuration File
Inside the extracted folder, you would find a folder named 'conf', navigate to that sub-directory and open the file 'sonar.properties' in your favourite text editor....

In my case I was using VI
> vi sonar.properties
In this file you would find three properties namely
1. sonar.jdbc.username
2. sonar.jdbc.password
3. sonar.jdbc.url

Un comment the above mentioned properties and update these as dictated below....

FROM:
sonar.jdbc.username=sonar

TO:
sonar.jdbc.username=sonarqube
FROM:
sonar.jdbc.password=sonar

TO:
sonar.jdbc.password=password
FROM:
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

TO:
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

3. Installing SonarQube Ant Task
Download the SonarQube Ant Task from the location given in the prerequisite section and extract it to your favourite location.

4. Installing SonarPDF Report Plugin
Download Sonar PDF Report Plugin from the location given in the prerequisites section and drop in the sonarqube server at the location given below....

<INSTALLATION-DIRECTORY-OF-SONARQUBE>/extensions/plugins

5. Start SonarQube Server
Open a terminal and navigate to the bin directory of sonarqube i.e <INSTALLATION-DIRECTORY-OF-SONARQUBE>/bin and fire the command below at the prompt...
> sonarqube/linux-x86-64/sonar.sh start
Pick the appropriate directory according to the Operation System you are working with.

After you start your sonarqube server... you could see the server writing tables required to generate the reports on the database... when you open your database and list the tables you should see similar to the image given below...


This concludes the sonarqube server setup...

6.Updating Ant's build.xml of the Project
Let us start updating the Ant's build.xml file of the project, assuming the build.xml file is like the one given below....
<project name="hello-world" basedir="." default="deploy">
<import file="build-common.xml" />
</project>
This build.xml file explains, the name of the project is 'hello-world' and the default task is deploy... along with that, the file imports other tasks from the file named 'build-common.xml'...

Now let us update the file build.xml in order to have the source code analysed for the project...

As a first step let us introduce "xmlns:sonar", this is one of the attributes of xml element <project>, after you introduce this attribute the build.xml file should like the one given below...
<project name="hello-world" basedir="." default="deploy" xmlns:sonar="antlib:org.sonar.ant">
<import file="build-common.xml" />
</project>

Next we are going to introduce new task definition to the project

<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="<SONAR-ANT-JARS-INSTALLATION-PATH>/jsr305-3.0.0.jar" />
<classpath path="<SONAR-ANT-JARS-INSTALLATION-PATH>/sonarqube-ant-task-2.5.jar" />
<classpath path="<SONAR-ANT-JARS-INSTALLATION-PATH>/sonar-scanner-api-2.8.jar" />
</taskdef>

Now the build.xml file should appear something like the one given below....

<project name="fiera-messaging-portlet" basedir="." default="deploy" xmlns:sonar="antlib:org.sonar.ant">
 
    <import file="../build-common.xml" />
 
    <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
        <classpath path="/home/ravaneswaran/sonar-ant-jars/jsr305-3.0.0.jar" />
        <classpath path="/home/ravaneswaran/sonar-ant-jars/sonarqube-ant-task-2.5.jar" />
        <classpath path="/home/ravaneswaran/sonar-ant-jars/sonar-scanner-api-2.8.jar" />
    </taskdef>
 
</project>

The next job is to introduce the sonar task, in order to do that update the build.xml file with the following lines

<target name="sonar" depends="compile">
     
        <property name="sonar.jdbc.url" value="jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&amp;characterEncoding=utf8" />
        <property name="sonar.jdbc.username" value="sonarqube" />
        <property name="sonar.jdbc.password" value="password" />
     
        <property name="sonar.projectKey" value="hello-world" />
        <property name="sonar.projectName" value="Hello World" />
        <property name="sonar.projectVersion" value="1.0" />
        <property name="sonar.language" value="java" />
        <property name="sonar.sources" value="docroot" />
        <property name="sonar.binaries" value="docroot/WEB-INF/classes" />
        <property name="sonar.sourceEncoding" value="UTF-8" />
     
     
        <property name="sonar.exclusions" value="**/com/test/base/**/*,**/com/test/persistence/**/*,**/com/test/impl/**/*" />
        <echo>Sonar Report is Executing</echo>
        <echo>Sonar Report is Executing on Source Directory docroot/WEB-INF/src,docroot/html</echo>
     
        <!-- Execute SonarQube Scanner for Ant Analysis -->
        <sonar:sonar/>
    </target>

To brief some about the above target, this is nothing but the configurations that sonar ant would be looking for

if you look closely you can see  properties holding the values required to connect to database and to communicate to sonarqube server....

The final build.xml file would be like the one given below....

<project name="fiera-messaging-portlet" basedir="." default="deploy" xmlns:sonar="antlib:org.sonar.ant">
 
    <import file="../build-common.xml" />
 
    <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
        <classpath path="/home/fiera-mm/Downloads/sonar-ant-jars/jsr305-3.0.0.jar" />
        <classpath path="/home/fiera-mm/Downloads/sonar-ant-jars/sonarqube-ant-task-2.5.jar" />
        <classpath path="/home/fiera-mm/Downloads/sonar-ant-jars/sonar-scanner-api-2.8.jar" />
    </taskdef>
 
    <target name="sonar" depends="compile">
     
        <property name="sonar.jdbc.url" value="jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&amp;characterEncoding=utf8" />
        <property name="sonar.jdbc.username" value="sonarqube" />
        <property name="sonar.jdbc.password" value="password" />
     
        <property name="sonar.projectKey" value="hello-world" />
        <property name="sonar.projectName" value="Hello World" />
        <property name="sonar.projectVersion" value="1.0" />
        <property name="sonar.language" value="java" />
        <property name="sonar.sources" value="docroot" />
        <property name="sonar.binaries" value="docroot/WEB-INF/classes" />
        <property name="sonar.sourceEncoding" value="UTF-8" />
     
     
        <property name="sonar.exclusions" value="**/com/test/base/**/*,**/com/test/persistence/**/*,**/com/test/impl/**/*" />
        <echo>Sonar Report is Executing</echo>
        <echo>Sonar Report is Executing on Source Directory docroot/WEB-INF/src,docroot/html</echo>
     
        <!-- Execute SonarQube Scanner for Ant Analysis -->
        <sonar:sonar/>
    </target>
 
    <target name="all" depends="clean,compile,sonar"/>
 
</project>


7 Generating the Reports
Now we are all set to generate the sonarqube analysis for our project "hello-world"

Make sure the sonarqube server is up and running.

Open up a terminal and navigate to the project directory and fire the command below to generate the analysis...
> ant sonar

8 Viewing the Reports
Now open up a browser and hit the following address on the address bar

http://localhost:9000

You can see the result of the analysis of sonarqube as the one given below...



Well this concludes this post, hope you have enjoyed it

Thanks.

How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...