Wednesday, May 24, 2006

Installing Windows XP virtual Machine


In the previous post we discussed how we can install and configure VMware-workstation on a Fedora Core 5 machine. Now in this post I am going to discuss with you how to install a Windows XP virtual machine inside the VMware-workstation we installed in the previous post.

From inside the VMware Application Select File->New->Virtual Machine.
A "New Virtual Machine Wizard" gets opened up, inside the wizard you are asked various questions you need to follow these simple steps in-order to install a simple Windows XP Professional Virtual Machine.

Step 1) Just Press Next

Step 2) Virtual Machine Configuration -> Select Custom and Press Next

Step 3) New Virtual Machine Format -> Select New-Workstation 5

Step 4) Guest Operating System -> Select (1) Microsoft Windows and inside Version Select Windows XP Professional

Step 5) Select a Name for your virtual machine you want and the path you want to save that virtual machine to.

NOTE: Whichever path you give mind you that it should be having at-least 4GB free space of HardDisk.

Step 6) Number of Processors: One

Step 7) Memory Size : It depends on how much RAM do you have, as I have only 256 MB RAM I give 128 MB range if you have 512 MB RAM I recommend you go for 256 MB RAM size here. Just slide the slider towards left or right to change the memory size.

Step 8) Network Type: If you have a broadband connection and you want that connection to be accessed inside windows virtual machine select "Bridge Networking" , if you want to only communicate with the Fedora Core 5 host machine select "Host Only Networking" and if you don't want any network connection select "No Network Connection".

Step 9) SCSI Adapter: Select BusLogic and Press Next (LSI logic seems to have problem with windows XP drivers set).

Step 10) Disk: Select "Create New Virtual Disk" and Press Next

Step 11) Virtual Disk Type: IDE (Recommended) Select this and Press Next

Step 12) Disk Size: I gave a 4GB space for my Windows XP virtual Machine here and selected "split disk into 2 GB files". It depends on your needs. If you want to allocate more disk space you can give more space.

NOTE: The option "Allocate all disk space now" option will allocate all the said disk space during that time and in that case you should have the specified disk space where your virtual machine is going to be saved.

Step 13) Disk file Name: Choose the name and the location. I prefered the default one and Press Next.

After these steps the wizard finishes up the new virtual machine gets created and it's time to boot up into the new virtual machine.

Now it's time to install Windows XP Professional:

Step 1) So just put inside the Windows XP Setup CD inside the CD-Drive and "Power On" the virtual machine.

Step 2) During the boot up click inside the "Black Screen" (to come out of the screen press Ctrl+Alt) and press "Esc" key to get inside the "BIOS setup". Here select the First Boot Option as CD-ROM, save the setting and exit.

Step 3) After the windows XP installation starts and everything goes as it goes when you install Windows XP.

Step 4) Just during the partition time you will be shown a Single Parition as Free Space. Create a FAT/NTFS partition of that and install windows XP on that parition.


Voila ! You now have a Fedora Core 5 Machine inside which you have a running Windows XP.

Here I am posting a Screenshot I took when I was installing Windows XP inside my Fedora Core 5 (using vmware).

VMware Installation , Configuration on Fedora Core 5

In this post , I am going to share my experiences with you all , of how was I able to install VMware 5.5.1 on Linux (Fedora Core 5) and configure it and finally install windows XP through it.
So following the step-by-step procedure we start up right away(follow all the below steps by login via root user only):

Step 1) Vmware needs that the kernel and it's appropriate sources are installed properly on your system. I recommend you to install the latest kernel for Fedora core 5. You can do this by issuing the following simple commands (note that you need to be connected to internet as a root user in order for these commands to run successfully):
a) yum install kernel
b) yum install kernel-devel
This will install the latest kernel and it's source code. The version I have is 2.6.16-1.2080_FC5. After you do this step you need to reboot and boot into the newly installed kernel.

Step 2) We need the VMware Software for Fedora Core 5. For this we can go here and follow the steps described there. Download the RPM file for VMware 5.5.1-19175 version.

Step 3) As the above software is a shareware version you get a key for the first 30 days trial on the e-mail provided by you during registration on the link provided in step (2), note down the key and save it somewhere in a text file we will need it after installation and configuration finishes up.

Step 4) Now as VMware 5.5.1 has reported some problem during the configuration in Fedora Core 5 we will need to download this specially created perl script from here.

Step 5) Install VMware from the rpm by issuing the following command:

rpm -ivh VMware-workstation-5.5.1-19175.i386.rpm

Step 6) After installing the above rpm we need to extract the script downloaded in step (4) and follow these steps:

a) gzip -d vmware-any-any-update101.tar.gz
b) tar -xf vmware-any-any-update101.tar
c) cd vmware-any-any-update101
d) ./runme.pl

Step 6) After you run the runme perl script it will ask you many things. These should be your answers:

Question 1) Before running VMware for the first time after update, you need to configure it for your running kernel by invoking the following command:
"/usr/bin/vmware-config.pl". Do you want this script to invoke the command for
you now? [yes]

Answer 1) Press Enter

Then Read the License Agreement (press Space Bar 7-8 times) and in the end type yes and press Enter.

Question 2) In which directory do you want to install the mime type icons?
[/usr/share/icons]

Answer 2) Press Enter

Question 3) What directory contains your desktop menu entry files? These files have a
.desktop file extension. [/usr/share/applications]

Answer 3) Press Enter

Question 4) In which directory do you want to install the application's icon?
[/usr/share/pixmaps]

Answer 4) Press Enter

Question 5) None of the pre-built vmmon modules for VMware Workstation is suitable for your running kernel. Do you want this program to try to build the vmmon module for your system (you need to have a C compiler installed on your system)? [yes]

Answer 5) Press Enter

Question 6) What is the location of the directory of C header files that match your running kernel? [/lib/modules/2.6.16-1.2080_FC5/build/include]

Answer 6) Yes (note your directory listing may differ with the given here !)

Question 7) Do you want networking for your virtual machines? (yes/no/help) [yes]

Answer 7) Press Enter (if you don't want networking type no and press enter). If you need to run internet from your virtual machine in future and you happen to use a broadband connection please select yes and press enter.

Question 8) Do you want to be able to use NAT networking in your virtual machines? (yes/no) [yes]

Answer 8) This depends. For my setting I typed no and Pressed Enter.

Question 9) Do you want to be able to use host-only networking in your virtual machines?[no]

Answer 9) Answer it yes or no if you want/don't want to communicate with your Fedora Core 5 host machine inside the virtual machine you install later. I choosed no.

Step 7) After these simple questions and configuration of VMware-5.5.1 finishes off and now we can run the vmware software by issuing the following command at command line:

vmware

Step 8) Once the software starts up goto Help->Enter Serial Number ... and paste the serial number you got via email during step (3).

And voila! VMware is now installed and configured on your fedora core 5 machine.
In the next post I am going to explain you how did I configured the Windows XP Professional Virtual Machine inside VMware and that too through the step by step guide. So for the time being just play around with the above guide and try your hands with the different options giving in the software.

Happy Linux'ing !!

Saturday, April 22, 2006

BSNL Broadband configuration Linux

I was seeing constant threads at orkut regarding configuration of internet on linux. This guide I hope will help you establish the BSNL broadband connection on your linux box. I assume that you have configured your network interface (if not then I am going to post a similar post regarding howto configure it).

This document is a copy of a document which I saw in late 2004 when I was searching for a howto to configure internet in linux.

This document describes howto setup bsnl broadband service on your gnu/linux server/desktop. It assumes that you are neither linux beginer nor an expert. It assumes that you are aware of basic gnu/linux commands.

I have installed it on redhat 9. I dont find any reason why it would not work on following distributions:

  • FC1
  • FC2
  • FC3
  • FC4
  • FC5
An unofficial FAQ on Dataone can be found here

Pre-Requisites

  • Please ensure that you have connected a working ethernet card which is supported on gnu/linux. Test the ethernet card & ensure that it is working.
  • Root access to a gnu/linux box

Before we start, please ensure that you have the following details on hand:

  • BSNL Broadband connection -:)
  • Username & Password

Using the builtin dialer

A HOWTO with instructions on using the PPPoE builtin dialer of the Huawei SmartAX MT800 ADSL router is available.
The procedure to configure the dialer in UTStarCom UT300R modem is given here

Using RP-PPPOE as dialer

Installation


  • As BSNL broadband is using rp-pppoe (Roaring Penguin - Point to Point Over Ethernet), we would be required to download & install this package. This package is normally available on most of the distributions. But, if you are using redhat7.3, please download the following packages:

If you are downloading the tar.gz version, you have to build the rpm first. So, please walk through the following procedure to build the rpm:

Procedure to build RPM from tar.gz.


 1. Login as root
2. Download tar.gz version & execute the following commands
# tar -zxvf rp-pppoe-3.5.tar.gz (untar this package)
* This command would untar the package in the current directory.
# cp rp-pppoe-3.5.tar.gz /usr/src/redhat/SOURCES/
# cd rp-pppoe-3.5
* The rpm spec file, rp-pppoe.spec is available in this directory.
# cp rp-pppoe.spec /usr/src/redhat/SPECS/
# cd /usr/src/redhat/SPECS
# rpm -ba rp-pppoe.spec
* The above command would untar the tar.gz package in ../BUILD
directory, compile the package and finally it would create neces
sary rpms in

If everything goes fine, you would see the following or similar message:

 Wrote: /usr/src/redhat/SRPMS/rp-pppoe-3.5-1.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/rp-pppoe-3.5-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/rp-pppoe-gui-3.5-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.97349
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd rp-pppoe-3.5
+ rm -rf /tmp/pppoe-build
+ exit 0

If this is the case, the necessary rpms are successfully created and they are available in appropriate directory.

 Source RPMS - /usr/src/redhat/SRPMS/rp-pppoe-3.5-1.src.rpm
Binary RPMS - /usr/src/redhat/RPMS/i386/rp-pppoe-3.5-1.i386.rpm
GUI RPMS - /usr/src/redhat/RPMS/i386/rp-pppoe-gui-3.5-1.i386.rpm

Now, at this stage you are having necessary rpms with you. Either you have downloaded them from the above website. Or you would have built them on your own:

Command Line Version

 # rpm -vih rp-pppoe-3.5-1.i386.rpm

It would install the command line version of rp-pppoe package.

GUI Version

 # rpm -vih rp-pppoe-gui-3.5-1.i386.rpm

It would install the gui version of rp-pppoe package. If you have successfully installed, then you can proceed to next section.

Configuration

Once you have installed rp-pppoe package, all necessary commands would have been installed.

 adsl-setup  - to configure the connection parameters
adsl-start - to start the connection
adsl-status - to check status of the connection
adsl-stop - to stop the connection

Now, we are ready to configure the BSNL broadband internet connection.

Here you have to configure the following parameters:

 * userid
* network interface (eth0 or ..)
* Demand value (normally you can leave it blank)
* DNS Information (primary & secondary)
  • With regard to primary & secondary dns, You can leave it blank, as it would be taken care automatically. If you wish to know the dns details, just complete this wizard and when you run adsl-start, do:
 # tail -f /var/log/messages


Mar 15 15:29:48 Gateway pppd[3564]: Remote message: Authentication success,Welcome!
Mar 15 15:29:48 Gateway pppd[3564]: local IP address 59.92.9.154
Mar 15 15:29:48 Gateway pppd[3564]: remote IP address 59.92.8.1
Mar 15 15:29:48 Gateway pppd[3564]: primary DNS address 61.1.96.69
Mar 15 15:29:48 Gateway pppd[3564]: secondary DNS address 61.1.96.71

There it goes! The primary & secondary dns details are found and it would be automatically updated in /etc/resolv.conf.

  • Then you should enter the following details:
 * Password
* Firewall (set is to 2, MASQUERADE)
* Confirm
  • The following is the screen shot of adsl-setup command.
 # adsl-setup
Welcome to the Roaring Penguin ADSL client setup. First, I will run
some checks on your system to make sure the PPPoE client is installed
properly...

Looks good! Now, please enter some information:

USER NAME

>>> Enter your PPPoE user name (default test@dataone):

INTERFACE

>>> Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethn, where 'n' is a number.
(default eth0):

Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
>>> Enter the demand value (default no):

DNS

Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
>>> Enter the DNS information here: 61.1.128.5
Please enter the IP address of your ISP's secondary DNS server.
If you just press enter, I will assume there is only one DNS server.
>>> Enter the secondary DNS server address here: 61.0.0.5

PASSWORD

>>> Please enter your PPPoE password:
>>> Please re-enter your PPPoE password:

FIREWALLING

Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.

The firewall choices are:
0 - NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
>>> Choose a type of firewall (0-2): 2

** Summary of what you entered **

Ethernet Interface: eth0
User name: test@dataone
Activate-on-demand: No
Primary DNS: 61.1.128.5
Secondary DNS: 61.0.0.5
Firewalling: MASQUERADE

>>> Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/resolv.conf
(But first backing it up to /etc/resolv.conf-bak)
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
(But first backing it up to /etc/ppp/pap-secrets-bak)
(But first backing it up to /etc/ppp/chap-secrets-bak)



Congratulations, it should be all set up!

Type 'adsl-start' to bring up your ADSL link and 'adsl-stop' to bring
it down. Type 'adsl-status' to see the link status.


Internet Connection

Now, if you see this Congrats! message, then you are all set & done. You can type,

# adsl-start ..Connected! #

Thats it. The bsnl broadband setup has been installed & configured.

At this point, you can go through the man pages of appropriate adsl-* commands for details.

Hope this article helps you out in configuring internet on linux specially for the redhat persons. I will soon post a article regarding configuring network interfaces on linux and other stuff related to it.

Wednesday, April 19, 2006

Stepper motor driver GNU/Linux 2.6 kernel

I started a work on some project related to Stepper Motor Driver in Linux. I found one tutorial at linux gazette online magazine. But to my surprise the driver written was for 2.4.x kernel's. I soon realised that I need to do pretty much stuff in order to make that driver work in 2.6.x kernel. Then again to my surprise I found a excellent tutorial at tldp explaining the 2.6.x and 2.4.x kernel module programming. I went through those tutorials and I ported the driver for 2.6.x kernel.
I used a debian 3.1 sarge with 2.6.8 kernel in it. I started off with some basic differences (between 2.4.x and 2.6.x). Code writing convention has change alot and these days module programmer prefer to use macro's more than anything. They even have macros for defining the init function and the exit function. I went on to learn those things and finally came up with a code which I suppose will work in most of the 2.6.x's series.
Here I present the code:

#include "linux/kernel.h"
#include "linux/fs.h"
#include "linux/module.h"
#include "linux/init.h"
#include "asm/io.h"
#include "asm/uaccess.h"

#define LPT_BASE 0x378
#define DEVICE_NAME "Stepper"
#define DRIVER_DESC "*Stepper Motor Driver*"

static int Major;
static int Device_Open=0;
static int i,j,k=0;
static int pattern[2][4][8] = {
{{0xA,0x9,0x5,0x6,0xA,0x9,0x5,0x6},{0xA,0x8,0x9,0x1,0x5,0x4,0x6,0x2}},
{{0x6,0x5,0x9,0xA,0x6,0x5,0x9,0xA},{0x2,0x6,0x4,0x5,0x1,0x9,0x8,0xA}}
};

void step(void)
{
if(k<8)
{
printk(KERN_INFO "%d\n",pattern[i][j][k]);
outb(pattern[i][j][k],LPT_BASE);
k++;
}
else
{
k=0;
printk(KERN_INFO "%d\n",pattern[i][j][k]);
outb(pattern[i][j][k],LPT_BASE);
k++;
}
}
static int stepper_open(struct inode *inode, struct file *file)
{
printk(KERN_INFO "Stepper Opened\n");
if(Device_Open)
return -EBUSY;
Device_Open++;
try_module_get(THIS_MODULE);
return 0;
}
static int stepper_release(struct inode *inode, struct file *file)
{
printk(KERN_INFO "Stepper Released\n");
Device_Open --;
module_put(THIS_MODULE);
return 0;
}
static ssize_t stepper_write(struct file *file, const char *buffer, size_t len, loff_t *off)
{
char data;
get_user(data,buffer);
switch (data)
{
case 'h': /* Half Step */
printk(KERN_INFO "Half-Step mode initialized\n");
j=0;
break;
case 'f': /* Full Step */
printk(KERN_INFO "Full-Step mode initialized\n");
j=1;
break;
case 'F': /* Forward */
i=0;
step();
break;
case 'R': /* Reverse */
i=1;
step();
break;
default: /* Invalid */
printk(KERN_INFO "Invalid argument\n");
break;
}
return -EINVAL;
}
struct file_operations fops = {
.write=stepper_write,
.open=stepper_open,
.release=stepper_release
};
static int __init entry(void)
{
Major=register_chrdev(0,DEVICE_NAME,&fops);
if(Major < 0)
{
printk(KERN_INFO "Cannot get major number for the device %s\n",DEVICE_NAME);
return Major;
}
printk(KERN_INFO "'mknod /dev/%s c %d 0'\n",DEVICE_NAME,Major);
return 0;
}
static void __exit bye(void)
{
int ret = unregister_chrdev(Major, DEVICE_NAME);
if (ret < 0)
printk(KERN_INFO "Error in un-registering stepper: %d\n", ret);
else
printk(KERN_INFO "Stepper un-registered.\n");
}
module_init(entry);
module_exit(bye);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_SUPPORTED_DEVICE(DEVICE_NAME);

The messages logged by this driver can be found in /var/log/messages file. Anytime we need to see what the program does or what it outputs we need to open the file and go down the file to see the recent outputs. This can be made easy by issuing the following command:

tail -f /var/log/messages

As a super user now we need to execute the below command on the terminal. Here the major number is the number allocated by the kernel when the module get's inserted into it. It's a dynamic number. Minor number is mostly 0 (in this case).
In my case I had to execute the following command:

mknod /dev/Stepper c 254 0

This create's a device file in the /dev directory and now if we want to communicate to the motor all we need to do is write data onto this file. That can be done by simply using:

echo "h" > /dev/Stepper
echo "F" > /dev/Stepper
(NOTE: What's happening when these commands execute can be see by tail -f /var/log/messages)

Here data to the stepper device is any valid character in the set {h,f,F,R}. First two elements of the set intializes the motor in half-step or full-step mode and the last two data set actually runs the motor in Forward or Reverse directions.

In the next article I will explain the user interface program I created to handle this motor. I used the power of GTK+ in creating that interface.

Note:
There maybe many points I have left in this article regarding the internal working of the program. For that I assume you have gone through the page .

Monday, November 14, 2005

How tough is the RHCE exam ?

Toughness of a certification exam can be judged out through many parameters. But important among them is the course content, type of examination (practical or theory) and also the industry value of the certificate.

As I am currently studying RHCE I created this blog to get the views of students/sysadmin taking the RHCE exam or who had given the exam earlier. What are your views about the exam and it's toughness for a newbie to Linux operating system.

Please let your view been expressed and communicate them with other RHCE aspirants.

Thanks