Omnipresent IT Solutions Pvt Ltd

Monday, August 24, 2009

Virtualbox not working after re-installing kernel

VirtualBox

VirtualBox is a powerful x86 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL).

http://www.virtualbox.org/

Virtualbox not working after re-installing kernel

In Fedora 11

Go to /etc/init.d/

And run ./vboxdrv setup

It will Recompile VirtualBox kernel module



For other OS users, post your problem here.

Wednesday, August 5, 2009

How to restore GRUB menu after Windows installation



How to restore GRUB menu after Windows installation

  1. Boot from the CD/DVD and at the boot prompt type: linux rescue.
  2. Select your language and keyboard layout.
  3. Choose whether or not to start networking interfaces.
  4. Mount your partitions read/write.
  5. Type chroot /mnt/sysimage to enter your Linux environment.
  6. Type grub-install /dev/sda or grub-install /dev/hda
  7. Reboot.

To add Windows entry into GRUB menu

Take a backup first
cp /boot/grub/menu.lst /boot/grub/menu.lst_backup

Edit the file and add following line at the end of file
/boot/grub/menu.lst

#windows
title Microsoft Windows
root (hd0,0)
savedefault
makeactive
chainloader +1


A sample menu.lst file

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,1)
# kernel /vmlinuz-version ro root=/dev/mapper/vg_acerfedora-lv_root
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=15
splashimage=(hd0,1)/grub/splash.xpm.gz
#hiddenmenu
title Fedora (2.6.29.6-217.2.3.fc11.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.29.6-217.2.3.fc11.i686.PAE ro root=/dev/mapper/vg_acerfedora-lv_root quiet
initrd /initrd-2.6.29.6-217.2.3.fc11.i686.PAE.img
title WindowsVista
rootnoverify (hd0,0)
chainloader +1

Note:You can change timeout,default values by editing this file.

Tuesday, August 4, 2009

Sunday, August 2, 2009

Configuring paths for Java and Oracle on fedora







Configuring paths for Java1.6.0_0 and Oracle 11g on fedora 11



Prerequisites:
1. Oracle 11g installed(You can refer my earlier posts)
2. Jdk installed(You can refer my earlier posts)

Adding Paths

Add these paths to the .bash_profile file in your oracle home directory
-----------------------------------------------------------------------
TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=acerfedora; export ORACLE_HOSTNAME

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME

ORACLE_SID=orcl; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

JAVA_HOME=/usr/lib/jvm/java-1.6.0 export JAVA_HOME

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

PATH=$JAVA_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/jdbc/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:.:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib/orai18n.jar:$ORACLE_HOME/jdbc/lib/ojdbc6.jar:/usr/share/java:/usr/share/java/servlet-api-2.5.jar:/usr/share/java/mysql-connector-java-5.1.6.jar:/usr/share/java/commons-dbcp-1.2.1.jar;
export CLASSPATH
------------------------------------------------------------------------------------------

Checking Java

[oracle@acerfedora ~]$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.5) (fedora-25.b16.fc11-i386)
OpenJDK Server VM (build 14.0-b15, mixed mode)

Starting Oracle

[oracle@acerfedora ~]$ lnsrctl start
bash: lnsrctl: command not found
[oracle@acerfedora ~]$ clear

[oracle@acerfedora ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 03-AUG-2009 04:48:09

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

Starting /u01/app/oracle/product/11.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/acerfedora/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=acerfedora)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 03-AUG-2009 04:48:09
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/acerfedora/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=acerfedora)(PORT=1521)))
The listener supports no services
The command completed successfully

Note:To stop use [oracle@acerfedora ~]$ lsnrctl stop

[oracle@acerfedora ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.1.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "orcl": log file /u01/app/oracle/product/11.1.0/db_1/startup.log

Note: To stop use [oracle@acerfedora ~]$ dbshut


Example program:atm.java

To verify the connection compile and run this example
class atm {
public static void main (String args []) throws SQLException
{
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl", "scott", "oracle");
// @machineName:port:SID, userid, password

Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
stmt.close();
}
}

Compile: javac atm.java
Run: java atm
Output:
[oracle@acerfedora jsp]$ java atm
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production

You can use Oracle Enterprise Manager 11g for further work

[oracle@acerfedora jsp]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.6.0
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
https://acerfedora:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control .......... started.

Logs are generated in directory /u01/app/oracle/product/11.1.0/db_1/acerfedora_orcl/sysman/log

Note: To stop [oracle@acerfedora jsp]$ emctl stop dbconsole


http://www.oracle.com/technology/software/products/database/index.html

Tomcat Server Configurations

Add these 2 files to /usr/share/tomcat5/common/lib

ojdbc6_g.2.jar and tools.jar

You wil get ojdbc6_g.2.jar from /u01/app/oracle/product/11.1.0/db_1/jdbc/lib

(or ur $ORACLE_HOME/jdbc/lib)

You wil get tools.jar from /usr/lib/jvm/java-1.6.0/lib

(or $JAVA_HOME/lib)

bash: ls: command not found

Don't Worry

This occurs when you edit your .bashrc file in your home folder
Suppose you edited your /root/.bashrc file as root folder.. Then you will not be able to do any commands.. No other users can change roots file also..

Solution
--------------
Take the terminal
[sarith@acerfedora ~]$ export PATH=/bin or to the path where your ls executable resides
Now you will be able to work with ls command. Come to home folder of the user

[sarith@acerfedora ~]$ export PATH=/usr/bin

Now you will be able to use gedit or vi or any other editor.Edit .bashrc file
Delete the path you added or Add path to all directories like
/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u01/app/oracle/product/11.1.0/db_1/bin:/home/sarith/bin

Exit the shell.. It started working again.. If any other problems mail me
sarithdivakar@yahoo.co.in

Bash

NAME
bash - GNU Bourne-Again SHell



DESCRIPTION
Bash is an sh-compatible command language interpreter that executes
commands read from the standard input or from a file. Bash also incor-
porates useful features from the Korn and C shells (ksh and csh).

When Bash starts, it executes the commands in a variety of different scripts.

When Bash is invoked as an interactive login shell, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

When a login shell exits, Bash reads and executes commands from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc.