Fedora Linux Support Community & Resources Center
  #1  
Old 27th May 2005, 10:40 PM
jarifed Offline
Registered User
 
Join Date: Nov 2004
Posts: 174
My experience with xen

What is Xen

Xen is a virtual machine monitor (VMM) for x86-compatible computers. Xen can securely execute multiple virtual machines, each running its own OS, on a single physical system with close-to-native performance.

Xen in FC4

You have to install the following packages xen , kernel-xen0 and kernel-xenU.
xen is the hypervisor, kernel-xenO is the "main domain" and kernel-xenU are the user created domains Each user domain can have a different version of a kernel

After installation of xen and kernel-xenO-<version> your grub config will looks like this
title Fedora Core (2.6.11-1.1353_FC4xen0)
root (hd1,7)
kernel /xen.gz
module /vmlinuz-2.6.11-1.1353_FC4xen0 ro root=/dev/VolGroup00/LogVol01
module /initrd-2.6.11-1.1353_FC4xen0.img

the kernel /xen.gz is the hypervisor which controls the virtual machines.
The part vmlinuz-2.6.11-1.1353_FC4xen0 is domain0 and from here you can create user domains

when you reboot as above you will be in Domain0

When you issue the command service xend start it will start xen

With the command xm list you can see what domains are running

xm list
Name Id Mem(MB) CPU State Time(s) Console
Domain-0 0 256 0 r---- 554.8
base1 2 63 0 -b--- 92.4 9602
httpd 4 64 0 -b--- 16.5 9604

above you see 3 domains
Domain-O having 256Mb of memory and is my normal FC4 working area
I have also created 2 virtual domains base1 and a httpd server both using 64Mb each

btw " xm help " will give you more info

The user domains do not have any physical devices an example of ifconfig in domain0

eth0 Link encap:Ethernet HWaddr 00:30:BD:2A6:E8
inet addr:192.168.1.130 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::230:bdff:fe2a:c6e8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
<snipped>

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
<snipped>
vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
<snipped>
vif4.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<snipped>
xen-br0 Link encap:Ethernet HWaddr 00:30:BD:2A6:E8
inet addr:192.168.1.130 Bcast:192.168.1.255 Mask:255.255.255.255
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
<sniiped>
Above you see the xen-brO which is the interface between the physical
interface and the virtual interfaces vif 2.0 (domain 2 interface 0) and vif 4.0

Note the same IP addres and hardware address between eth0 and br0 but a difference of inet6 address

This is the ifconfig of vif 2.0

eth0 Link encap:Ethernet HWaddr AA:00:00:4B:42:F3
inet addr:192.168.1.112 Bcast:192.168.1.255 Mask:255.255.255.0
<snipped>
It has created an virtual hardware MAC address

Creation of a Base user domain

Let's first investigate the yum groupinstall
With fedora it is possible to install,update upgrade by groups
"yum grouplist will" show a list of groups for installalation created by fedora

yum grouplist
Setting up Group Process
Setting up repositories
jr 100% |=========================| 1.1 kB 00:00
Installed Groups:
Compatibility Arch Support
DNS Name Server
Mail Server
Text-based Internet
Available Groups:
Administration Tools
Authoring and Publishing
<snipped>
Our target is to install a Base system so let's have a look

yum groupinfo Base
Setting up Group Process
Setting up repositories
jr 100% |=========================| 1.1 kB 00:00

Group: Base
Required Groups:
Core
Dialup Networking Support
Mandatory Packages:
tmpwatch
traceroute
<snipped>
Default Packages:
openssh-clients
nss_db
acpid
nss_ldap
<snipped>
Optional Packages
netconfig
brltty
<snipped>
You can try this out in your current domain

Anyway to install the above base package is approx 180Mb and depending on your download speed this might take a while (I have a DL of 5 MB/s and it took me 30-45 minutes using a local repo site.

Option 1 use the repo site of a mirror

Option 2 create our own repo

I have downloaded FC4T3 and saved it to the hard disk I do my installl's from a hard drive as I don't have a DVD writer and my CD burner doesn't seem to be to good

Mounted the DVD iso as a loop the device and created myrepo.repo it could not find the repodata and as it was also not possible to write to the iso I created a directory where I installed all the rpm's.

with the command createrepo /directory/rpms I was able to create a repodata directory I still had a problem getting the groupinfo available.
After searching the internet I found I had to place comps.xml in the repodata and recreated "createrepo" and it worked It saved me a lot of time of waiting.

so in /etc/yum.repos.d
myrepo.repo
[myname]
name=Fedora Core Base
baseurl=file:///myname/Fedora/RPMS/
enabled=1
gpgcheck=0

For the time I dissabled the other repos.
I also disabled Selinux

Now on to creating a vitual user domain

I created a script as I tried before several times and typo errors etc

mkdir -F -j /xen/base
dd if=/dev/zero of=/xen/base.img bs=1M count=1 seek=1024
mkfs.ext3 /xen/base.img
mount -o loop /xen/base.img /xen/base
for i in console null zero ; do MAKEDEV -d /xen/base -x $i ; done
yum --installroot=/xen/base -y groupinstall Base

I ignored any errors and hoped for the best

Created also an fstab file and copied to /mnt/etc
fstab
/dev/sda1 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0

We also need to create a config file in /etc/xen Domain0

kernel ="/boot/vmlinuz-<version>FC4xenU"
memory = 64
name = "myxen"
nics = 1
disk = ['file:/xen/base.img,sda1,w']
root = "/dev/sda1 ro"
and save as myxen

Check in /mnt/etc/selinux the config file and look for the line
SELINUX=Permissive
This is my file.
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=Permissive
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

umount /mnt/xen/base.

So ready to start a virtual machine

Create some memory in Domain0 with
xm balloon O 256 "this reserves 256MB for domain 0

xm create -c myxen

It will now create a user domain and with the -c option you should be able to login as root.

Once logged in you willl have a minimal system

If you have a dhcp server do dhclient eth0 and you should get a IP address from your dhcp server.

From within your user domain you do not have direct access to your hardware.

The next challenge was to create a httpd server.

First you can copy xen/base.img to xen/httpd.img
copy or create myhttp
kernel ="/boot/vmlinuz-<version>FC4xenU"
memory = 64
name = "myhttp"
nics = 1
disk = ['file:/xen/httpd.img,sda1,w']
root = "/dev/sda1 ro"

I am currently not able to see domainO hard disks in my user domain so I created a FTP server in domain0 so that I can use yum in my user domain to install packages
I used vsftp all I did was pointing anon_root=repodirectory

I created a user domain xm create -c myhttp and login

Go in User domain to etc/yum.repos.d I dissabled all the fedora.repos and created

myrepo.repo
[jr]
name=Fedora Core Base
baseurl=ftp://192.168.1.130//Fedora/RPMS/
enabled=1
gpgcheck=0

If you have connectivity with your ftp server you should be able to install any package you like

So to install a http web server
yum groupinstall "Web Server"
and this install the appache web server

Not all the times it went smoothly a lot of trying and errors but it is fun!

References:
http://www.fedoraproject.org/wiki/FedoraXenQuickstart
http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
http://www-128.ibm.com/developerwork...library/l-xen/
  #2  
Old 28th May 2005, 05:15 AM
Dog-One's Avatar
Dog-One Offline
Registered User
 
Join Date: Sep 2004
Location: NORTHCOM
Posts: 813
Very cool jarifed!

Any chance the you could attempt to add a NetBSD user domain...?

It would be real nice to know someone that actually had xen running different multiple OSs.
__________________
Please give credit where credit is due--say thanks in the active thread.
Refresh yourself with the Posting Guidelines........Frequently Asked Questions........Registered Linux User #369513
  #3  
Old 28th May 2005, 06:25 AM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,002
Jarified, this great as I would have never figured out the xen.gz was the vms !!!

I have three problems, questions, issues ...

1. The rpm files of the xeno and xen u kenals from the special repo will not run.
rpm i xenfile.rpm just returns the the help for rpm.
How and where can I get them again and is there ones for 1363?
And where would we get xenbsdu kernal (that works with FC4)?

2. When you are turning SELinux off, is that for the xeno, xenu or both?
where you have Ceck in the /mnt/etc/selinux you have permissive at the top then targeted at the bottom?

3. Will the dd command make a file >2GB and did you create them within the lvm2?


Thanks for typing all this up.
SJ
__________________
Do the Math
  #4  
Old 28th May 2005, 07:23 AM
jarifed Offline
Registered User
 
Join Date: Nov 2004
Posts: 174
Quote:
Any chance the you could attempt to add a NetBSD user domain...?
Dog-One

Well I am currently only using Fedora and I am not familiar with NetBSD
They do support Xen and have some good info.

So what I'll need to do
Install NetBSD and get familiar with it
Install the xen packages and create a xenU domain running under NetBSD.

It would be interesting to see if it possible to run a Fedora XenU configuration under NetBSD and vice versa.

The article from NetBSD looks very similar to Fedora but I keep you posted

Jarif
  #5  
Old 28th May 2005, 07:39 AM
jarifed Offline
Registered User
 
Join Date: Nov 2004
Posts: 174
Smile

If you get the help message you probably have syntax error
Quote:
rpm i xenfile.rpm just returns the the help for rpm
it should be rpm -i kernel-2.6.11-1.1365_FC4.i686.rpm

How and where can I get them again and is there ones for 1363
This has been superseded

http://people.redhat.com/davej/kerne...4/RPMS.kernel/
The latest kernels
rpm -ivh kernel-2.6.11-1.1365_FC4.i686.rpm
rpm -ivh kernel-xen0-2.6.11-1.1365_FC4.i686.rpm
rpm -ivh kernel-xenU-2.6.11-1.1365_FC4.i686.rpm

And where would we get xenbsdu kernal (that works with FC4) (Don't understand this)

Quote:
When you are turning SELinux off, is that for the xeno, xenu or both?
where you have Ceck in the /mnt/etc/selinux you have permissive at the top then targeted at the bottom?
I have disabled both for the time being

config looks like this
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=Permissive
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted


Will the dd command make a file >2GB and did you create them within the lvm2
I haven't tried see no reason why not, use seek=2048
You actually create an image file or a virtual disk and give it a name and is not releated to lvm2, on this virtual disk (vd) you install the OS.
Actually the kernel is outside this image.

So for example

You have created a vd myimage and has a configuration file and using
SlowJet.kernel.1.0

You upgrade your kernel SlowJet.kernel.1.1

copy myimage myimage.test

create a config file and vd myimage.test (remember nothing has been changed in this file) and using SlowJet.kernel.1.1
Your can test your image using a new version kernel but can also be used when installing software

Quote:
Thanks for typing all this up
copy and paste does a lot!http://forums.fedoraforum.org/newreply.php#
  #6  
Old 28th May 2005, 04:14 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,002
Well, I tried the repo after my last post and evrything went crazy.
I jsut got the windows proxy, net and dhcp working again this morning.
Linux would not boot at all after hang up on the repo download.
This morning it sat at sendmail for 2 min then finally proceeded, dhcp had an ip now and it came up.

Dave's repo is jixed. lol

I think the raindrops are falling too close to the divid to worry about more updates at this time.
I'm waiting for the real McCoy.

SJ

EDIT Note:

OK, I installed 1365 KENERALS by using the default installer to download the files.
Rebooting and then do a little dance of excitement.
Oh sooooo close. I can hear the whriling of VM's.

SJ
__________________
Do the Math

Last edited by SlowJet; 28th May 2005 at 04:54 PM.
  #7  
Old 28th May 2005, 07:53 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,002
Domain o is running. The kernal rpm installer set up the grub.conf entries but does not mark it as default kernal.
After selecting xenO from grub startup list, the text overwrites (vs. clears) the screen and it is not clear as to what is going on but it boot as normal kernal with X/Gnome.
(I noticed something about press Ctrl-a three time to get serial console.)
Then in tem su -
xend start
xm list show domain O

However, the network thinks it is a different enity and refuses share, logon, and e-mail connections. So, it needs some planning to get all that worked out.

OH, and Domain O can indeed run with SELinux on. No problem (as it uses the host file system).
It is like the host system for VMWare, the xen U are the guests.

SJ
__________________
Do the Math

Last edited by SlowJet; 28th May 2005 at 07:56 PM.
 

Tags
experience, xen

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My FC6 experience BerSerK Fedora Focus 7 21st December 2006 10:32 PM


Current GMT-time: 16:32 (Monday, 20-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat