Changes

Jump to: navigation, search

Xen

97 bytes added, 4 years ago
Editing the make.conf
'''Assumptions'''
''We build a 64bit headless XEN hypervisor rockstable and rocket fast with a funtoo headless 64bit paravirt domU.''
We are '''not''' building Xen with pvgrub or hvm (which is kinda slow and overhead as long as you don't want to install WindozeWindows).
== Buiding Funtoo Xen Host Dom0 ==
{{kernelop
| <br> title=|<pre>desc=
General setup --->
<*> Kernel .config support
[*] Use ext4 for ext2/ext3 file systems (NEW)
[*] Ext4 extended attributes (NEW)
</pre>}}
{{Fancyimportant|Don't forget to add the required drivers for your networking and sata cards. If you use RAID, make sure to add the correct CONFIG_MD_RAID* entries to your config.}}
Work has been completed to automatically enable Xen Grub entries, so after you copy your dom0 kernel edit your /etc/boot.conf as follows:
{{File|/etc/boot.conf|<pre>
"Funtoo on Xen" {
type xen
params += quiet
}
</pre>}}
{{Fancynote| iommu is the paravirtualized instructions, if your motherboard or CPU does not support VT-d do, not enable it. Xsave saves the supported CPU instruction sets -- without it you're dom0 kernel may not boot. dom0_vcpus_pin permanatly assigns cpu's to dom0 -- increasing performance.}}
<console>
###i## cd /etc/init.d/
###i## ln -s netif.tmpl netifnet.xenbr0###i## ln -s netif.tmpl netifnet.extbr0###i## ln -s netif.tmpl netifnet.eth0###i## ln -s netif.tmpl netifnet.eth1###i## rc-update add netifnet.xenbr0 sysinit###i## rc-update add netifnet.extbr0 sysinit
</console>
Make sure dhcpcd, eth0 and eth1 don't start at boot:
<console>
###i## rc-update del dhcpcd sysinit###i## rc-update del netifnet.eth0 sysinit###i## rc-update del netifnet.eth1 sysinit
</console>
Configure the slave interfaces:
<console>
###i## cd /etc/conf.d/###i## echo 'template="interface-noip"' > netifnet.eth0###i## echo 'template="interface-noip"' > netifnet.eth1
</console>
Then Now, we are going to prepare the bridges.:
<console>
###i## nano netifnet.xenbr0
</console>
here we set the internal Xen bridgeby editing <code>/etc/conf.d/net.xenbr0</code>
<pre>
template="bridge"
nameservers="10.0.1.1 10.0.1.2"
domain="funtoo.org"
slaves="netifnet.eth0"
</pre>
 Then , we are setting set up the external interface:
<console>
###i## nano netifnet.extbr0
</console>
this is looking quiet {{Fancynote| This will look quite similar, please . Please watch out for the correct slave setting!}} Now, edit <code>/etc/conf.d/net.extbr0</code>: 
<pre>
template="bridge"
nameservers="10.0.1.1 10.0.1.2"
domain="funtoo.org"
slaves="netifnet.eth1"
</pre>
This gives us the possibility to play around with various setups later, it's modular and easy to tweak and change.
Better you invoke {{Fancytip| It is probably a good idea to try starting the interfaces with "rc" on the command line the openrc script and test if the network cards get initialized correctlybefore rebooting.}}
== Basic Networking with domU ==
We edit the /etc/xen/xend-config.sxp
 
<pre>
#### Xen config from maiwald.tk - Xen 4.x Network in bridge mode
<console>
###i## vgcreate vgxen /dev/sda3###i## lvcreate -L10G -n funtoo_root vgxen###i## lvcreate -L1G -n funtoo_swap vgxen###i## vgchange -a y###i## mkfs.ext4 -L funtoo_root /dev/vgxen/funtoo_root###i## mkswap -L funtoo_swap /dev/vgxen/funtoo_swap###i## rc-update add lvm boot
</console>
== Basic DomU System setup ==
=== mount domU lvm volume or physical partition or image file===
<console>###i## mkdir /mnt/domu1###i## mount /dev/vgxen/funtoo_root /mnt/domu1###i## cd /mnt/domu1
</console>
from a funtoo mirror near you, I suggest you look at the funtoo homepage
<console>###i## links http://www.funtoo.org/wiki/Download </console>
Then choose a mirror near you ( I use Heanet in EU ) and look for the right stage3. I use XEON CPUs so I take the core2 distrib:
<console>###i## wget -cv http://ftp.heanet.ie/mirrors/funtoo/funtoo-stable/x86-64bit/core2_64/stage3-latest.tar.xz </console>Unfortunately I can't find md5sums or similar which is really unpleasant.
=== then get Get latest portage tree from the snapshots firectory directory ===
<console># wget -cv http://ftp.heanet.ie/mirrors/funtoo/funtoo-stable/snapshots/portage-current.tar.xz </console>
=== extract stage3 ===
<console>
###i## wget -cv http://ftp.heanet.ie/mirrors/funtoo/funtoo-stable/snapshots/portage-latest.tar.xz </console> === Extract the stage3 ===<console>###i## tar xpf stage3-current.tar.xz
</console>
=== extract portage Extract Portage === <console>###i## cd usr###i## tar xf ../portage-currentlatest.tar.xz </console>
== Preparing the chroot environment ==
=== Editing the make.conf ===
copy the <code>/etc/portage/make.conf</code> from dom0 and adjust it:
=== Editing the make.conf ===
copy /etc/make.conf from dom0 and adjust it
<console>
###i## cp /etc/portage/make.conf /mnt/domu1/etc/
</console>
make sure to adjust MAKEOPTS to your assigned CPUs (rule of thumb : cpu cores +1 - yes, even in XEN)
<console>
###i## nano -w /mnt/domu1/etc/portage/make.conf
</console>
out there the MAKEOPTS variable in:
<pre>MAKEOPTS="-j2"</pre>
=== copy Copy <tt>/etc/resolv.conf </tt> === <console>###i## cp -L /etc/resolv.conf /mnt/domu1/etc/ </console>
=== mount proc and dev ===
<console>###i## mount -t proc none /mnt/domu1/proc###i## mount --rbind /dev /mnt/domu1/dev </console>
== Building Funtoo Xen Guest(s) DomU ==
== Final DomU System setup ==
=== chroot ===
<console>###i## chroot /mnt/domu1 /bin/bash###i## env-update###i## source /etc/profile###i## export PS1="(domU-chroot) $PS1" </console>
=== sync portage ===
<console>
###i## emerge --sync
</console>
=== set locales ===
<console>###i## nano -w /etc/locale.gen###i## locale-gen
</console>
=== set Set your timezone === (choose your timezone in <tt>/usr/share/zoneinfo</tt>)<console>###i## cp ln -L v -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime</console>
=== edit Edit <tt>/etc/fstab </tt> (see also gentoo handbook as reference) === we We assume that we name our root partition <tt>xvda1 </tt> and the swap partition <tt>xvda2 </tt> in our <tt>domU-xen-</tt> config (we will do that later)
<console>
###i## nano -w /etc/fstab</console> <pre>/dev/xvda1 / ext4 noatime 0 1
/dev/xvda2 none swap sw 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
</pre>
=== Now comes the The most important stuff === please just copy Copy this into your terminal:
<pre>
So that's it - almost.
==== adding Adding networking to the domU: ====
<console>
(domU-chroot) ###i## cd /etc/init.d/(domU-chroot) ###i## ln -sf netif.tmpl netifnet.eth0(domU-chroot) ###i## rc-update add netifnet.eth0 * service netifnet.eth0 added to runlevel sysinit
</console>
==== Now we are ready to do for the last final setups ====
<console>
(domU-chroot) ###i## emerge eix</console> After that I am feeling better now, I do the rest..<console>(domU-chroot) ###i## eix-update
Reading Portage settings ..
Building database (/var/cache/eix) ..
</console>
From here you have to decide how you want to run your domU: with unpriviledged users and sudo ? or with a root account enabled? or as a webserver or firewall?.
Me, personally, I always do install the openssh server and just place my ssh keys in there. From there the steps differ.
<console>
(dom0-xen) ###i## cp /root/.ssh/authorized_keys /mnt/domu1/root/.ssh/
</console>
Also, don't forget here to enable PubKeyAuth in your sshd_config in your domU and set <tt>PermitRootLogin </tt> to yes!
'''Double checking! ''': Does your domU use kernel uses modules or not? If you haven't built a monolitic kernel you should copy the modules from the dom0 to the domU now:
<console>
(dom0-xen) ###i## mkdir /mnt/domu1/lib/modules(dom0-xen) ###i## rsync -aP /lib/modules/2.6.38-xen-maiwald.tk-dom0 /mnt/domu1/lib/modules/
</console>
 
Ok, that's it from here..
Don't forget to clean up the mounts!
<console>
(dom0-xen) ###i## cd(dom0-xen) ###i## umount -l /mnt/domu1/proc(dom0-xen) ###i## umount -l /mnt/domu1/dev(dom0-xen) ###i## umount -l /mnt/domu1
</console>
 
That's it! ;-)
=== Booting the Xen DomU Guest ===
<console>
(dom0-xen) ###i## cd /xen(dom0-xen) ###i## xm create -c configs/funtoo.cfg
</console>
Huuuuiiiii......
<pre>
Using config file "./configs/funtoo.cfg".
localhost ~ #
</console>
All seems good for now.
Now switch back to the Funto Funtoo [[Installation (Tutorial)|Installation Tutorial]] and go on with setting up your new domU guest like a normal funtoo linux system!
'''Please consider to help supporting this Wiki with by editing this page and keeping it current!'''
Funtoo is a perfect Xen Host and I can really recommend it to everybody as an alternative to .deb/.rpm Systems.
Have fun!
[[Category:Virtualization]]
[[Category:Featured]]
wiki-staff
1,105
edits

Navigation menu