quinta-feira, 2 de junho de 2016

Installing Jenkins - CentOs 6.5

Installing Jenkins for CentOS 6.5


1. Introduction


This post shows how to install Jenkins for CentOS 6.5


2. Step by Step


2.1. Check/Install JDK or JRE

Check if JDK 1.6 or greather is available on machine. Depending on the purpouse of your Jenkins instalation, you will need to instal JDK (I strongly recommend). If you just want to take a look in Jenkins, so you can install JRE.

# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)         
                                                                # echo "Execute following command if JRE is not installed ..." 
# yum install java
        :
        :
#
# echo "I decided to install more than a simple JRE because I will compile code"
I decided to install more than a simple JRE because I will compile code
# yum install java-1.7.0-openjdk-devel
        :
        :



2.2. Add Jenkins repository to machine

# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
# sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
# sudo yum install jenkins


2.3. Install Jenkins

# yum install jenkins
  :
Dependencies Resolved
===========================================================================================================================
 Package                      Arch                        Version                       Repository                    Size
===========================================================================================================================
Installing:
 jenkins                      noarch                      2.3-1.1                       jenkins                       63 M
Transaction Summary
===========================================================================================================================
Install       1 Package(s)
Total size: 63 M
Installed size: 64 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : jenkins-2.3-1.1.noarch                                                                                  1/1
  Verifying  : jenkins-2.3-1.1.noarch                                                                                  1/1
Installed:
  jenkins.noarch 0:2.3-1.1
Complete!
  :



2.4. Add Jenkins to system boot


# chkconfig jenkins on


2.5. Start Jenkins service

# service jenkins start
Starting Jenkins                                           [  OK  ]
# service jenkins status
jenkins (pid  1310) is running...


2.6. Check Jenkins services

a. Checking Port Service

# echo "Jenkins default port is 8080. Check port listening ..."
# netstat -tnlp | grep 8080


b. Checking firewall rules

# echo "Check if port 8080 is listening ..."
# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:10050
:      :         :           :                   :                 :

# echo "Add listening rule to 8080 - Save rules - restart services ..."
# iptables -I INPUT 2 -p tcp --dport 8080 -j ACCEPT
# service iptables save 
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
# service iptables restart
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:8080


2.7. Configure Jenkins administrator password


  • Open first time your Jenkins server on browser
  • http://127.0.0.1:8080/

Getting Started 
  Unlock Jenkins
    To ensure Jenkins is securely set up by the administrator, a password ....
    /var/lib/jenkins/secrets/initialAdminPassword                             
    Please copy the password from either location and paste it below.         
                                                                              
# cat /var/lib/jenkins/secrets/initialAdminPassword                           



2.8. Configure Jenkins - Installing Plugins recommended

Getting Started 
  Customize Jenkins
    Plugins extend Jenkins with additional features to support many different needs.
      Install suggested plugins


2.9. Configure Jenkins - Configure first admin user

Getting Started 
  Create First Admin User
    username: admin
    password: admin
    e-mail  : admin@yourdomain.com

2.10. Configure Jenkins - Jenkins is ready

Getting Started 
  Jenkins is ready!


3. References



quinta-feira, 8 de outubro de 2015

Statspack alternative for performance monitoring Oracle XE because AWR is not licenced

1. Introduction

Unfortunatly, Oracle Express does not license "AWR - Automatic Workload Management" (see references). But performance issues  exists in any system! You can install and use an old Oracle tool called StatsPac to monitor and capture statistical data from your Oracle instance.

2. Step by Step

2.1. Install StatsPack Binary

2.2. Test StatsPack


3. References





Powershell script to read .csv file and processing each row

1. Introduction

This script shows how to process each line of a .csv file.  Put fields headers in first line.


2. Script

2.1. Sample 'services.csv' input file

servico,login,senha
Spooler,lp0795\tmp,tmp
Themes,lp0795\tmp,tmp
Spooler,lp0795\tmp,tmp


2.2. Script sample

# ##############################################################################
# filename: csv-process.ps1
# author  : josemarsilva@yahoo.com.br
# date    : 2015-10-09
# purpose : Sample script processing each row from a .csv file. First row has
#           fields titles
# pre-reqs: 
#           - Set-ExecutionPolicy Unrestricted
# remarks :
# ############################################
#
$csvFile = "C:\Users\Josemarsilva\Downloads\services.csv"
$bufferRead = Import-Csv $csvFile
foreach ( $line in $bufferRead ) {
    # println fields ...
    "servico = " + $line.servico + "; login = " + $line.login + "; senha=" + $line.senha
    # do whatever you want here! you have each field in $line.<field>
}


2.3. Script output sample

servico = Spooler; login = lp0795\tmp; senha=tmp
servico = Themes; login = lp0795\tmp; senha=tmp
servico = Spooler; login = lp0795\tmp; senha=tmp

terça-feira, 2 de junho de 2015

Usefull tool for your end user query database and export result to Excel

1. Introduction

dbQueryExport is usefull tool to your final end user that does not know SQL, but frequently issues you need of information from your systems. Usually final end user needs the result of a query execution exported in a Excel file. Using dbQueryExport, you can customize command line arguments to pre-setting some options for your end user, like database connection, path-to-sqlfile, etc. And finally, you can create shortcut icons with these command line arguments.

dbQueryExport connect to databases ( Oracle, MySQL, PostgreSQL or any other database throught Jdbc Driver ).

2. Demonstration 

  • Demo #1: Using dbQueryExport to export an Oracle database Query


  • Demo #2: Using dbQueryExport to export a Mysql e database Query


  • Demo #3: Using dbQueryExport to export a PostgreSQL database Query


3. Command line arguments

Usage: dbQueryExport [options]

    -c     Class name for invocation
    -d     Database Url location for Jdbc Driver
    -u     Username Jdbc connection
    -p     Password Jdbc connection
    -f     SQL Query Filename complete path
    -o     Export Filename complete path


Examples:
    dbQueryExport.jar -c oracle.jdbc.driver.OracleDriver -d jdbc:oracle:thin:@localhost:1521:dbname -u username -p password -f "C:\TEMP\sqlquery.sql" -o "C:\TEMP\sqlquery.xls"
    dbQueryExport.jar -c org.postgresql.Driver -d jdbc:postgresql://localhost/dbname -u username -p password -f "C:\TEMP\sqlquery.sql" -o "C:\TEMP\sqlquery.xls"
    dbQueryExport.jar -c com.mysql.jdbc.Driver -d jdbc:mysql://localhost:3306/dbname -u username -p password -f "C:\TEMP\sqlquery.sql" -o "C:\TEMP\sqlquery.xls"

See also:
    http://github.com/josemarsilva/dbQueryExport


4. References


Install OpenLDAP and phpLDAPadmin into Ubuntu 14.04

1. Introduction

This post only gathers information about how to install OpenLdap and phpLdapAdmin into Ubuntu 14.04


2. References




quarta-feira, 29 de abril de 2015

Installing DBDesigner 4.0.5 on Ubuntu (32bits) 14.04 and solving libborqt error

1 Introduction


This post show step-by-step how to install DBDesigner tool into Ubuntu 14.04 32bits


2 Step-by-Step

2.1 Download DBDesigner from fabForce site or download 


Enter site http://fabforce.net/dbdesigner4/ and look for Linux 32bits i386 file. I used this file http://fabforce.net/downloadfile.php?iddownloadfile=2


2.2 Uncompress tar.gz file download


$ cd ~/Downloads/
$ tar -zxvf DBDesigner4.0.5.4.tar.gz 


2.3 Enter DBDesigner subdirectory and try to run it. If the result is an error trying to open sared object "libborqt*.so" then follow the next steps


$ cd DBDesigner4/
$ ./DBDesigner4
libborqt-6.9-qt2.3.so: cannot open shared object file: No such file or directory


2.4 Download library from Kylix and uncompress 


$ cd ~/Downloads/
$ wget http://ufpr.dl.sourceforge.net/sourceforge/kylixlibs/kylixlibs3-borqt-3.0-2.tar.gz
$ tar zxvf kylixlibs3-borqt-3.0-2.tar.gz


2.5 Move correct version of library 'libborqt' to '/usr/lib' and adjust permissions


$ cd kylixlibs3-borqt/
$ sudo mv libborqt-6.9.0-qt2.3.so /usr/lib
$ sudo chown root:root /usr/lib/libborqt-6.9.0-qt2.3.so
$ sudo chmod ugo+r /usr/lib/libborqt-6.9.0-qt2.3.so


2.6 Create a symbolic link from expected file name of library to correct version of library

$ sudo ln -s /usr/lib/libborqt-6.9.0-qt2.3.so /usr/lib/libborqt-6.9-qt2.3.so


2.7 Install another required libraries 'libjpeg62'

$ sudo apt-get install libjpeg62:i386


2.8 Run DBDesigner successfully

$ cd DBDesigner4/
$ ./DBDesigner4



3. References