个人工具

“UbuntuHelp:XenVirtualMachine/XenOnUbuntuFeisty”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(正在将页面替换为 '{{From|https://help.ubuntu.com/community/XenVirtualMachine/XenOnUbuntuFeisty}} {{Languages|UbuntuHelp:XenVirtualMachine/XenOnUbuntuFeisty}} This info has been merged into ...')
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/XenVirtualMachine/XenOnUbuntuFeisty}}
 
{{From|https://help.ubuntu.com/community/XenVirtualMachine/XenOnUbuntuFeisty}}
 
{{Languages|UbuntuHelp:XenVirtualMachine/XenOnUbuntuFeisty}}
 
{{Languages|UbuntuHelp:XenVirtualMachine/XenOnUbuntuFeisty}}
 
+
This info has been merged into the main Xen wiki page at
 
+
XenVirtualMachine
Note: If you only use Xen for desktop usage in order to run windows programs, you should seriously consider using [https://help.ubuntu.com/community/KVM KVM] instead. KVM is integrated to the feisty fawn kernel and the is no need for special drivers (such as nvidia proprietary drivers).
+
 
+
== Installing packages ==
+
 
+
=== Desktop Version ===
+
 
+
1. Enable universe in your /etc/apt/sources.list.
+
 
+
2. `sudo apt-get install ubuntu-xen-desktop` for a 32-bit system OR `sudo apt-get install ubuntu-xen-desktop-amd64` for a 64bit (AMD amd64 or Intel EM64T) system (the ubuntu-xen-desktop package wasn't found when I tried installing it on an x64 system).
+
This will install and configure the software necessary to run Xen on the desktop.
+
 
+
=== Server Version ===
+
 
+
1. Enable universe in your /etc/apt/sources.list.
+
 
+
2. `sudo apt-get install ubuntu-xen-server`
+
This will install and confgiure the software necessary to run Xen on a "server".
+
 
+
== Configuring the Virtual Machine ==
+
 
+
After install and reboot the machine, you can be able to get one list of VM's runing:
+
 
+
<pre><nowiki> $ sudo xm list
+
Name                                      ID Mem(MiB) VCPUs State  Time(s)
+
Domain-0                                  0      864    2 r-----    651.1 </nowiki></pre>
+
 
+
Now you will have to adjust the network settings that XEN will use. The xend daemon is configured in `/etc/xen/xend-config.sxp`. Add the following line to `xend-config.sxp`:
+
 
+
<pre><nowiki>
+
(network-script network-bridge)
+
</nowiki></pre>
+
 
+
And the restart the xend:
+
 
+
<pre><nowiki>
+
$ sudo xend stop
+
$ sudo xend start </nowiki></pre>
+
 
+
And you can see one `xenbr0` on the output of `ifconfig` command.
+
 
+
=== Using loopback-mounted-file ===
+
 
+
* Generate loopback file as sparse file (not written entirely to disk but filled on demand) (replace 'edgy.ext3' with whatever name you want for it, ie. 'system1.ext3':
+
<pre><nowiki>
+
sudo dd if=/dev/zero of=/usr/local/edgy.ext3 bs=1024k seek=4096 count=0 </nowiki></pre>
+
 
+
* Create filesystem within (replace 'edgy.ext3' with what the name you used in step 1):
+
<pre><nowiki>
+
sudo mkfs.ext3 /usr/local/edgy.ext3 </nowiki></pre>
+
 
+
Mkfs will tell you that this is no block device. Since you already know that (do you?) you can tell it to create the filesystem nevertheless. (so say Yes)
+
 
+
* Loopback mount filesystem (replace 'edgy' and 'edgy.ext3' with the name you used in step 1):
+
<pre><nowiki>
+
sudo mkdir /mnt/edgy
+
sudo mount /usr/local/edgy.ext3 /mnt/edgy -o loop </nowiki></pre>
+
 
+
* Install debootstrap:
+
<pre><nowiki>
+
sudo apt-get install debootstrap </nowiki></pre>
+
 
+
* Install edgy base into it (replace 'edgy' with the release-name (version) of ubuntu you want (dapper, edgy, feisty, etc), replace '/mnt/edgy' with the name you used in step 1):
+
32bit Host O/S & 32bit virtual host <code><nowiki> sudo debootstrap edgy /mnt/edgy </nowiki></code>
+
 
+
64bit Host O/S & 64bit virtual host <code><nowiki> sudo debootstrap --arch amd64 edgy /mnt/edgy </nowiki></code>
+
 
+
* Give it the kernel modules (the module name depends on whether you use the desktop or server edition) (this implies you are installing the same release of ubuntu as you are currently running on the system as the host O/S, which is edgy throughout this example) (replace '/mnt/edgy' with what you used in step 1):
+
32bit Host OS & 32bit Virtual host: <code><nowiki>  sudo cp -a /lib/modules/2.6.19-4-generic/ /mnt/edgy/lib/modules/ </nowiki></code>
+
 
+
64bit Host OS & 64bit Virtual host: <code><nowiki>  sudo cp -a /lib/modules/2.6.19-4-generic-amd64/ /mnt/edgy/lib/modules/ </nowiki></code>
+
 
+
* Change whatever you want to be changed before the first boot. Examples:
+
 
+
The network example below is somewhat confusing.  Basically, whatever your Host O/S's (pre-existing) IP address is, put that in for the gateway, and make sure that the 'netmask' and 'address' put the virtual host into the same broadcast group as the host o/s (simpler example: address: 192.168.1.222 netmask: 255.255.255.0 gateway: 192.168.1.111, the 222 is the virtual host, the 111 is the host o/s's actual IP).
+
 
+
<pre><nowiki>
+
cat /mnt/edgy/etc/network/interfaces
+
auto lo
+
iface lo inet loopback
+
 
+
auto eth0
+
iface eth0 inet static
+
address 192.168.44.247
+
netmask 255.255.252.0
+
gateway 192.168.47.254 </nowiki></pre>
+
 
+
<pre><nowiki>
+
cat /mnt/edgy/etc/hosts
+
127.0.0.1      localhost
+
127.0.1.1      edgyvm </nowiki></pre>
+
 
+
<pre><nowiki>
+
cat /mnt/edgy/etc/hostname
+
edgyvm </nowiki></pre>
+
 
+
<pre><nowiki>
+
cat /mnt/edgy/etc/fstab
+
proc            /proc          proc    defaults        0      0
+
/dev/hda1      /              ext3    defaults,errors=remount-ro 0      1
+
</nowiki></pre>
+
 
+
* Umount the loopback partition
+
<pre><nowiki>
+
sudo umount /mnt/edgy </nowiki></pre>
+
 
+
* Configure the guest, create /etc/xen/edgy-guest.cfg
+
<pre><nowiki>
+
kernel = "/boot/vmlinuz-2.6.19-4-generic"
+
ramdisk = "/boot/initrd.img-2.6.19-4-generic"
+
builder='linux'
+
memory = 128
+
name = "edgy-guest"
+
vcpus = 1
+
vif = [ 'bridge=xenbr0' ]
+
disk = [ 'file:/usr/local/edgy.ext3,ioemu:hda1,w' ]
+
root = "/dev/hda1 ro"
+
</nowiki></pre>
+
 
+
''' Note: Change hda1 by sda1 if you are using some SATA or SCSI Controller '''
+
 
+
Note that root points to the virtual root partition of the domU and not of dom0. It is recommended to give each domU a swap partition, in such case your cfg-file may look as follows (don't forget to add it to the /etc/fstab of the virtual host, so it mounts it on boot-up):
+
<pre><nowiki>
+
disk = [ 'file:/usr/local/edgy.ext3,ioemu:hda1,w','phy:/dev/hda6,ioemu:hda2,w']</nowiki></pre>
+
 
+
* Now you can create your xen domain
+
<pre><nowiki>
+
sudo xm create edgy-guest.cfg </nowiki></pre>
+
 
+
* You can connect to the guest using the command below or any network based access that you install later on (openssh-server, vncserver, remote-X11, ...)
+
<pre><nowiki>
+
sudo xm console edgy-guest </nowiki></pre>
+
 
+
Use '''crtl + ]''' to get out of console.
+
 
+
If you logged in via '''putty''' use '''ctrl + 5''' to leave the domu-console.
+
 
+
 
+
=== Using FluxBox on domU guest OS ===
+
 
+
* Get console/ or ssh on gust (domU) machine
+
 
+
* Install the X packages (I've installed the ubuntu-desktop to get all dependencies, but GNOME don't work for me)
+
<pre><nowiki>
+
# apt-get install ubuntu-desktop </nowiki></pre>
+
 
+
* Install the fluxbox
+
<pre><nowiki>
+
# apt-get install fluxbox </nowiki></pre>
+
 
+
* Install the vncserver (make sure that you have repositories like universe and multiverse!)
+
<pre><nowiki>
+
# apt-get install vncserver </nowiki></pre>
+
 
+
* Configure the fuxbox to start as default for you user:
+
<pre><nowiki>
+
$ cat ~/.xsession
+
exec fluxbox </nowiki></pre>
+
 
+
* Configure and start the VNCServer as common user
+
<pre><nowiki>
+
$ vncpasswd
+
$ vncserver </nowiki></pre>
+
 
+
* Get out of domU (or go to another machine), and connect using vncviewer using DISPLAY 1:
+
<pre><nowiki>
+
$ vncviewer 192.168.44.247:1 </nowiki></pre>
+
 
+
* To kill one VNCServer:
+
<pre><nowiki>
+
$ vncserver -kill :1 </nowiki></pre>
+
 
+
=== Using GNOME on domU guest OS ===
+
 
+
Now I'm able to get gnome running as guest OS, doing some dirty tricks :)
+
 
+
** Configure GDM to start VNC, editing the `/etc/X11/gdm/gdm.conf`
+
 
+
Under [servers] heading, add this line, and comment out others like it:
+
 
+
<pre><nowiki>
+
0=VNC </nowiki></pre>
+
 
+
Before the [server-Standard] section, add:
+
 
+
<pre><nowiki>
+
[server-VNC]
+
name=VNC server
+
command=/usr/bin/Xvnc -geometry 800x600 -depth 24
+
flexible=true </nowiki></pre>
+
 
+
More info: http://wiki.xensource.com/xenwiki/XenDemoLaptop
+
 
+
** Try to up Xvnc "on hand" and fix all the errors:
+
 
+
<code><nowiki> /usr/bin/Xvnc -geometry 800x600 -depth 24 </nowiki></code>
+
 
+
Some errors that I've found:
+
 
+
` Fatal server error: could not open default font 'fixed' `
+
 
+
Solution:
+
<pre><nowiki>
+
cd /usr/X11R6/lib/X11/fonts
+
mkfontdir misc </nowiki></pre>
+
 
+
And anothers erros with fonts. I've read that ''"Current VNC releases are built against the XFree86 X server.  Recent versions of Xorg, as used by Fedora Core 6, have changed the locations of a few files, although I'm not sure why"''
+
 
+
So, I did a lot of links on `/usr/X11R6/lib/X11/fonts` pointing to one real path that vncserver was expecting:
+
 
+
<pre><nowiki>
+
lrwxrwxrwx 1 root root  28 2007-03-30 15:19 100dpi -> /usr/share/fonts/X11/100dpi/
+
drwxr-xr-x 2 root root 4.0K 2007-03-30 15:20 75dpi
+
drwxr-xr-x 3 root root 4.0K 2007-03-29 09:38 encodings
+
-rw-r--r-- 1 root root  33 2007-03-30 14:30 fonts.cache-1
+
drwxr-xr-x 2 root root  20K 2007-03-30 15:07 misc
+
lrwxrwxrwx 1 root root  26 2007-03-30 15:21 Speedo -> /usr/share/fonts/X11/misc/
+
lrwxrwxrwx 1 root root  27 2007-03-30 15:18 Type1 -> /usr/share/fonts/X11/Type1/
+
</nowiki></pre>
+
 
+
More information:
+
 
+
http://www.mail-archive.com/[email protected]/msg24961.html
+
 
+
http://openvz.org/pipermail/users/2007-January/000521.html
+
 
+
After this, just start gdm and get the session using display 0 like:
+
 
+
<pre><nowiki>
+
vncviewer 192.168.44.247:0 </nowiki></pre>
+
 
+
This is not the better way, but was working :)
+
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月21日 (三) 17:19的版本

This info has been merged into the main Xen wiki page at XenVirtualMachine