You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 64 Next »

For this project we are going to use KVM (Kernel-Based Virtual Machines), to work with Windows and Linux guest operating systems. The host operating system during the whole project will be Linux 10.04 (64bits).

Installation of KVM

(following this documentation: https://help.ubuntu.com/community/KVM/Installation )

  • First of all we should set the needed switches for the virtualization from BIOS.
  • Once we set them we are going to see if our processor really supports KVM. If the output from this command is 1 or more, it does :

          egrep -c '(vmx|svm)' /proc/cpuinfo

    In our case,he output is 2, so we can continue with the installation.
  • Now we are going to install the following packages:    
    • 'qemu-kvm' : the backend
    • 'libvirt-bin' : provides libvirtd which you need to administer qemu and kvm instances using libvirt
    • 'ubuntu-vm-builder' : powerful command line tool for building virtual machines
    • 'bridge utils' : provides a bridge from your network to the virtual machines
  • We should test if the installation it's been successful with the following command:

 virsh -c qemu:///system list

     If everything is correct we have to see this output:

Id Name State
----------------------------------

     But during the installation the output was :

   /var/run/libvirt/libvirt-sock : Permission denied
   failed to connect to the hypervisor

     So trying to find out the problem I restart the computer and this problem was solved, but the  computer lost the eth0 Internet connection.

     The problem was that the virtual connection (virbr0) created for the virtual machines, disable the eth0 connection. So I bring up the Ethernet interface with the following command :

ifconfig eth0 10.80.86.1 netmask 255.255.255.0 up

    After that, I restart the computer and everything works ok.

Create Virtual Machines

To create the vm's with the different guest operating systems, we are going to install 'virt-manager'.

With Virtual Machine Manager ( http://virt-manager.et.redhat.com) we can create and administrate our KVM just following the steps of the application. It's a graphical way to create the vm's instead do it with commands in the terminal. But we can install a vm with the command virt-install with the parameters we want.

To create them we have to do it from localhost (QEMU) not from localhost (QEMU Usermode)

The steps to create the Virtual Machine are:

  1. Click on the button “Create a new virtual machine”
  2. We have to enter a name for the vm and choose the way we want to install the operating system
  3. Then we choose the operating system type and version
  4. Choose memory (RAM) and CPU settings
  5. Create a disk image in the computer hard disk.

The virtual machine is going to be saved in the path: /var/lib/libvirt/image

In this project we are going to develop two vm's, one with Windows as guest operating system, and the other one with Linux.

Now we are going to explain the setting of the differents vm's.

   VM1 ( Windows XP pro SP2 x86 )
  • Memory RAM : 512 MB
  • CPU's : 1
  • Storage : 8 GB
   VM2 ( Linux Ubuntu 10.04 32bit )
  • Memory RAM : 512 MB
  • CPU's : 1
  • Storage : 8 GB

Once we have create the vm's, we checked if the virtual conection works and if there was any problem of usability, but in both vm's everything was ok.

USB devices in guest OS

It's important to know that the USB device must be plugged in before KVM starts.

To use USB devices we have to make some changes in the .xml file of our vm.
First of all we need to know the usb Vendor ID and Product ID. Using this command we'll find it:

sudo lsusb

The output will be:

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
Bus 004 Device 002: ID 04d9:1603 Holtek Semiconductor, Inc.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 058f:6387 Alcor Micro Corp. Transcend JetFlash Flash Drive
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In our case the Vendor ID and Product ID of the USB we want to add to the guest OS is :

  • Vendor ID: 058f
  • Product ID: 6387

Now we have to enter it into the .xml file using this command:

sudo gedit /etc/libvirt/qemu/VM1.xml

Add this code:

   <devices>
    <emulator>/usr/bin/kvm</emulator>
    <hostdev mode='subsystem' type='usb'>
    <source>
    <vendor id='0x058f' />
    <product id='0x6387' />
    </source>
    </hostdev>
    <disk type='file' device='disk'>

Save and close the file and then restart.
If we want to add the USB device to VM2, we just have to enter in the terminal:

sudo gedit /etc/libvirt/qemu/VM2.xml

And add the same code to the file.

FTP

We are going to test FTP service between guest operating systems we had installed in the virtual machines.
FTP is a protocol used to copy file from one host to another. In FTP we use port 20 for data and port 21 for commands

We need a server that will make the files available for others and we are going to have clients that will connect to the server and they will upload or download files.

In this project the server is going to be in Linux O.S. And the client will be Windows O.S.

First of all we are going to install a basic configuration of a FTP server on Ubuntu 10.04.

Just following these steps should be easy to setup the configuration.

  1. Install the package vsftpd
  2. The configuration of the FTP server is in vsftpd.conf, that it's located in /etc/vsftpd.conf

    To make any change to the settings, we can do it with the following command.

           sudo gedit/etc/vsftpd.conf

     To let the clients upload files to the server we should change
             #write_enable = YES to write_enable = YES
      3.  Everytime we make any change we have to restart the vsftpd, in order to make the changes      effective.

After that we had installed a server in Linux with the local Ubuntu system account.

The FTP client in is going to be on Windows O.S. As a FTP client we can access to the server to upload and download files (note that we can upload files because we change the default setting in the vsftpd.conf)
To access to the server we have two ways:

  1. With the Windows console
  2. With a cross-platform FTP client, for example Filezilla
With the console

In the client console we have to open a FTP session with the IP address of the server.
Then we have to log in with the system account and with the FTP commands we can upload files to the server and download files directly to our directory from the server.

With Filezilla

With this platform we can manage in an easier way the transfer of files. We have to enter the host name or IP address.
We click “Quickconnect” and in the panel below will appear the local site and the remote site.
To manage the files we click on the right bottom of the mouse and it will appear all the options we have.

Samba

Server (Linux 10.04)

To share files between the guest OS we have to set the server and the client. The server will be the Linux guest OS. The steps to set the server are:

  • Some software packages are needed so we have to install them with the following command:

sudo apt-get install samba smbfs

  • Once we’ve got samba installed, we’ll need to edit  the configuration file, running the following command:

sudo gedit /etc/samba/smb.conf

  • We are going to make some changes in smb.conf for the configuration of the server:

         In the [ global ] section we have to put the name of our workgroup or domain and uncomment the security parameter:

 workgroup = HOME
           .
           .
           .
 security = user

    Now we can create a new section or uncomment one for the directory to be shared:

[share]

comment = Ubuntu File Server Share
path = /srv/samba/share
browsable = yes
guest ok = yes
read only = no
create mask = 0755

  The main parameters of each section are:

  • comment: a short description
  • path: the path to the directory to share.
  • browsable: enables Windows clients to browse the shared directory using Windows Explorer
  • guest ok: allows clients to connect to the share without supplying a password. 
  • read only: determines if the share is read only or if write privileges are granted.
  • create mask: determines the permissions new files will have when created.

After these changes in smb.conf we have to restart the samba services to enable the new configuration:

sudo /etc/init.d/samba restart

Client (Windows XP)

To set up the Samba client in Windows I follow these steps:

  1. Click Start -> Control Panel
  2. Click the "Network and Internet Connections" option
  3. Then click the "Network Connections" option
  4. Double click the icon labelled "Local Area Connection". The icon may have a number after it, for example "Local Area Connection 5"
  5. Click the Properties button
  6. Select "Internet Protocol (TCP/IP)" and click Properties
  7. Click Advanced
  8. On the WINS tab, click Add, then enter 192.168.122.130 (the address of the server) and click Add.
  9. OK and close

To join the domain of the server :

  1. Click Start -> Control Panel
  2. Click the "Performance and Maintenance" option, then click on System
  3. Click on "Change" button. The computer name should be set to the hostname "koneauto". The domain should be set to "HOME"

The problem is that when I click OK the message is "A domain controller for the domain HOME cannot be contacted" . After several trials trying different configurations in smb.conf it doesn't work.

The "How to" I was using to setup the server and the client was:

https://help.ubuntu.com/10.04/serverguide/C/samba-fileserver.html

RTAI

To install the RTAI I was following this documentation :https://www.rtai.org/RTAILAB/RTAI-TARGET-HOWTO.txt

We will try to install RTAI in the host OS Linux 10.04 (64bits). We download the latest version from  www.rtai.org that is RTAI 3.8. We'll run the following command:

wget --no-check-certificate https://www.rtai.org/RTAI/rtai-3.8.tar.bz2

We are going to switch the directory and unpack

cd /usr/src

 tar xvf rtai-3.5.tar.bz2

We have to download a new kernel from http://www.kernel.org/ we can use the kernel we have in the distribution.

The first three numbers in the kernel have to match the
first three numbers in the patch.
So we downloaded 2.6.23.1 kernel and we will use the 2.6.23 patch

Now we will aply the RTAI patch:

cd /usr/src/linux-2.6.23.1

patch -p1 -b < ../rtai-3.8/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch

Then we make a copy of the  configuration file to the root folder.
 

cp /boot/config-2.6.19-generic .config

Lets finally run the kernel configuration menu

 make menuconfig CC=/usr/bin/gcc-3.4 CXX=/usr/bin/g++-3.4

Set the "prompt for development and/or
incomplete code/drivers" option to 'yes'. In the "loadable module support" section,
make sure that the "Enable loadable module support" is set to 'yes', and set the
"Module Versioning support" is to 'no'. In the "processor type and features" section,
set the "Preemptible kernel" and the "Use register arguments" options to 'no',
and make sure to set the "interrupt pipeline" option, (aka IPIPE) to 'yes'.
Finally, make sure that the "/proc file system support", under the
"Pseudo filesystems" subsection of the "File systems" section is set to yes.

With this new configuration, the kernel has to compile with the following command:

apt-get install kernel-package fakeroot

make-kpkg clean

fakeroot make-kpkg --initrd --app\end-to-version=-rtai \kernel_image kernel_headers

Finally I couldn't compile the kernel and I try  other types of configuration but it wasn't succeeded.

  • No labels
You must log in to comment.