Thursday, November 12, 2009

Trriple Boot: Windows Debian CentOS

Hi All,

Dual or Tripple booting with Linux is very simple and easy nowadays. You dont have to worry about multiple kernels or anything.

Here I have used Debian 5.0.1 Lenny x64, CentOS 5.4 X64 and WinXP. This can be used for any other linux distrubution.
First you have to install windoze on to your disk, this is becuse it overwrites the what ever there in the MBR.
Linux only just added its entry to the MBR that, it. isn't that cool .... :)


I have given 50GB for Windoze, and this I have made as the primary partition. Then i made the rest of the space as the
extended partition, and created 7 logical partition inside the extended partition.
This is because a harddisk can have only 4 primary partition or 3 primary partition and one extended partition and in the
extended partition you have upto 15 partition.

now I have the below listed partitions available and how I allocated them for my Operating Systems.

/dev/sda1 - Windoze ( primary )
/dev/sda2 - for both the Linux OS's ( extended partition )

/dev/sda3 and /dev/sda4 is been kept reserved names for the any primary partition created in future
so the next partition inside the extended partition starts with /dev/sda5

/dev/sda5 - /boot ( Debian )
/dev/sda6 - /home ( Debian )
/dev/sda7 - / ( Debian )
/dev/sda8 - swap ( Debian and CentOS ) this swap partition is shared by the 2 OS
/dev/sda9 - /boot ( CentOS )
/dev/sda10 - /home ( CentOS )
/dev/sda11 - / ( CentOS )


And now I installed Debian, becuase I want debian's grub to have all the etries for other OS. Linux is smart enough to
detect the windows entry in the MBR and what it does is. It will over the MBR but wont forget to add the windoze entry
to it . So now When the system boots I have Debian Kernels and Windoze XP to make a choice to boot.

And now the we need to have the third OS on the machine, Here comes the tricky part. I will be installing CentOS as my third OS
Put the instalation DVD and start the install. At the sage when you need to install the grub , choose an option to install grub
somewhere else other than the MBR, I choosed to install them in my /boot partition of CentOS. because nothing will disturb it :).
so once the installation is completed and reboots it will show you the Debian boot loader, which has the entry for
Debian and Windoze. boot into debian and have to manually edit the menu.lst inside /boot/grub/

go to the /boot/grub/ directory and edith the menu.lst file and make this addition
title CentOS_5.4-x86_64
root (hd0,8) # Remeber that it count from 0 so (hd0,8) means /dev/sda9
chainloader +1

So now what you have is , when you boot the machine you wil get the debian boot loader with the option for
1) Debian Kernel
2) Debian Kernel ( single user mode )
3) CentOS_5.4-x86_64
4) Microsoft Windowx XP professional

Now when you select CentOS , you will now get the boot loader of CentOS ant can boot to any CentOS Kernel.

The same way you can use more number of Linux Distro installed in one machine.

Please let me know your Comments.

Thanks
Peeths

Monday, April 20, 2009

Recovering Ubuntu After Installing Windows

This option will use the Desktop/Live CD to install Grub into your MBR (Master Boot Record). This option will overwrite your Windows Boot Loader.


1. Boot the Desktop/Live CD. (Use Ubuntu 8.04 or later)

2. Open a terminal (Applications -> Accessories -> Terminal)

3. Start grub as root with the following command :

sudo grub

4. You will get a grub prompt (see below) which we will use to find the root partition and install grub to the MBR (hd0)

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub>


Type the following and press enter:

find /boot/grub/stage1

If you get "Error 15: File not found", try the following:


find /grub/stage1


Using this information, set the root device (fill in X,Y with whatever the find command returned):

grub> root (hdX,Y)

Exit Grub:

grub> quit

5. Reboot (to hard drive). Grub should be installed and both Ubuntu and Windows should have been automatically detected.

6. If, after installing grub, Windows will not boot you may need to edit /boot/grub/menu.lst (That is a small "L" and not the number 1 in menu.lst)

Open a terminal and enter :

gksu gedit /boot/grub/menu.lst


Or, in Kubuntu:

kdesu kate /boot/grub/menu.lst

Your Windows stanza should look something like this :

title Windows XP/Vista # You can use any title you wish, this will appear on your grub boot menu
rootnoverify (hd0,0) #(hd0,0) will be most common, you may need to adjust accordingly
makeactive
chainloader +1

Friday, April 3, 2009

Reliance Netconnect USB card on Linux - Howto

Execute everything as root

Check your card is recognized by the kernel

Code:
# cat /proc/bus/usb/devices

.....
.....
T: Bus=02 Lev=01 Prnt=01 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1
P: Vendor=12d1 ProdID=1001 Rev= 0.00
S: Manufacturer=Huawei Technologies
S: Product=Huawei Mobile
S: SerialNumber=HUAWEI EC3X1
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
E: Ad=8a(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=0b(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303
E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
.....
.....


Now modprobe the driver

Code:
# modprobe usbserial vendor=0x12d1 product=0x1001

Should get something like this with dmesg
Code:
# dmesg
[ 2315.412106] usbcore: registered new interface driver usbserial
[ 2315.412508] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[ 2315.461938] usbcore: registered new interface driver usbserial_generic
[ 2315.461945] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[ 2315.480382] drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
[ 2315.480414] pl2303 2-6:1.0: pl2303 converter detected
[ 2315.480608] usb 2-6: pl2303 converter now attached to ttyUSB0
[ 2315.480620] pl2303 2-6:1.1: pl2303 converter detected
[ 2315.480691] usb 2-6: pl2303 converter now attached to ttyUSB1

Now edit your wvdial.conf file

Code
# vi /etc/wvdial.conf

[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)
[Dialer cdma]
Username = You Phone Number Here
Password = Your Password ... usually same as your phone number
Phone = #777
Stupid Mode = 1
Inherits = Modem0

Now run wvdial

Code:
# wvdial cdma
--> WvDial: Internet dialer version 1.56
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 230400
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sat Mar 3 22:55:20 2007
--> Pid of pppd: 24314
--> Using interface ppp0
--> local IP address 220.226.50.126
--> remote IP address 97.239.2.10
--> primary DNS address 202.138.103.100
--> secondary DNS address 202.138.96.2

Thats it ... you are now connected
Ensure that your internet traffic goes through your "Modem"
In Ubuntu ... this can be done @ System->Administration->Networking

Saturday, March 7, 2009

Jboss and Tomcat port config in Fedora 10

I had face many issues while trying to configure multiple server my fedora machine from outside, like

I have a Fedora 10 machine as a dedicated server, in which I run Jboss and Tomcat server all the time , since there was a conflict between the port of these 2 servers (Both servers use the port 8080 for http), I had to change the port for one server . I decided that I will change the tomcat server port , because it is just a webserver and Jboss is an application server. So I change the server port of Tomcat from 8080 to 9090 (I changed the port in the tomcat server.xml file, This file reside in the folder $CATALINA_HOME\conf\ and restart the server). and I use 9090 for weapps and 8080 for applications .

The next issue that I faced was the issue with the accessing the port from a different machine using the machine IP or name. The http protocol was not able to access the port both 8080 and 9090 , it was blocked by the IP address.

Then I flushed out the iptables in Fedora (use command iptables -F as root), the issue solved, but that was not a permanent solution. You need to flush out iptables when ever you restart your machine. and also all the ports will be open for the outside world and which is not good . Later I found the solution. You have to edit the iptables settings.

open the file /etc/sysconfig/iptables, and add the following line

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9090 -j ACCEPT

Here 8080 is for Jboss and 9090 is for the Tomcat server and thus the issue is solved.

Monday, February 2, 2009

upgrading Fedora from previous version

When upgrading fedora from any previous version (not clean install). All the previous packages wont be erased. This might lead to a conflict between the packages while running other applications.

It can be done and it is easy to remove some older files. Use yum-complete-transaction utility from yum-utils or use "package-cleanup --cleandupes"

install yum-utils first

first charecter to upper case

public class Sample {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String abc = "hello";
abc = Character.toUpperCase(abc.charAt(0)) + abc.substring(1);
System.out.println(abc);

}
}

Friday, January 30, 2009

F10 Howto for the rpmfusion nvidia drivers

For GeForce 6, 7, 8, 9 & 200 series cards

Code:

su
rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

yum install kmod-nvidia xorg-x11-drv-nvidia-libs.i386 xorg-x11-drv-nvidia-libs.x86_64
reboot

Or (akmod builds the required kmod on bootup )

Code:

su
rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install akmod-nvidia xorg-x11-drv-nvidia-libs.i386 xorg-x11-drv-nvidia-libs.x86_64
reboot


For GeForce FX cards

Code:

su
rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install kmod-nvidia-173xx xorg-x11-drv-nvidia-173xx-libs.i386 xorg-x11-drv-nvidia-173xx-libs.x86_64
reboot

Or (akmod builds the required kmod on bootup )

Code:

su
rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install akmod-nvidia-173xx xorg-x11-drv-nvidia-173xx-libs.i386 xorg-x11-drv-nvidia-173xx-libs.x86_64
reboot


For GeForce 4 and below

Code:

su
rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install kmod-nvidia-96xx xorg-x11-drv-nvidia-96xx-libs
reboot

Or (akmod builds the required kmod on bootup )

Code:

su
rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://ftp-stud.hs-esslingen.de/pub/Mirrors/rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install akmod-nvidia-96xx xorg-x11-drv-nvidia-96xx-libs
reboot

Unsuported


RIVA TNT
RIVA TNT2/TNT2 Pro
RIVA TNT2 Ultra
Vanta/Vanta LT
RIVA TNT2 Model 64/Model 64 Pro
Aladdin TNT2
GeForce 256
GeForce DDR
Quadro
GeForce2 GTS/GeForce2 Pro
GeForce2 Ti
GeForce2 Ultra
Quadro2 Pro

Supported an Unsupported Nvidia cards


You may need to edit xorg.conf for compiz to work.

Code:

su
gedit /etc/X11/xorg.conf


and add

For 32 bit

Code:

Section "Files"
ModulePath "/usr/lib/xorg/modules/extensions/nvidia"
ModulePath "/usr/lib/xorg/modules/drivers"
ModulePath "/usr/lib/xorg/modules"
EndSection

For 64 bit


Code:

Section "Files"
ModulePath "/usr/lib64/xorg/modules/extensions/nvidia"
ModulePath "/usr/lib64/xorg/modules/drivers"
ModulePath "/usr/lib64/xorg/modules"
EndSection

Installing Flash Plugin for Firefox


Adobe


Create the file in the repository folder.

su -c 'rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm'

* When that has been installed edit the repo file to look like the following.

su -c 'gedit /etc/yum.repos.d/adobe-linux-i386.repo'

[adobe-linux-i386]
name=Adobe Systems Incorporated
baseurl=http://linuxdownload.adobe.com/linux/i386/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux


* Install the Flash Plugin


su -c 'yum install flash-plugin'
* If you don't hear audio during playback of flash video just install packet called libflashsupport


su -c 'yum install libflashsupport'


Installation without Adobe repository: Install Flash Player 10:



su -c 'rpm -ivh http://fpdownload.macromedia.com/get/flashplayer/current/flash-plugin-10.0.12.36-release.i386.rpm'


* 64bit Flash

Make sure to uninstall flash-plugin, libflashsupport and nspluginwrapper before you do these steps

wget http://download.macromedia.com/pub/l...6_64.so.tar.gz
tar xvzf libflashplayer-10.0.d20.7.linux-x86_64.so.tar.gz -C ~/usr/lib64/mozilla/plugins

restart Firefox

Tuesday, January 13, 2009

Virtual Box in Fedora & Ubuntu



Fedora is a Linux-based operating system that showcases the latest in free and open source software. It is a community of contributors from around the world who work with each other to advance the interests of the free culture movement.

The start of Fedora was with Fedora 1.0, this is the version that Red Hat has released after Red Hat 9. I was user of Red Hat Linux and then later moved on to Fedora. I have worked on Fedora 3, 5, 7, 9 and now 10. It is a great operating system. The main advantage that I see with Fedora from other Linux distribution is that, it can be used as a Server, a Desktop machine and also a learning computer for Newbie’s. I became more comfortable with Linux using Fedora only.


I am also using Ubuntu 8.10 Intrepid Ibex, this is first Ubuntu distribution that I am using, the advantage with Ubuntu is that, it is very user friendly; this is the best Operating system for those who just migrated from windows. Using Ubuntu, you don’t have to go to command prompt to do anything. And for any Newbie, who are more comfortable to work on the GUI more can choose Ubuntu.


VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. VirtualBox runs on Windows, Linux, Macintosh and Open Solaris hosts and supports a large number of guest operating systems including Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), Solaris and Open Solaris, and Open BSD.



I have used Virtual Box on Windows and also Linux Platforms, and also I heard it works really well on Mac and Solaris. As of now, I have installed Open Solaris, Kubuntu, Ubuntu, Xubuntu, Windows XP, Open Suse 11, Mandriva 2009, and Red Hat 9. All these works pretty well and also they give good performance.


The one thing that I have noticed about Virtual Box is that, since it gives a virtual Display Adapter it is not capable of running Compiz-fusion. Probably this is because the Virtual Box Adapter (emulator) is not capable of handling graphics acceleration. But other than that they are quit fine. And also if you are also considering some old Operating system also, it might be an issue. I installed Win 98 SE and Fedora Core 3 , on which the installation was successful but for FC 3 I was not able to get the UI , its dead , I am getting only a black screen. For Win 98 things are little, only issue with the drivers. In Windows 7 also the issue is with the driver, but we can still hope that in future VBox may come up with the fixes. But for FC3 and Win 98 I don’t think so .



The new version of VBox (2.1) provides good support for host network interface, and it is auto configured. Once you have installed your OS inside a virtual machine (it is called guest OS and the main OS is called Host OS for me here it is Fedora and Ubuntu), then you have to install the VBox guest addition. This is in order to configure your VBox display card, sound and network (basically all drivers). The network and IP is configured automatically you can also manually configure the IP address , but there you have to be careful of entering the gateway and DNS address, or else your network wont work correctly.



Shared drive is something that you can configure on your guest OS from a shared folder on your host OS. If the guest OS is Windows and you have already installed the guest additions then use the command net use x: \\VBoxsvr\Shared (where Shared is the name of the directory in the Host OS that is shared , this setting can be given from the VBox main window) to access the shared directory. And if the guess OS is Linux, it is just simple way of mounting your network drive (mount //VBoxsvr/Shared /mnt/Shared_drive -o username=username, password=password). You can also enable the USB support for the guest OS.




Monday, January 12, 2009

Creating Custom Tag Library

JSTL is JSP Tag Library. It is the ability to define our own custom JSP tags.We design how JSP tags, its attribute and its body are intrepeted. They are called custom Tags.Thus a collection of Custom tags are called tag library. These tags can be used in any number of JSP files.they are re-usable component.It is a way that you can customise the JSP by defining own tags.

There are 4 main component in defining JSTL.
1) JSP Page
2) Tag Handler
3) Tag library descriptor
4) web.xml server configuration file

Tag Handler
-----------
The Tag handler is a Java Class. This Java Class says how to translate code into tag. It implements the javax.servlet.jsp.tagext.Tag interface. This class file will be in the same directory as of servlets and Java Beans This is generally done by extending the TagSupport or the BodyTagSupport class.

import javax.servlet.jsp.tagext.*;
public class Example1 extends TagSupport{

or

public class Example1 extends javax.servlet.jsp.tagext.TagSupport{


Tag Library descriptor
----------------------
The Tag library descriptor is an XML file which describes the name, class and attributes of the Tag Handler. Thus the JSP file will identify the class to the server and associate it with a particular tag name. This file will be of the extention .tld .This file contains some fixed information, an arbitrary short name for your library, a short description, and a series of tag descriptions. The URI of this tld file will be described in the JSP file with a prefix.

The JSP File
------------
The JSP file will import the tag library referencing the URL of the descriptor file. This defines a prefix to the tld , with which the tld will be accessed. We need to define the taglib directive in the top part of the JSP file.This will be of the form

<%@ taglib uri "=WEB-INF/lib/Example1.tld" prefix="Example" %>

The uri can be absolute or relative refering to the taglibrary descriptor.

Web.xml
-------
This is the file where the we tell the JSP file that where is our tld file is. The is the configuration file for the application to run.


Saturday, January 3, 2009

Life of Freedom

This blog is completely on my experience on Linux and I am not there for an argument which Operating System is the best or good . Each of them has their own strengths and weakness. Here I would like to add some of experience with Linux that I found them as interesting .

I have worked on Windows , Linux and Macintosh machines. The use of mac was aaahhh .. 4 years ago , so I dont want to give a comment on that . I heard the new Lepord is good and has a good look and feel. Planning to get one for myself a mac machine , but not in near future.

I started my computer education on DOS and Windows 3.1 , with the black and white monitor in 1997. well for DOS the whether a color ot black and white no issues . does not make much difference. i was learning of the basics of that. Then slowly moved to Fortran , i dont even remember the syntax of it, but one thing that i remember is that, we should be putting margins on them. Then move on to windows 95 that was the time when i first saw the color monitor for computers. not much worked on Windows 95. Then moved into Windows 98 i find it cool with lot of Application , Office 97 , Games and utilities. Then i installed Mandrake Linux 8 with a dual boot . And i find that i can do the same thing which i can do in Windows . That was my first Linux Operating system .

Later i moved to Redhat linux , I have used starting from Red Hat 6 to Red Hat 9. it was so good. but since i didnt had an internet connection i was not able to use the full functionality. Later When Fedora launched ( developed by the community-supported Fedora Project and sponsored by Red Hat. ) From ther onwards i was using Fedora . From 1 to now the latest Fedora 10.

The main advantage that i saw in Linux is that , there is no issues like a VIrus , a Spyware or an adware. It is free . ( Here the term free means not only free of cost, but freedom to do what you want , like customising , compiling and installing software , to make the look you want and even to add a new feature on that ) .

The latest cool feature that i have used is the compiz-fusion, Compiz is one of the first compositing window managers for the X Window System that uses 3D graphics hardware to create fast compositing desktop effects for window management. The effects, such as a minimization effect and a cube workspace are implemented as loadable plugins. Because it conforms to the Inter-Client Communication Conventions Manual standard, Compiz can substitute for the default Metacity in GNOME or KWin in KDE

Compiz-fusion is a compositing window manager that uses 3D graphics acceleration via OpenGL. It is the result of a merge between the old Compiz community plugin set "Compiz Extras" and the parts of the Beryl project that are independent of the window manager core. Here are some screen shots of my Compiz on fedora 10.