Thursday, April 20, 2006

Installing Sun's Java on Debian

Why Sun's Java

There are many applications in Debian which need Java SDK or JRE to function properly , specifically Sun's java environment.Most of these applications are as expected web based applications , and unluckily Sun's java packages are not available directly for debian systems.

So what's the problem dude ?

Sun's java environment package for Linux is available in .bin format and not in .deb format.Whie there is nothing wrong with installing software outside the control of the Debian packaging system, it's not something that should be undertaken lightly as it makes it hard to keep track of installations, and it complicates updating a number of machines from a centralised Debian package repository.

So wats the fucking solution ?

Thankfully there are facilities available which make it a simple job to install Sun's Java as a Debian package.

Two packages we're going to need are java-package and fakeroot. These can be installed simply by typing the following in the terminal:

apt-get install fakeroot java-package

Once the relevent packages have been installed you will need to download the Sun release of the Java package from http://java.sun.com .

Once you agreed to the license presented to you, and have downloaded the file you will have something like jre-1_5_0_03-linux-i586.bin.

To turn this into a Debian package you should run:

fakeroot make-jpkg jre-1_5_0_03-linux-i586.bin
This command will first prompt for confirmation, then :
  • Ask you for your name
  • Ask you for your email address
  • Display a license agreement:
    • Press Space to scroll down, or q to quit.
    • Type "yes" to indicate you agree with the terms.

(The name, and email address, you give will be inserted into the Debian package information - and not sent to Sun.)

Once these questions have been answered the process will inform you that your package has been built shortly afterwards. The final output you should expect to see will look something like this:

The Debian package has been created in the current directory. You can
install the package as root (e.g. dpkg -i sun-j2re1.5_1.5.0+update03_i386.deb).

As the instructions tell you it is now possible for you to install the package by becoming root and running:

dpkg -i sun-j2re1.5_1.5.0+update03_i386.deb

One final step might be for you to ensure the Java software works for Mozilla Firefox, or the Mozilla browser.

The package you've installed should include a plugin for your browser. At the time of writing the most recent Sun Java version we've been using will install a plugin for you at the following location:

/usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so

Create a symlink to this directory in your home directory:

ln -s /usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so  ~/.mozilla/plugins/

If you wish to do this for all users on the current system instead run, as root:

ln -s /usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so \
/usr/lib/mozilla/plugins/

(You might find that the plugin has been automatically installed for all users - so it's worth checking whether you need to complete this last step yourself.)


PS
All the above information was gathered by me from the following website http://www.debian-administration.org

Wednesday, April 12, 2006

Restoring grub for debian

Many Debian newbies often have to reinstall f***ing Windows on the same machine where Debian is installed. Usually the Windows installation does not take care of the Debian booting process, overwriting the master boot record with Windows.There are several ways to recover the grub , but here I will mention the method used by me when I had the same problem.


All that you would need for this is a live CD of any debian based Linux distro like Ubuntu or Knoppix.Once u have a live CD with you just follow the next few steps.
  • Boot from the Live CD( I used Ubuntu CD)
  • Once you are logged in open the terminal.
  • Login as root (type sudo su in Ubuntu) and type cfdisk and check out what is your boot partition (eg. hda8)
  • Make a new directory to mount the boot partition, for example /disk.
  • In case you don't have seperate /boot partition then mount the root partition or / to /disk using the following command

    mount /dev/hda
    x /disk

    x refers to teh boot or root partition.
  • Do a chroot to the root partition by typing

    chroot /disk

  • Type grub and enter grub shell.
  • Type in the root disk for grub, for example

    root (hd0,7)

    This is /dev/hda8 on my system.
  • Type the following command to install grub on /dev/hda

    setup (hd0)

  • Type quit, exit from chroot, unmount all disks and reboot.