个人工具

“UbuntuHelp:XenOnUbuntuBinaryInstall”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/XenOnUbuntuBinaryInstall}} {{Languages|UbuntuHelp:XenOnUbuntuBinaryInstall}} NOTE: This document appears to be newer, https://wiki.ubuntu.com/Xen...)
 
(正在重定向到 UbuntuHelp:XenVirtualMachine
 
(未显示2个用户的3个中间版本)
第1行: 第1行:
 +
#REDIRECT [[UbuntuHelp:XenVirtualMachine]]
 +
All of this info was merged into the [[UbuntuHelp:XenVirtualMachine|XenVirtualMachine]] page.
 
{{From|https://help.ubuntu.com/community/XenOnUbuntuBinaryInstall}}
 
{{From|https://help.ubuntu.com/community/XenOnUbuntuBinaryInstall}}
 
{{Languages|UbuntuHelp:XenOnUbuntuBinaryInstall}}
 
{{Languages|UbuntuHelp:XenOnUbuntuBinaryInstall}}
 
NOTE: This document appears to be newer, https://wiki.ubuntu.com/XenOnEdgy
 
 
== Overview ==
 
 
This How To describes the installation of Xen Prebuilt Binaries for Ubuntu (works with Breezy and Dapper). More How-To's listed at the bottom describe other ways, including the more complex building of the Xen kernel. This how-to presumes a second hard disk (hdb) where the lvm will reside. You may easily format and partition your single hard drive to use lvm, and modify the how-to accordingly.
 
 
This begins with a clean install, server configuration (no GUI), and installs the prebuilt kernel and other binaries required to run Xen 3.0.
 
 
== Installing Ubuntu ==
 
Boot to the Ubuntu install cd, and type/select <code><nowiki>server</nowiki></code> to install a minimal OS with no GUI. While Reiser FS is considered faster, some people have had problems running [http://lists.xensource.com/archives/html/xen-users/2006-02/msg00466.html Xen and Reiser], so ext3 (the default)  or xfs may be a better choice.
 
 
Choose default options, leaving the second hard drive untouched, finish the installation, and login.
 
 
=== Configuring the system ===
 
 
All commands here are sudo; you may type <code><nowiki>sudo -s</nowiki></code> to switch to sudo for this session.
 
 
<pre><nowiki>apt-get update
 
apt-get upgrade
 
apt-get install iproute python python-twisted bridge-utils</nowiki></pre>
 
 
If you have problems connecting, check NetworkNotEnabled to see if your ethernet card is activated.
 
 
Download the Tarballed Pre-built installations of Xen 3.0 (you'll probably choose 'for 32 bit') from [http://www.xensource.com/xen/downloads/ XenSource]. Untar it, changing the command so version numbers match, with
 
 
<code><nowiki>tar xvf xen-3.0.2-install-x86_32.tgz</nowiki></code>
 
 
In the untared xen directory, type <code><nowiki>sh install.sh</nowiki></code>
 
 
Check for error messages - it should say OK to all.
 
 
<code><nowiki>/sbin/depmod -a 2.6.16-xen</nowiki></code> (change this line if needed to match what is in your /lib/modules)
 
 
<code><nowiki>cd /boot/grub</nowiki></code>
 
 
Edit using your favorite text editor, edit menu.lst, placing the following lines BEFORE the Automagic section (check your /boot folder to see if the following lines point to the correct files):
 
 
<pre><nowiki>title Xen 3.0 / XenLinux 2.6
 
kernel /boot/xen-3.gz dom0_mem=128M
 
module /boot/vmlinuz-2.6-xen root=/dev/hda1 ro</nowiki></pre>
 
 
Reboot!
 
 
NOTE: If you are using SCSI drives, or any that need to load drivers before the file system is accessed, you will need a new initrd image.
 
 
<pre><nowiki>
 
cd /boot
 
mkinitramfs -o initrd.img-2.6.16-xen 2.6.16-xen
 
</nowiki></pre>
 
 
Then, in menu.lst under your already entered module line, place:
 
 
<pre><nowiki>
 
module /boot/initrd.img-2.6.16-xen
 
</nowiki></pre>
 
 
NOTE: if you get the message "Error 15: File not found" when you boot, then try changing menu.lst to the following:
 
 
<pre><nowiki>title Xen 3.0 / XenLinux 2.6
 
kernel /xen-3.gz dom0_mem=128M
 
module /vmlinuz-2.6-xen root=/dev/hda1 ro</nowiki></pre>
 
 
NOTE: if you are using SATA drives, you may have a kernel panic error message. This appears to be due to the limited set of drivers that come with the Xen pre-built kernel. This appears to affect Xen 3.0.2 but not 2.0.7
 
 
Check your kernel by typing <code><nowiki>uname -r</nowiki></code> and you should see <code><nowiki>2.6.16-xen</nowiki></code>.
 
 
=== /lib/tls error ===
 
If you receive a large warning message during boot-up about /lib/tls, you may do one of the following:
 
* <code><nowiki>mv /lib/tls /lib/tls.disabled</nowiki></code> (easy, but the issue may crop up again after an upgrade)
 
* [http://wiki.xensource.com/xenwiki/DebianTlsLibcDiversion Divert Xen using a Script] (This makes sure upgrades don't put /lib/tls back again.
 
 
Note: Disabling /lib/tls gives significantly poor performance for glibc. Find a way to install a Xen-friendly glibc. Removing /lib/tls is disabling the thread-local storage (tls) handling features of glibc by hiding them.
 
 
=== libcrypto error ===
 
 
If when starting xend, you get the error: blktapctrl: error while loading shared libraries: libcrypto.so.0.9.7: cannot open shared object file: No such file or directory
 
Figure out the version of libcrypto you have:
 
 
<code><nowiki>ls /usr/lib/libcrypto.so.*</nowiki></code>
 
 
for example :
 
 
/usr/lib/libcrypto.so.0.9.8
 
 
Make a symbolic link to it:
 
 
<code><nowiki>ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.0.9.7</nowiki></code>
 
 
 
=== Dom0 Xorg nvidia ===
 
If you are trying to install xen on a Ubuntu Desktop machine, Xorg with original nvidia drivers will fail. You can try to follow this tutorial: [[UbuntuHelp:XenVirtualMachine/NVidiaOnXenOnUbuntuEdgy]].
 
 
=== Ubuntu Specific Configurations ===
 
If you want to have xend start automatically, update your init.d by entering the following commands:
 
<pre><nowiki>update-rc.d xend defaults 20 21
 
update-rc.d xendomains defaults 21 20</nowiki></pre>
 
 
[http://lists.xensource.com/archives/html/xen-users/2006-04/msg00574.html Peter Fokkinga] suggests modifying /etc/init.d/xend, adding these lines near the beginning of the file (after the "grep -q ..." block)
 
 
<pre><nowiki># on Ubuntu (Debian too?) /var/run/xenstored does not exist after reboot
 
if [ ! -d /var/run/xenstored ] ; then
 
mkdir /var/run/xenstored
 
fi</nowiki></pre>
 
 
and in /etc/init.d/xendomains, change
 
<code><nowiki>LOCKFILE=/var/lock/subsys/xendomains</nowiki></code>
 
to
 
<code><nowiki>LOCKFILE=/var/lock/xendomains</nowiki></code>
 
 
Is xen running properly? Type <code><nowiki>xm list</nowiki></code> and you should see <code><nowiki>Domain-0</nowiki></code>; if not, reboot and double check.
 
 
You may need to add an initrd line to your grub config. See [http://wiki.xensource.com/xenwiki/InstallationNotes?highlight=%28grub%29 here] and [http://wiki.xensource.com/xenwiki/GettingStarted?highlight=%28initrd%29 and here] for details. (Question - can someone tell me when I would need to do this? Does it depend on hardware?)
 
 
== Further Tasks ==
 
==== Unneccesary packages ====
 
Some people suggest uninstalling unneccesary packages. You may choose to uninstall
 
 
<code><nowiki>apt-get remove ppp pppconfig pppoeconf</nowiki></code>
 
 
==== LVM ====
 
You can [http://www.faqs.org/docs/Linux-mini/Partition.html partition and format] the remaining free space, and then use lvm to create logical volumes using [http://wiki.xensource.com/xenwiki/DebianDomU Xen-LVM How-To].
 
 
(partial, untested information)
 
 
Presuming your lvm partitions are <code><nowiki>/dev/xen_lvm/dom1</nowiki></code> and <code><nowiki>/dev/xen_lvm/dom1_swap</nowiki></code>
 
<pre><nowiki>mkfs.ext3 /dev/xen_lvm/dom1
 
mkswap -f /dev/xen_lvm/dom1_swap
 
mkdir /xen
 
mount -t ext3 /dev/xen_lvm/dom1 /xen</nowiki></pre>
 
 
You can now run debootstrap and install Ubuntu or Debian to /xen
 
 
== Installing DomU w/ debootstrap (Partially Tested: please add any additional steps you had to take here) ==
 
 
First, setup and configure lvm, create an ext3 and swap partition in lvm, and mount your lvm partition to /xen.
 
 
<code><nowiki>apt-get install debootstrap</nowiki></code>
 
 
I prefer to install from CD, as it's faster. Mount your CD-Rom to /media/cdrom, and mount your future domU root partition to /xen
 
 
<pre><nowiki>
 
debootstrap dapper /xen file:/media/cdrom</nowiki></pre>
 
 
You should see lots of I: messages, and finally the prompt. Change directories to the root directory of your new filesystem.
 
 
=== Xen configuration options ===
 
 
Using your favorite editor (back in Dom0), create /etc/xen/dom1.cfg with the following text
 
 
<pre><nowiki>kernel = "/boot/vmlinuz-2.6-xen"
 
memory = 128
 
name = "dom1"
 
vif = [ '' ]
 
dhcp = "dhcp"
 
disk = ['phy:/dev/xen_lvm/dom1,hda1,w','phy:/dev/xen_lvm/dom1_swap,hdb1,w']
 
root = "/dev/hda1 ro"
 
extra = "4"
 
</nowiki></pre>
 
 
=== Start the DomU machine ===
 
 
<code><nowiki>xm create dom1.cfg -c</nowiki></code>
 
 
Ignore any <code><nowiki>modprobe: FATAL: Could not load /lib/modules/2.6.16-xen/modules.dep</nowiki></code> errors, they are [http://www.quantact.com/forums/viewtopic.php?t=87&sid=bc7dddfadd3f403231ad4541037bcbbf harmless]
 
 
Login with root, no password (you want to change that!)
 
 
=== Changes Necessary on the DomU's Filesystem ===
 
<code><nowiki>mv ./lib/tls ./lib/tls.disabled</nowiki></code>
 
 
in ./etc/network/interfaces (change the relevant numbers)
 
<pre><nowiki>auto lo
 
iface lo inet loopback
 
 
auto eth0
 
iface eth0 inet static
 
address 192.168.3.101
 
netmask 255.255.255.0
 
network 192.168.3.0
 
broadcast 192.168.3.255
 
gateway 192.168.3.1
 
# dns-* options are implemented by the resolvconf package, if installed
 
dns-nameservers 1.2.3.4 1.2.3.5</nowiki></pre>
 
 
 
Copy the Dom0's sources list: <code><nowiki>cp /etc/apt/sources.list ./etc/apt/sources.list</nowiki></code> and edit them if you wish.
 
 
 
In ./etc/fstab
 
 
<pre><nowiki># /fstab: static file system information.
 
#
 
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
 
proc            /proc          proc    defaults        0      0
 
/dev/hda1      /              ext3    defaults,errors=remount-ro 0      1
 
/dev/hdb1      none            swap    sw              0      0</nowiki></pre>
 
 
<code><nowiki>umount /dev/xen_lvm/dom1</nowiki></code> (we don't want two operating systems writing to the same partition!)
 
 
Locale setup:
 
 
The locale isn't set up properly by default. Resolve this by:
 
<pre><nowiki>
 
Install base packages for your language:
 
apt-get install language-pack-en-base
 
 
Install/Reconfigure localeconf via either:
 
apt-get install localeconf
 
dpkg-reconfigure localeconf
 
 
*** Manage locale configuration files with debconf? -> yes
 
*** Please select the default system locale. -> Your locale. Mine is en_US ISO-8859-1 for example.
 
*** Select the environment settings that should override the default locale.  -> Select All
 
*** In the following dialogs always select what you set for your locale above.
 
 
Install/reconfigure locales:
 
apt-get install locales
 
dpkg-reconfigure locales
 
 
*** Here, use the same locale you used in the localeconf setup.
 
</nowiki></pre>
 
 
Setting up your hostname:
 
 
<pre><nowiki>
 
Manually edit /etc/hostname with your domU hostname.
 
Manually edit /etc/hosts (If you used debootstrap, you need to set this file up from scratch.)
 
(set the 127.0.0.1 host in /etc/hosts to sync with the host in /etc/hostname)
 
</nowiki></pre>
 
 
 
At this point you want to set up sshd, so you can log into your new virtual machine remotely!
 
You are ready!
 
 
== Additional Information ==
 
 
Below are some links to other pages from which I derived this method.
 
** [http://www.xensource.com/xen/documentation/ The Xensource Documentation]
 
** The [http://www.xensource.com/files/xen_user_manual.pdf Xen User's Manual], from that page
 
** XenVirtualMachine/XenOnUbuntuBreezy
 
** XenVirtualMachine/XenOnUbuntuHoary, which explains how to do the same with Ubuntu 5.04.
 
** [http://wiki.xensource.com/xenwiki/InstallationNotes Installation notes]
 
 
[[category:CategoryDocumentation]]
 
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年4月23日 (三) 12:07的最新版本

All of this info was merged into the XenVirtualMachine page.