Tuesday, February 26, 2013

Configure Sudo for RAD

Configure Sudo for RAD

Login as root
run command visudo
# visudo
Add below entries
%admin ALL=(ALL) ALL
Cmnd_Alias RAD_CMDS = /opt/IBM/SDP/eclipse
%wheel ALL=(ALL) NOPASSWD: RAD_CMDS  # this is local group, if the user not local one, you may need add line as below
aniu ALL=(ALL) NOPASSWD: RAD_CMDS
Add target users in group wheel
# vi /etc/group
wheel:x:10:aniu

login as target user and run below command:
$ sudo -n /opt/IBM/SDP/eclipse

Friday, February 22, 2013

Running Windows PowerShell Scripts

http://technet.microsoft.com/en-us/library/ee176949.aspx

VirtualBox: Start up Virtual Box in headless mode

Reference: http://www.howtoforge.com/vboxheadless-running-virtual-machines-with-virtualbox-4.0-on-a-headless-ubuntu-10.10-server

# vboxheadless -s win2008test

Wednesday, February 20, 2013

Oracle: Create First Database

Reference: http://dba-onweb.blogspot.ca/2008/03/oracle-11g-creating-database-with-asm.html

login as oracle
cd /opt/oracle/product//11.2.0/dbhome_1/bin
dbca

control file: *.ctl
oracle@expc2042:/opt/oracle/product/11.2.0/dbhome_1/dbs> pwd
/opt/oracle/product/11.2.0/dbhome_1/dbs
oracle@expc2042:/opt/oracle/product/11.2.0/dbhome_1/dbs> ls
hc_aniu.dat  hc_DBUA0.dat  hc_expc2042.dat  init.ora  lkANIU  lkEXPC2042  orapwaniu  orapwexpc2042  spfileaniu.ora  spfileexpc2042.ora

cd /opt/oracle
 find . -name "*.ctl" -exec ls -l {} \;

-rw-r----- 1 oracle oradba 9748480 Feb 20 15:48 ./flash_recovery_area/aniu/control02.ctl
-rw-r----- 1 oracle oradba 9748480 Feb 20 15:48 ./oradata/aniu/control01.ctl

redo log
oracle@expc2042:/opt/oracle> find . -name "*.log" -exec ls -l {} \; |grep redo
-rw-r----- 1 oracle oradba 52429312 Feb 20 15:31 ./oradata/aniu/redo02.log
-rw-r----- 1 oracle oradba 52429312 Feb 20 15:50 ./oradata/aniu/redo01.log
-rw-r----- 1 oracle oradba 52429312 Feb 20 15:32 ./oradata/aniu/redo03.log

Oracle: Start up oracle on Linux

oracle@expc2042:/opt/oracle/product/11.2.0/dbhome_1/bin> sqlplus / as sysdba


oracle@expc2042:/opt/oracle/product/11.2.0/dbhome_1/bin> emctl start dbconsole

oracle@expc2042:/opt/oracle/product/11.2.0/dbhome_1/bin> lsnrctl start LISTENER


oracle@expc2042:/opt/oracle/product/11.2.0/dbhome_1/bin> lsnrctl start LISTENER

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 20-FEB-2013 11:06:47

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/expc2042/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=expc2042)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                20-FEB-2013 11:06:49
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/expc2042/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=expc2042)(PORT=1521)))
The listener supports no services
The command completed successfully

Monday, February 11, 2013

SuSe Linux: Determine DHCP Server.

# cat /var/lib/dhcp/dhclient.leases
lease {
  interface "eth0";
  fixed-address 17.15.140.103;
  option subnet-mask 255.255.255.0;
  option routers 17.15.140.1;
  option dhcp-lease-time 3600;
  option dhcp-message-type 5;
  option domain-name-servers 17.15.24.5,17.15.75.48;
  option dhcp-server-identifier 17.15.24.5;
  option interface-mtu 576;
  option broadcast-address 255.255.255.255;
  option netbios-name-servers 17.15.24.2,17.15.8.7;
  option netbios-node-type 8;
  option domain-name "toronto.ca";
  renew 4 2013/02/07 15:24:35;
  rebind 4 2013/02/07 15:52:19;
  expire 4 2013/02/07 15:59:49;
}

Wednesday, February 6, 2013

Samba Java API


http://jcifs.samba.org/

Setup SVN on SUSE

Prerequisites

Apache 2
Neon Library
Subversion Client

Installation

Prerequisites Installation

1.    Install Apache 2
2.    Install neon from first DVD, libneon27-0.29.6-6.7.1.x86_64.rpm
3.    Get Subversion Server and Client Binaries
4.    Install SubVersion Client first, and then Subversion Server

Subversion Installation

Change folder to where Subversion Server binary placed
# rpm -ivh subversion-server-1.6.17-51.1.x86_64.rpm
After Subversion installation, you should be able to find below file placements:

# rpm -ql subversion-server-1.6.17-51.1.x86_64
/etc/apache2/conf.d
/etc/apache2/conf.d/subversion.conf
/usr/lib64/apache2
/usr/lib64/apache2/mod_authz_svn.so
/usr/lib64/apache2/mod_dav_svn.so

Configuration

Configure Apache 2

1. Apply below changes in /etc/sysconfig/apache2

APACHE_MODULES="authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis dav dav_fs imagemap php5 perl python dav_svn authz_svn authz_default ssl"

< APACHE_SERVER_FLAGS="SSL"
2. SSL Enablement
Creating a “Dummy” Certificate
Generating a dummy certificate is simple. Just call the script /usr/bin/gensslcert. It creates or overwrites the following files:

    /etc/apache2/ssl.crt/ca.crt
    /etc/apache2/ssl.crt/server.crt
    /etc/apache2/ssl.key/server.key
    /etc/apache2/ssl.csr/server.csr

A copy of ca.crt is also placed at /srv/www/htdocs/CA.crt for download.

Apply below changes to /etc/apache2/vhosts.d/vhost-ssl.conf (copy it from vhost-ssl.template if it doesn't exist)
Comment out below line:
SSLProtocol all -SSLv2 -SSLv3


Restart Apache2 and test both secure and non-secured connection.

Configure SVN Repository

Initialization

# svnadmin create /path/to/repository
# svnlook info /path/to/repository

Repository Populating (optional)

Dump repository
# svnadmin dump /path/to/sourceRepository > repositoryDump.rep

Load repository from dump file
#  svnadmin load /path/to/targetRepository <repositoryDump.rep

Tuesday, February 5, 2013

Windows PowerShell ABC

How to Run Powershell Srcipt

http://technet.microsoft.com/en-us/library/ee176949.aspx

How to print message:

write-output "test1";
write-host "test2";
"test3";