Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Tuesday, 13 March 2012

How to build and install Vodafone Mobile Broadband / Wader in Ubuntu Lucid 10.4 LTS

WHAT IS THIS VMB / WADER THING?


Vodafone Mobile Broadband (VMB) is a 3G manager GUI software sponsored by Vodafone company.

Wader is a 3G manager daemon which deals directly with your mobile device.

VMB communicates with Wader via dbus.

Currently VMB/Wader supports "wvdial" and "Network Manager" backends.

Both VMB and Wader are written in python.

We are going to build and install them in a Ubuntu Lucid (10.4 LTS) system.


DOWNLOAD THE SOURCE CODE


VMB and Wader are not part of Ubuntu Lucid official repository, so we are going to build them from their sources.

First we need to install git to clone VMB and Wader repositories:

$ sudo aptitude install git-core
$ git clone https://github.com/andrewbird/wader
$ git clone https://github.com/andrewbird/vodafone-mobile-broadband


INSTALLING BUILDING DEPENDENCIES

Sunday, 11 October 2009

How to Compile the Linux Kernel in GNU/Debian and Ubuntu

NOTE: Tested in GNU/Debian Sid. Ubuntu versions should also work.


OBTAIN KERNEL SOURCE CODE:

Obviously the first step is obtaining the source code.

It is recommended to place and build linux kernel source code in /usr/src directory, although it is not required.

We create our "Linux_Kernel_Source" directory for this task.
$mkdir Linux_Kernel_Source
$cd Linux_Kernel_Source


Linux kernel source code is freely available in Internet:
http://www.kernel.org
specifically, version 2.6:
http://www.kernel.org/pub/linux/kernel/v2.6

We download and uncompress latest source code (2.6.31 when this article was written):
#aptitude install wget bzip2 # packages needed to get the kernel source code and uncompress it.
$wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2

Uncompress the source:
$tar xvjf linux-2.6.31.tar.bz2

/usr/src/linux is a symlink to linux sources or at least linux kernel headers. It is required.
#ln -s linux-2.6.31 /usr/src/linux

$cd linux-2.6.31


KERNEL CONFIGURATION:

Sunday, 4 October 2009

Installing Mediawiki using SQLite Database in GNU/Debian

NOTE: These article commands have been tested in GNU/Debian Sid. They should also work in Ubuntu flavours.

First we need to install php, apache and SQLite if they are not installed. This command will do the trick:
#apt-get install php5-sqlite

Following mediawiki recommendation we add some extensions to php for SQLite to work:
Edit /etc/php5/apache2/php.ini
Add these two lines in that file:

extension=php_pdo_sqlite.so
extension=php_pdo.so


To solve servername warning when launching apache daemon:
#echo "ServerName localhost" >> /etc/apache2/httpd.conf

We start apache web server:
#apache2ctl start


DOWNLOAD MEDIAWIKI SOURCE CODE


#cd /var/www

We get latest mediawiki source code tarball (current one when writting this article is 1.15.1):
#wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz

Uncompress it:
#tar xvfz mediawiki-1.15.1.tar.gz
#cd mediawiki-1.15.1
#ln -s mediawiki-1.15.1 mediawiki

We set writting permissions to config directory so we will be able to configure our wiki:
#chmod a+w config


CONFIGURING THE WIKI

Sunday, 21 September 2008

Installing GNU/Debian Sid in Ubuntu Hardy using debootstrap and chroot

This article explains how to install GNU/Debian Sid in a previously installed Ubuntu Hardy System. We will use debootstrap and chroot tools to accomplish that. This how-to is not focused on security, it does not tell how to create a restricted chroot environment to improve security.

Ubuntu is a GNU/Debian based distro. Every six months they take GNU/Debian Unstable packages and make a new Ubuntu distribution.
Debian Sid provides more and newer packages. Ubuntu is configured for easiness. Debian has less preconfiguration instead.

chroot runs a command with a special root directory.
chroot comes as part of coreutils package.
$ sudo aptitude install coreutils

debootstrap command bootstraps a basic Debian system (it can also bootstrap other systems).
$ sudo aptitude install debootstrap

$ ls /usr/share/debootstrap/scripts/ #shows which distros and versions you can install with debootstrap:

breezy  edgy  etch-m68k  gutsy  hoary  lenny  sarge  sarge.fakechroot  warty  woody 
dapper  etch  feisty  hardy  hoary.buildd  potato  sarge.buildd  sid warty.buildd  woody.buildd


INSTALLATION BEGINNING

First of all we create the directory where Debian Sid will be installed.
$ mkdir DebianSid


CREATING A LOOPBACK IMAGE TO STORE DEBIAN SID

This step is only necessary if you plan to boot your system from your Debian Sid chroot environment.

$ sudo dd if=/dev/zero of=DebianSidFile bs=1048576 count=10000 #We create DebianSidFile with 10 gigabyte capacity.

$ sudo mkfs.ext3 -b 4096 -L DSid DebianSidFile #Ext3 filesystem creation.

$ sudo mount DebianSidFile DebianSid -t ext3 -o loop #mounting it on DebianSid directory.


INSTALLING A MINIMAL SYSTEM

Friday, 15 August 2008

Downloading, Compiling and Installing MPlayer on a Ubuntu System

We are going to download MPlayer sources and binary codecs, configure, compile and install them on our Ubuntu system.

I do not want a graphical interface, so I will compile MPlayer without it.


DOWNLOADING MPLAYER SOURCES


We first download the sources: (I pick up the latest source version, if it does not work pick up latest stable one)

(I choose to download it from a German mirror: MPlayer source download page)
$wget http://www7.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2


DOWNLOADING BINARY CODECS


MPlayer binary codecs download page

As I have a Linux x86 platform ,I choose its corresponding package:
$wget http://www7.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2

This page shows an updated list of supported codecs: Codec Status page


In order to install the binary codecs

We create the directory where we will place the codecs:
$sudo mkdir /usr/local/lib/codecs

We untar the codecs and then move them into their place:
$tar xvfj essential-20071007.tar.bz2
$cd essential-20071007/
$sudo cp * /usr/local/lib/codecs


CONFIGURING OSD FONTS

Sunday, 27 April 2008

Backing and Restoring Mediawiki in Ubuntu

We are going to learn how to back up and restore our Mediawiki installed on a Ubuntu system.

To acomplish that we will execute some wiki maintenance commands.
These maintenance commands will be accesible after configuring AdminSettings.php file.

CONFIGURING AdminSettings.php FILE


AdminSettings.sample from the Mediawiki examples documentation will serve us as a model file to start.

We copy it into mediawiki configuration directory in /etc and assign the correct owner and permissions.
$sudo cp /usr/share/doc/mediawiki1.10/examples/AdminSettings.sample /etc/mediawiki1.10/AdminSettings.php
$sudo chown root:root /etc/mediawiki1.10/AdminSettings.php
$sudo chmod 600 /etc/mediawiki1.10/AdminSettings.php



Now we are going to edit AdminSettings.php file
$gksudo gedit /etc/mediawiki1.10/AdminSettings.php

Change these two variables using the parameters you used when creating the wiki database: e.g: wikiuser and its password.
$wgDBadminuser = 'DB user name'
$wgDBadminpassword = 'DB password'

Now that AdminSettings.php file is properly configured we are gonna back up and restore the wiki.


BACKING UP THE WIKI


dumpBackup.php command will back up our wiki:
$cd /var/lib/mediawiki1.10/maintenance
$sudo php dumpBackup.php --current > ~/foo_backup.xml

NOTE: --full option backups history of pages, not only last version as --current does.


RESTORING THE WIKI

Wednesday, 26 March 2008

Reverse Engineering Python Code with PyNSource

PyNSource is a tool that allow us to obtain UML diagrams from python source code.

PyNSource Web Page


INSTALLING PyNSource ON AN UBUNTU GUTSY SYSTEM.

NOTE: You must have python already installed in your system. I assume 2.5 version.

$mkdir PyNSource
$cd PyNSource


Now we download the program and install it:
$wget http://www.atug.com/downloads/pynsource1.4c.zip
$unzip pynsource1.4c.zip
$sudo python setup.py install


We want to run the GUI so we need a graphical library:
$sudo aptitude install python2.5-wxgtk2.6

Current code does not work with version wxgtk2.6 so we need to update it:
$wget http://www.atug.com/andypatterns/code/pyNsourceGui1.4c-wx26.zip
$unzip pyNsourceGui1.4c-wx26.zip
$sudo cp pyNsourceGui-wx26.py /usr/lib/python2.5/site-packages/pynsource/


Finally we exec the GUI module
$python /usr/lib/python2.5/site-packages/pynsource/pyNsourceGui-wx26.py


This application presents some annoying bugs:

* There are problems when moving shapes on the screen. It does not refresh correctly.
* It is difficult to adjust page size when you try to print it.
* When you press right click button on the mouse to delete an object, usually it doesn't delete all the arrows that point to it, messing the schema.
* Saving and opening diagram feature is not implemented yet, so you cannot save temporary work.


Well, you know, this bugs are annoying, but it you dont like them, it is free software, so hack the code. :-)

Friday, 14 March 2008

GNU Readline Library Short Description

GNU Readline is a software library that provides a set of functions that allow users to edit command lines as they are typed in.

Every program that uses this library provides the same user command line interface improving consistency between applications.

It is part of the GNU Project and it is licensed under the GPL.

Current version is 5.2 and it is used in projects like bash.

There are two editing modes available: Emacs (default) and Vi

Readline library includes additional functions to maintain a list of previously-entered command lines.
Exec this command to obtain more info about this feature:
$help history


INSTALLATION

In Debian and Ubuntu this library is packed in readline-common package.
$sudo aptitude install readline-common

Once installed, you can access a complete documentation using info command:
$info rluserman


SHORT KEYSTROKE REMINDER

NOTATION:
C-k means while ctrl key is mantained pressed, depress 'k' key.
M-k means while "meta" key is pressed, depress 'k' key.

Usually "meta" refers to ALT key, but if you have no meta key you can use ESC key instead.


Emacs mode commmands:

Movement

C-b Move back the cursor one character.
C-f Move one character forward.
DEL or Backspace Delete the character placed left at the cursor.
C-d Delete the character underneath the cursor.
C-_ or C-x C-u Undo the last editing command.

C-a Move to the beginning of the line.
C-e Move to the end of the line.
M-f Move forward a word.
M-b Move backward a word.
C-l Clear the screen, reprinting the current line at the top.

Killing and yanking (cutting and pasting) commands

C-k Kill the text from the current cursor position to the end of the line.
M-d Kill from the cursor to the end of the current word.
M-DEL Kill from the cursor the start of the current word.
C-w Kill from the cursor to the previous whitespace.

After killing(cutting) text, we yank(paste) it back into the line.

C-y Yank the most recently killed text back into the buffer at the cursor.
M-y Rotate the kill-ring, and yank the new top. You can only do this if the prior command is C-y or M-y.

Searching commands

C-r Searchs backwards on the previous commands you typed.
C-s Perform a forward search from the command line history you are now.

Passing arguments to a command

e.g: M-2 3 C-d means delete next 23 characters on input line.



CONFIGURING THE LIBRARY

GNU Readline keybindings and more can be changed editing ~/.initrc or /etc/initrc files.


URLs
GNU Readline Official page
GNU Readline (Wikipedia)
Official online Readline documentation

Sunday, 2 September 2007

TVAnts on Ubuntu

TVAnts is a peer to peer program that allows you to share live streams instead of files.
Although these streams can contain any sort of media they are mostly used for watching live football matches and other events on PCs.


TVAnts pages:

www.tvants-ppstream.com
Official TVAnts page is written in chinese: tvants.com


Installing TVAnts:

Download TVAnts setup program: ( I have obtained this address from official TVAnts page.)
$wget http://88.191.73.231/~cali/tvants/TvantsSetup.exe

We need wine to run TVAnts setup program because it is a microsoft windows executable:
$sudo aptitude install wine       # if you have not already installed wine program.
$wine "TvantsSetup.exe"

It will install itself, and then we will be able to exec the program:
$wine ~/.wine/drive_c/Program\ Files/TVAnts/Tvants.exe
or
$wine 'C:\Program Files\TVAnts\Tvants.exe'


Watching TV:

You will need at least one server at server tab.
e.g: list.tvants.com

At search tab you will be able to search for hundreds of channels.
Select some and add them to channel tab.

NOTE: Do not worry about error messages related to windows media player, we will use mplayer.

You can watch the channel you have selected runing in the console:
$mplayer -framedrop mms://localhost:16900/1
Last "1" means first channel from your selected channels list.
NOTE: Whenever you add a new channel this number increases in one, even if you delete previous unused channels.


NOTE: TVAnts is a peer to peer system so you should open 16800 port on your box to share streams you are watching with other users.

NOTE: You can also watch the tv streams using vlc instead of mplayer.

Sunday, 19 August 2007

BOINC Distributed Computing Projects

Donating spare CPU cycles to distributed computing projects.



Most of time your cpu load is well below under 100%.

You can check how many resources are you using right now, going to menu:
System --> Administration --> System Monitor

What about if this spare resources all over the world would be used by projects like curing diseases,
discover extraterrestrial inteligence, predice climate changes... ?

That is actually possible, here you have a list of projects you can participate:
http://boinc.berkeley.edu/projects.php


These are all distributed computing projects, based on BOINC platform.


Let's try this thing for real. First step will be installing BOINC:

BOINC - Debian and Ubuntu installation

$sudo aptitude update

$sudo aptitude install boinc-client boinc-manager

execute graphic boinc manager:
$boincmgr

you only have to follow wizard instructions.

NOTE: To join a project:
menu bar Tools -> Attach to project

NOTE: You will need konqueror browser to navigate the web from boincmgr.


Some info about interesting BOINC projects:

Roseta@home project: http://boinc.bakerlab.org/rosetta/

Rosetta@home needs your help to determine the 3-dimensional shapes of proteins in research that may ultimately lead to finding cures for some major human diseases. By running the Rosetta program on your computer while you don't need it you will help us speed up and extend our research in ways we couldn't possibly attempt without your help. You will also be helping our efforts at designing new proteins to fight diseases such as HIV, Malaria, Cancer, and Alzheimer's (See our Disease Related Research for more information). Please join us in our efforts! Rosetta@home is not for profit.


Climateprediction.net: http://climateprediction.net

Climateprediction.net is the largest experiment to try and produce a forecast of the climate in the 21st century. To do this, we need people around the world to give us time on their computers - time when they have their computers switched on, but are not using them to their full capacity.
[read more about the experiment]

Sunday, 12 August 2007

Zattoo on Ubuntu Feisty

Zattoo is a program that allows us to see streaming TV channels over Internet.

It is unfortunately closed source.


Let's go to official Zattoo web page: zattoo.com

Check on your language flag to see what channels are available to see at your zone.


Register to obtain zattoo program: http://zattoo.com/register

After registering, select linux and download zattoo deb file:
e.g: zattoo-2.2.10.6523-i386.deb

Now install the deb file:
$sudo dpkg -i zattoo-2.2.10.6523-i386.deb

I get dependency problems:
zattoo needs libgtkglext1 and libxul0d but those are not installed.

We install those required packages:
$sudo aptitude install libgtkglext1 libxul0d

Once dependencies are solved zattoo package configures automatically.
If that does not happen, then exec:
$sudo dpkg --configure zattoo

Download and install the Adobe Flash plugin from http://www.adobe.com if you have not it on your system yet.

run:
$zattoo_player

introduce your zattoo login (used when registering) and enjoy!

NOTE: To obtain new zattoo versions when they will be available, go to zattoo page, click on login word near country flags, and introduce your email and password.

NOTE: If you wanna know on which ports zattoo is listening, exec this command:
$sudo netstat -l -p -e | grep -i zattoo

Monday, 30 July 2007

Backup your system using TAR

My system is a Debian Sid one (This article was first tested in an Ubuntu Feisty system)
Anyway this article is also useful in most other linux distros.

Tar tool allows us to make backups or even restore them, while our system is running.


It is a good idea becoming root to be able to access every file on the system, or at least you should use sudo command:

$sudo tar cvzpf /home/Backup.tgz --same-owner --exclude=/home/Backup.tgz --exclude=/home/error.log --exclude=/proc/* --exclude=/media/* --exclude=/dev/* --exclude=/mnt/* --exclude=/sys/* --exclude=/tmp/* / 2>/home/error.log


Tar options and arguments


c creates a tar backup
v activates verbose mode
z will compress data using gzip format
p preserves file permissions
f sends output to a file instead of standard output.

After f option it is necessary to write the file name where backup will be stored.
i.e: tar cvzpf /home/Backup.tgz is correct, but
tar cvzfp /home/Backup.tgz is wrong.

/home/Backup.tgz is our backup file name.

--same-owner preserve file ownership, it is not necessary because, being root, is a default option.



Excluding files from Backup


--exclude option gives us the possibility of excluding files and directories from backup.

--exclude=/home/Backup.tgz --exclude=/home/error.log Prevent Backup file and error log file to be stored.


--exclude=/proc/* --exclude=/dev/* --exclude=/sys/*

These are virtual directories so will not be stored.

NOTE: Difference between --exclude=/proc/* and --exclude=/proc is that first option would store a void proc directory, and second one would store nothing.

--exclude=/tmp/*

/tmp is a temporary directory, and is deleted on every boot, so will not be backed up either.


--exclude=/mnt/* --exclude=/media/*

If you want to save your main system only, and not what you have mounted on it, you should exclude these directories.


WHICH DIRECTORIES TO EXCLUDE?

Wednesday, 18 July 2007

Installing Qemu on a Ubunty Feisty System

That simply command will install qemu emulator:
$sudo aptitude install qemu

Right now, qemu works as an emulator, that is, emulates every guest system instruction on the host system.
Emulating is a slow working mode, but if qemu runs on a x86 platform, it is possible to execute guest code directly as host code so speed will improve. (That is called virtualization)


INSTALLING KQEMU MODULE

To use virtualization mode in qemu, we have to install kqemu.

#aptitude install kqemu-common
That package has some documentation and a configuration file, but is not really kqemu module

$sudo aptitude install kqemu-source # Installs kqemu module sources


Compiling sources:

NOTE: You will need libc6-dev package to be able to compile kqemu sources.
If you haven't it: $sudo aptitude install libc6-dev

$sudo su # Becoming root

#cd /usr/src
# tar xvfj kqemu.tar.bz2
#cd modules/kqemu
# ./configure
#make
#make install


kqemu module is now installed!!

Gonna load kqemu module:
#modprobe kqemu

and then run qemu:
#qemu -m 256 -cdrom .....

Appears an error:
"Could not open '/dev/kqemu' - QEMU acceleration layer not activated"

This bug occurs because qemu searchs for a module which major number equals zero and kqemu-common has set it to 250.

To solve that:
#rmmod kqemu
#gedit /etc/modprobe.d/kqemu


and change 250 by 0

again:
#modprobe kqemu
#qemu -m 256 -cdrom .......



SETTING THE NETWORK IN QEMU

If you dont specify network options when invoking qemu, then defaults apply.

This default options are: -net nic -net user
-net nic : emulates a NE2000 network interface card.
-net user: use the user mode network stack which requires no administrator priviledge to run.

That should be enough to have network working in your virtual machine but with some limitations:
* Pings are not available.
* By default User mode network stack allow us to navigate and connect to our host system, but not to act as a server.

User mode network stack has a built in dhcp server that will provide us an ip address.

If everything has gone fine you can open a browser and surf on the internet.

If you cannot connect to internet, open a console and type:
$ifconfig

check if virtual nic has its associated ip address and if not, exec this command:
$sudo dhclient eth0 # eth0 is your virtual nic

try your browser again.


NOTE: Another way to configure the network in qemu consists in using a tap device and a network software bridge, instead of using user mode network stack.

Saturday, 7 July 2007

How to create an Ubuntu UsbLive with persistence

First step is downloading Ubuntu Dapper iso file:

NOTE: Newer versions(Feisty and Gutsy), by now, july 2007, have a bug that prevents to use persistence feature.

You can navigate to Ubuntu download page and select Ubuntu 6.06 LTS Desktop edition (alias Dapper),

or simply enter at console command line:
$wget http://releases.ubuntu.com/dapper/ubuntu-6.06.1-desktop-i386.iso


I recommend a usb pendrive with a capacity higher than 1 Gigabyte, because you will need at least 700 megabytes to copy dapper iso file on it.
In my case I use a 2G pendrive.


Connect the usb pendrive so it be detected.

$dmesg command will show something like:

[ 2697.454838] usb-storage: device found at 4
...
[ 2704.387453] SCSI device sdh: 4029440 512-byte hdwr sectors (2063 MB)


$fdisk -l also shows the new device.

If you still dont find it, you can seek for it at $cat /proc/bus/usb/devices output.


On my system the new device appears as /dev/sdh, in this tutorial, to be more general, I will write it as /dev/sdX.


Next step will be partitionating our usb pendrive: (choose the program you prefer: fdisk, cfdisk, gparted ...)

#fdisk /dev/sdX

(for help on this step read $man fdisk)


I partitionate the device into two partitions sdX1 and sdX2, both sized one gigabyte, and make bootable the first one, showing this result with fdisk:

DeviceActiveBeginningEndBlocksIdSystem
/dev/sdX1*1493978081bW95 FAT32
/dev/sdX24941015103564883Linux





Umount both partitions if they are mounted and then format them with:

#mkfs.vfat -F 32 -n usb /dev/sdX1
#mkfs.ext3 -L casper-rw -b 4096 /dev/sdX2

NOTE: casper-rw label is important, do not change it.


Mount dapper iso file in your harddisk:
#mkdir dapper_directory
#mount -o loop ubuntu-6.06.1-desktop-i386.iso dapper_directory



Copy iso files to first usb pendrive partition:
#mount /dev/sdX1 /media/foo
#cd dapper_directory
#cp -dpR . /media/foo



Installing grub bootloader:

#grub-install --root-directory=/media/foo /dev/sdX

this does not install menu.lst file so we will create it manually:
$sudo gedit /media/foo/boot/grub/menu.lst


Howto change isolinux.cfg entries (/media/foo/isolinux/isolinux.cfg) into menu.lst format:

E.g: isolinux.cfg entry

LABEL live
menu label ^Start or install Ubuntu
kernel /casper/vmlinuz
append boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --


changes into: (menu.lst entry)

title Start or install Ubuntu
root (hd0,0)
<---------------- this is necessary to identify usb device at boot. kernel /casper/vmlinuz boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash
initrd /casper/initrd.gz
boot


NOTE: If you have problems creating menu.lst file, copy the one that appears at the end of this article.

Now you have written a correct menu.lst file at /media/foo/boot/grub directory exec again:
#grub-install --root-directory=/media/foo /dev/sdX

NOTE: If grub gives this error message "/dev/sdX does not have any corresponding BIOS drive"
execute this command:
#grub-install --root-directory=/media/foo --recheck /dev/sdX


NOTE: to be able to run your usb pendrive from qemu you have to trick the emulator giving a usb dapper iso as a cdrom device e.g:
#qemu -hda /dev/sdX -cdrom ubuntu-6.06.1-desktop-i386.iso -boot c


If you want to restart your computer to probe your creation, run:
#eject /dev/sdX

NOTE: eject /dev/sdX umounts sdX partitions and deletes /dev/sdX, /dev/sdX1,... devices

Restart and boot from your usb pendrive.


Have fun!!


APPENDIX: Example of menu.lst file

NOTE: persistent tag at first kernel line enables persistence mode in our usb pendrive.

timeout         10

color cyan/blue white/blue


title           Start Ubuntu in Persistent mode
root            (hd0,0)
kernel          /casper/vmlinuz boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw persistent
initrd          /casper/initrd.gz
boot

title           Live - Start or install Ubuntu
root            (hd0,0)
kernel          /casper/vmlinuz boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw
initrd          /casper/initrd.gz
boot

title           Start Ubuntu in safe graphics mode
root            (hd0,0)
kernel          /casper/vmlinuz boot=casper xforcevesa initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw
initrd          /casper/initrd.gz
boot

title           Check CD for defects
root            (hd0,0)
kernel          /casper/vmlinuz boot=casper integrity-check initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram rw
initrd          /casper/initrd.gz
boot

title           Memory test
root            (hd0,0)
kernel          /install/mt86plus
boot



This article is based on this excelent spanish one extracted from Daniel Perella's Blog.

Sunday, 10 June 2007

Installing Qemu on Windows Vista

Qemu introduction from Wikipedia

QEMU emulates a full computer system, including a processor and various peripherals. It can be used to provide virtual hosting of several virtual computers on a single computer.

Accelerator
Qemu author, Fabrice Bellard, also wrote a Linux kernel module (with preliminary ports to FreeBSD and Windows) named KQEMU or QEMU Accelerator, which notably speeds up i386 emulation on i386 platforms. This is accomplished by running user mode code directly on the host computer's CPU, and using processor and peripheral emulation only for kernel mode and real mode code. KQEMU also supports a kernel emulation mode in which portions of kernel mode code run on the host's CPU


Qemu official page:
http://fabrice.bellard.free.fr/qemu/

Qemu ported to Windows:
http://www.h7.dion.ne.jp/~qemu-win/

First we download a zip package:
qemu-0.9.0-windows.zip

Next unzip archives to a folder.

There are some clues at file README-en.txt, and a html manual at qemu-doc.html.


Qemu is now ready to be run:
so exec qemu-win.bat and a small linux test image "linux.img" is emulated.

NOTE: When a mouse cursor is missing, type Ctrl and Alt key together. Please use Alt
and Tab on WindowsMe.


NOTE: To exit from Linux, press Ctrl-Alt-2 keys together then you will see (qemu) prompt.

Then type quit: (qemu) quit


Running Qemu:

I have downloaded a Ubuntu iso cdrom image: ubuntu-7.04-desktop-i386.iso


First I exec C:\Windows\System32\cmd.exe to open a comand line window, and then:
>cd <qemu-directory-path>
>qemu -L . -m 512 -cdrom ubuntu-7.04-desktop-i386.iso

Argument options have the following meanings:
OptionValueExplanation
-Lbios pathin our example actual directory "."
-mavailable memoryDefault is 128 meg, I set it to 512
-cdromiso cdrom image pathIso image to emulate a cdrom


Qemu gives this warning:
Could not open '\\.\kqemu' - QEMU acceleration layer not activated

To avoid this message, install qemu accelerator, which will improve qemu speed:
(NOTE: uninstall any previous version accelerator you have before installing this one)
Qemu accelerator Kqemu-1.3.0pre11


NETWORK SET UP FOR QEMU ON WINDOWS VISTA

Right now we don't have network available. We check at this doc for some clues: HowToNetwork-en.html


I have decided to use a TAP (virtual ethernet network interface) to have full internet access: TapWin32-en.html

First we need a VPN driver for windows: OpenVPN driver download page.
Download and install this program: openvpn-2.0.9-install.exe

Once installed go to Programs menu and then
-> OpenVPN -> Add a new TAP-Win32 virtual ethernet adapter

If all has gone fine, a tap device will appear at:

Control panel -> Network and Sharing Center -> Manage networks

Remember the TAP interface name because it will be passed as an argument to qemu, i.e. in my computer is "Local area connection 2"


Now we have to establish a NETWORK SOFTWARE BRIDGE in windows vista.

Network bridge (Wikipedia)

A network bridge connects multiple network segments at the data link layer (layer 2) of the OSI model.
In our case the bridge will interconnect a real network interface with our TAP interface at data link layer, so both interfaces will share same IP address.

Howto set up a network bridge at windows xp and vista: Win XP network bridge set up.

Select both interfaces pressing ctrl key, and right click the mouse.
Select "Bridge connections" at the pop up menu and wait till network bridge will be completed.

After bridge completion gonna set up its network configuration:
right click at bridge icon -> properties -> Internet protocol version 4

If you have a dhcp server you can set bridge interface to automatically get its IP address.

I use a static network configuration at my LAN.

(change values to suit your network.)
IP 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.129

DNS1 194.179.1.100
DNS2 194.179.1.101


To check the network at console window we can make some pings:
ping 192.168.0.5
ping 192.168.0.129 (checking gateway)



Time of truth arrives, we launch qemu:
qemu -L . -m 512 -cdrom ubuntu-7.04-desktop-i386.iso -net nic -net tap,ifname="Local area connection 2"


at ubuntu guest system I configure the network with a free IP address on my LAN:
IP 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.129
DNS 194.179...


pings work:
ping 192.168.0.10
ping 192.168.0.5
ping 192.168.0.129 (checking the gateway)


If you have Internet access through your LAN, you can now open a browser and surf on the Internet from inside your qemu guest system. :-)


More info about bridging:
hnw_bridge_install
hnw_understanding_bridge


OTHER INTERESTING LINKS

Qemu HowTo Floppy Cdrom