Thursday, May 27, 2010

New step for install 'HandBrake' Application in Ununtu 10.04.

HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder, available for MacOS X, Linux and Windows.

Supported Sources:

Any DVD-like source: VIDEO_TS folder, DVD image or real DVD (unencrypted--protection methods including CSS are not supported internally and must be handled externally with third-party software and libraries), and some .VOB and .TS files
Most any multimedia file it can get libavformat to read and libavcodec to decode.

Outputs:

File format: MP4 and MKV
Video: MPEG-4, H.264, or Theora
Audio: AAC, CoreAudio AAC (OS X Only), MP3, or Vorbis. AC-3 pass-through, DTS pass-thorugh (MKV only)

Misc features:

Chapter selection
Subtitles
Integrated bitrate calculator
Picture deinterlacing, cropping and scaling
Live Video Preivew

Credits

HandBrake uses a lot of (L)GPL librairies from the Linux world:



Step 1: Adding the below lines to /etc/apt/sources.list

deb http://ppa.launchpad.net/stebbins/handbrake-snapshots/ubuntu lucid main
deb-src http://ppa.launchpad.net/stebbins/handbrake-snapshots/ubuntu lucid main

Step 2: Adding this PPA to your system
You can update your system with unsupported packages from this untrusted PPA by adding ppa:stebbins/handbrake-snapshots to your system's Software Sources.

tatshuya$> sudo add-apt-repository ppa:stebbins/handbrake-snapshots

Step 3: Now, as a one-off, you should tell your system to pull down the latest list of software from each archive it knows about, including the PPA you just added:

tatshuya$> sudo apt-get update

Step 4: Installing handbrake package.

tatshuya$> sudo apt-get install handbrake-gtk


== TaTsHuYa ==

Wednesday, May 26, 2010

Unison - File Synchronizer Tools

What is Unison?
Unison is a file-synchronization tool for Unix and Windows. It allows
two replicas of a collection of files and directories to be stored on
different hosts (or different disks on the same host), modified
separately, and then brought up to date by propagating the changes in
each replica to the other.

So I used Ubuntu, it easy to install on this distribute.
tatshuya$ sudo apt-get install unison-gtk

Start the program.



First use.

select your directory that you want to synchronize.

Next.

select your destination.

Example of result when you sync your data.



==TaTsHuYa==

Monday, May 10, 2010

How to implement SNMP on RedHat's Server

Objective:


Centralize monitoring server at my network use Nagios engine to monitor and alarm when there is a problem in the network, there are many ways to retrieve the information on remote server like use NRPE ( Nagios Addons - allows you to remotely execute Nagios plugins on other Linux/Unix machines but it need to install program on remote host ) or SNMP ( Simple Network Management Protocol – use UDP network protocol )



Package Requirements :


The following is the list of package required for snmpd for Red Hat Enterprise Linux 4 U7

      • net-snmp

      • net-snmp-lib


To determine whether the required package is installed, enter commands similar to the following.

# rpm -q net-snmp net-snmp-libs

if the package is not installed on the server, you will see the result like this.

package net-snmp-5.1.2 is not installed ( or )

package net-snmp-libs-5.1.2 is not installed


To install the required package, enter command similar to the following.

# rpm -ivh net-snmp-5.1.2-18.el4.x86_64.rpm net-snmp-libs-5.1.2-18.el4.x86_64.rpm


If you found package net-snmp-5.1.2 is not installed but there is an package net-snmp-libs-5.1.2 installed on server but it is older version than net-snmp-5.1.2-18.el4, when you install net-snmp-5.1.2-18.el4.x86_64.rpm you will found the error like this

warning: /tmp/net-snmp-5.1.2-18.el4.x86_64.rpm: V3 DSA signature: NOKEY, key ID db42a60e


error: Failed dependencies:


net-snmp-libs = 5.1.2-18.el4 is needed by net-snmp-5.1.2-18.el4.x86_64



you should update net-snmp-libs before you install net-snmp by command.

# rpm -Uvh net-snmp-libs-5.1.2-18.el4.x86_64.rpm


Now the lastest package for net-snmp and net-snmp-libs are version 5.1.2-18, you can download from Redhat website at http://rhn.redhat.com







Configure snmpd.conf :


First section, change the community 'public' to use word that we defined in the group and specific the source of ip address or hostname and define the security name that we will use in the second section.


Example :

# sec.name source community

com2sec local aa.bb.cc.dd/32 xxxxxx



Second section, map the security name into a group name

Example :

# groupName securityModel securityName


group MyROGroup v1 local


group MyROGroup v2c local




Third section, create a view for us to let the group have rights to


Example :

# name incl/excl subtree mask(optional)

view all included .1


Finally, grant the group read-only access to the systemview view


Example :

# group context sec.model sec.level prefix read write notif

access MyROGroup "" any noauth exact all none none




**** There is the easy way to configure snmpd.conf by you can copy from your existing server at path '/etc/snmp/snmpd.conf' and transfer to remote server that you're want to configure. ****


Start SNMP service :

After you configure snmpd.conf, you should start snmpd process by using command.


# /etc/init.d/snmpd start


Check process SNMP :

# ps -ef |grep snmpd


if there is no error, you should see the result like this

root 30240 1 2 15:40 ? 00:00:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a


Manage service snmpd to start every time when server's boot :

You can check if the snmpd service will be automatic start when the server boot by command.


# chkconfig –list snmpd

snmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off


That result mean the service snmpd will not start when the server reboot, if you want to start snmpd automatic you should use this command.


# chkconfig snmpd on

# chkconfig --list snmpd


snmpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off



Test get information from snmpwalk:

You can test snmp service on server that you configure at monitoring server by command

/usr/bin/snmpwalk -c -v 2c .1


if there is no error, you will see a lot of data like these.

RFC1213-MIB::sysDescr.0 = STRING: "Linux xxxx 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:46:26 EDT 2008 x86_64"

RFC1213-MIB::sysObjectID.0 = OID: NET-SNMP-TC::linux

RFC1213-MIB::sysUpTime.0 = Timeticks: (564217) 1:34:02.17

RFC1213-MIB::sysContact.0 = STRING: "Root (configure /etc/snmp/snmp.local.conf)"

...

..

.


Troubleshoot when you cannot get the result:

if you see the error like this

ERROR: Description table : No response from remote host "x.x.x.x".


First of all, you should check IPTABLES on the remote host that there is a rule allow incoming package from monitoring server by port snmp ( 161 ) or not , by command

# iptables -L -v

if you cannot see the rule on your iptables, you should add this policy in you rule.

# iptables -I RH-Firewall-1-INPUT -s xxxx -p udp --dport snmp -j ACCEPT


the upper command will effective temporary until server reboot, if you want insert rule permanent you should run command

iptables-save > /etc/sysconfig/iptables ( or )

edit directly at /etc/sysconfig/iptables



If you still found the problem after you checked configure's iptables policy,

Please check the current mode of SELinux on that server , you can check the current mode of SELinux by command.


# sestatus


If you found the currrent mode of SELinux is 'Enforing', you must change the to the permissive mode by running command

# setenforce 0


then restart snmpd again.

Using PL/SQL Developer with Oracle instantclient

If you have PLSQL Developer installed on your computer already,
you have to download oracle instantclient from here

choose that supported for your platform & your database.
like, Instant Client for Microsoft Windows (32-bit)
==> Version 11.2.0.1.0
====> instantclient-basic-win32-11.2.0.1.0.zip


When you downloaded zip file to your computer already, extract to your path
like, c:\instantclient_11_2

Then right client at My Computer ==> Advanced ==> Environment Variables



At Environment Variables window click new at user variable ( if you want to add for this user only) or system variable ( if you want all users on this computer use )

add
ORACLE_HOME=c:\instantclient_11_2
TNS_ADMIN=c:\instantclient_11_2
NLS_LANG=AMERICAN_AMERICA.TH8TISASCII



Then, Create text file tnsnames.ora at c:\instantclient_11_2 with your connection string to use your database
like,
TESTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.2)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = TESTDB)
)
)

That all!

==TaTsHuYa==

Thursday, April 29, 2010

Command line downloads by using multiple connections

Today I try to search in the google that 'wget' can download one file in multiple threads , I found nothing to support this.

but I found the other program can, 'axel'

Axel - A lighter download accelerator for Linux and other Unices.
his program tries to accelerate the downloading process by using multiple connections for one file. Starting from version 0.97, the program can use multiple mirrors for one download as well. The program tries to be as light as possible (25-30k in binary form), so it might be useful as a wget clone on byte-critical systems.


install this program in ubuntu.
tatshuya# sudo apt-get install axel


## help
tatshuya# axel -h
Usage: axel [options] url1 [url2] [url...]

--max-speed=x -s x Specify maximum speed (bytes per second)
--num-connections=x -n x Specify maximum number of connections
--output=f -o f Specify local output file
--search[=x] -S [x] Search for mirrors and download from x servers
--header=x -H x Add header string
--user-agent=x -U x Set user agent
--no-proxy -N Just don't use any proxy server
--quiet -q Leave stdout alone
--verbose -v More status information
--alternate -a Alternate progress indicator
--help -h This information
--version -V Version information

## try download new ubuntu ( 10.04 ) with 5 connections
tatshuya# axel -n 5 http://cdimage.ubuntu.com/dvd/current/lucid-dvd-i386.iso


== TaTsHuYa ==

Monday, April 26, 2010

Resize and Clone disk in VirtualBox.

I have a space problem in my guest os ( windows ) because the first time I just created disk only 10 Gbytes and now it's nearly full.

I have a solution to resize disk by use Virtual Media in Virtual Box.

First, create new disk that larger than the old one.


Next, use command VBoxMedia to clone Harddisk
tatshuya# VBoxManage clonehd --existing "WinXP.vdi" "WinXP-New.vdi"

Sun VirtualBox Command Line Management Interface Version 3.1.6
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: e2785c5a-fbf3-499c-a1c3-2c70405d8184

Then, change Harddisk in Storage settting.



== TaTsHuYa ==

Sunday, April 25, 2010

Enable Java plugins for google chrome in Ubuntu 10.04

In Ubuntu 10.04, sun-java6 packages are not going to be available for ubuntu within the repositories.

So in this version I used "icedtea6-plugin" that is web browser plugin based on OpenJDK and IcedTea to execute Java applets.

First you just checked there is package installed in your system.

tatshuya# sudo dpkg -l icedtea6-plugin

ii icedtea6-plugin 6b18-1.8-0ubuntu1 web browser plugin based on OpenJDK and IcedTea to execute Java applets

Next, create directory plugin in google chrome directory.
tatshuya# sudo mkdir /opt/google/chrome/plugins


Create symbolic link for java plugin
tatshuya# sudo ln -s /usr/lib/jvm/java-6-openjdk/jre/lib/i386/IcedTeaPlugin.so /opt/google/chrome/plugins

Run google chrome with the parameter '--enable-plugins'
tatshuya# /opt/google/chrome/google-chrome --enable-plugins %U

Test java plugins by goto website 'http://www.bodo.com/javame.htm'


== TaTsHuYa ==

Monday, April 05, 2010

Install Driver DWL-520+ on ubuntu 9.10

Finally after I tried to find many ways to use My OLD PCI Wireless Card on Ubuntu 9.10, I found the easy way to use it by follow this instruction.

'https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper'

Install the ndisgtk package from the Ubuntu repositories.
$> sudo apt-get install ndisgtk

Download Driver for my wireless card.
$> wget ftp://ftp.dlink.com/Wireless/dwl520+/Driver/dwl520+_drivers_307.zip

Extract the Driver
$> unzip dwl520+_drivers_307.zip

Installing Windows driver
$> sudo ndiswrapper -i Drivers/WinXP/AIRPLUS.INF

Automatically loading at start-up
$> sudo echo ndiswrapper >> /etc/modules

==TaTsHuYa==
Load the new driver module
$> sudo depmod -a
$> sudo modprobe ndiswrapper

Tuesday, February 23, 2010

How to find size of objects in Oracle.

When you want to find size of object (table, index) in your oracle database, you can use this script.

SELECT sum(bytes)/1048576 Megs, segment_name
FROM dba_extents
WHERE segment_name = '&object_name'
GROUP BY segment_name
/

Ref : http://www.arikaplan.com/oracle/ari60399.html

== TaTsHuYa ==

Thursday, February 18, 2010

Use sun java plugin on Firefox's ubuntu 9.10

By default on Firefox's Ubuntu 9.10 use java plugin 'IcedTea Java Web Browser Plugin'

But when I want to manage EMC Storage CX300 and CX700 by access to Navisphere 6 wep page of those devices, I found that there is no content to display.

So I decide to change it to use Sun Java(TM) Plug-in

First, go to the shell command and install sun-java6-plugin
tatshuya$> apt-get install sun-java6-plugin

After you installed sun-java6-plugin already, you go back to the firefox browser again
Enable : Tools -> Add-ons -> Plugins -> Java(TM) Plug-in 1.6.0_15
Disable : Tools -> Add-ons -> Plugins -> IcedTea Java Web Browser Plugin



Finish.

== TaTsHuYa ==

Thursday, February 11, 2010

Compile FreeRadius error on RHEL4 x86_64

I got the error when I run make command.

** Error **
gcc: /usr/lib/libsnmp.so: No such file or directory


I just checked, there is no file "/usr/lib/libsnmp.so" but there is a file
"/usr/lib64/libsnmp.so"

So I clean up everything and export some environment variable before run configure.

# export LDFLAGS='-L/usr/lib64'
# ./configure
# make

Now, it can be compile completely.


== TaTsHuYa ==

Thursday, January 28, 2010

How to know client ipaddress in Oracle.

You can use this query to get Client IPAddress in Oracle.

Command:
select sys_context('userenv','ip_address') from dual;

Result:
192.168.1.1



Ref: http://forums.oracle.com/forums/thread.jspa?messageID=1562503

==TaTsHuYa==

Snmpd does not responding.

Today I found that when I use snmpwalk get information on some hosts but they didn't responding the result. It just show the error log 'No response from remote host "xxx.xxx.xxx.xxx"'
First - I checked the iptables ( it's already has the rule )
ACCEPT all -- xxx.xxx.xxx.xxx anywhere
Second - I try to dump the package by tcpdump to known that have the package received.
17:55:43.657982 IP xxx.xxx.xxx.xxx.51061 > yyy.yyy.yyy.yyy.snmp: C=MBpublic GetBulk(29) N=0 M=25 interfaces.ifTable.ifEntry.ifDescr
17:55:48.659170 IP xxx.xxx.xxx.xxx.51061 > yyy.yyy.yyy.yyy.snmp: C=MBpublic GetBulk(29) N=0 M=25 interfaces.ifTable.ifEntry.ifDescr


I found there are packages reach to the server but there is any response back to the remote

Third - I checked the process of snmpd by command 'ps -ef |grep snmpd'
root 768 26634 0 17:59 pts/1 00:00:00 grep snmpd
root 32365 1 0 17:54 ? 00:00:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd -a


Lastly : I decided to check the status of SELinux by command 'sestatus'
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing


So I change it so Permissive mode by command 'setenforce permissive' and try snmpwalk again, now It worked!!!!


Another reason that I found for snmpd doesn't responding is 'IPTABLES', if you add rule by use destination port and host by use protocol TCP on port 161 ( snmp ), it will not work because snmpd use UDP on port 161 for query the information.

== TatsHuYa ==

How to know status of SELinux

You can use the command 'sestatus' to find out the current status of SElinux.
There is 3 types of status
* enforcing - SELinux security policy is enforced.
* permissive - SELinux prints warnings instead of enforcing.
* disabled - SELinux is fully disabled.

tatshuya$> sestatus

== Result ==
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: permissive
Policy version: 18
Policy from config file:targeted

Policy booleans:

allow_syslog_to_console inactive
allow_ypbind inactive
dhcpd_disable_trans inactive
httpd_builtin_scripting active
httpd_disable_trans inactive
httpd_enable_cgi active
httpd_enable_homedirs active
httpd_ssi_exec active
httpd_tty_comm inactive
httpd_unified active
mysqld_disable_trans inactive
named_disable_trans inactive
named_write_master_zonesinactive
nscd_disable_trans inactive
ntpd_disable_trans inactive
pegasus_disable_trans inactive
portmap_disable_trans inactive
postgresql_disable_transinactive
snmpd_disable_trans inactive
squid_disable_trans inactive
syslogd_disable_trans inactive
use_nfs_home_dirs inactive
use_samba_home_dirs inactive
use_syslogng inactive
winbind_disable_trans inactive
ypbind_disable_trans inactive

== TaTsHuYa ==

Using IPTABLES allow multiport.

Today, I'm just learning that 'IPTABLES' can allow multiple port in single command like this '-m multiport --dports '

Example:
iptables -A RH-Firewall-1-INPUT -s 192.168.1.1 -m multiport --dport 80,443 -j ACCEPT

==TaTsHuYa==

Tuesday, January 26, 2010

Compile error: '/usr/bin/ld: cannot find -lelf'

When I try to compile application 'nagios-plugins-snmp', I found the error ' '/usr/bin/ld: cannot find -lelf'
The first thing I do, I search on the google and found that

-elf     elfutils-devel      (later renamed to elfutils-libelf-devel)


Then I search rpm in my redhat and not found, so I try to download this rpm at http://rpm.pbone.net in the internet and rerun again.

== TaTsHuYa ==