未分類

虛擬伺服器 Xen 實作教學 for CenOS5

如下圖,之後你就可以看到熟悉的開始安裝畫面

因為要網路安裝,所以我們必須先幫它設定好網路

基本上就是設定在同一個區域網路中,或者設定到可以連得到外面的網路安裝位置即可

接下來跳出來的畫面就是圖形介面的安裝畫面了,你可以按照自己原本的習慣安裝這台電腦了

但是如上的安裝方式會使用得安裝過程太吃記憶體,會變得很慢,我比較建議使用文字介面的方式來安裝

文字介面安裝方式:
如下,在 console 中執行 virt-install,接著該填入的欄位與圖形介面安裝差不多
# virt-install
What is the name of your virtual machine? <– vm1
How much RAM should be allocated (in megabytes)? <– 200
What would you like to use as the disk (path)? <– /vm/vm1.img
How large would you like the disk (/vm/vm01.img) to be (in gigabytes)? <– 4
Would you like to enable graphics support? (yes or no) <– no
What is the install location? <– http://192.168.1.101/fedora8

接下來你會看到的就是一連串的文字介面的網路安裝畫面,其實透過 sshd 從遠端 login 進去安裝也可以喔,以下這些步驟都跟之前大同小異,我就省略掉。


14 thoughts on “虛擬伺服器 Xen 實作教學 for CenOS5

  1. 請問一下, 依照你的方法

    # mount /dev/cdrom /media/
    mount: block device /dev/cdrom is write-protected, mounting read-only

    把 cdrom 的資料利用捷徑的方式連結到 http 的網路空間中,取名為 fedora8
    # ln -s /media/ /var/www/html/fedora8

    使用 http://192.168.1.5/fedora/ 會出現 403 error無存取權限
    若使用 http://192.168.1.5/ 是可看到預設內建centos網頁
    /dev/cdrom 的權限是 root , /media 也是 root
    要如何才分享到 /dev/cdrom 內的資料

  2. 應該是被SELinux擋住了, 你可以
    # setenforce 0
    把SELinux暫存關閉再試試

    或者
    # vi /etc/sysconfig/selinux
    SELINUX=disabled
    永遠關閉SELinux

  3. 實在是太神了
    把 SELINUX 關掉就好了

    # vi /etc/sysconfig/selinux
    SELINUX=disabled

    您可能要把上面那一小段加到你的文章內
    因我是安裝 centos 5.1 有安裝預設的 xen, 全部用預設安裝,然後就依這你這份文件來設定,在關掉SELINUX 之前我花了很多時間在設定 httpd.conf 文件

    不過 xen 可以連到 http://192.168.1.5/cdrom/ 內容 但是會出現錯誤無法安裝OS
    錯誤內容有空再貼上來

  4. 問一下
    我下載 ubuntu-7.10-desktop-i386.iso 將檔案 掛載
    mount -o loop -t iso9660 ubuntu-7.10-desktop-i386.iso /media/
    再將 media link 到 /varr/www/html/ubuntu
    ln -s /media/ /var/www/html/ubuntu
    在 xen 的開機光碟設定位置設為
    http://192.168.1.5/ubuntu
    其餘設定如你教學所示
    出現錯誤如下
    Unable to complete install ‘exceptions.RuntimeError Could not find an installable distribution the install location
    Traceback (most recent call last):
    File “/usr/share/virt-manager/virtManager/create.py”, line 681, in do_install
    dom = guest.start_install(False, meter = meter)
    File “/usr/lib/python2.4/site-packages/virtinst/Guest.py”, line 647, in start_install
    tmpfiles = self._prepare_install_location(meter)
    File “/usr/lib/python2.4/site-packages/virtinst/ParaVirtGuest.py”, line 65, in _prepare_install_location
    (kernelfn,initrdfn,args) = DistroManager.acquireKernel(self.location, meter, scratchdir=self.scratchdir, type=self.type)
    File “/usr/lib/python2.4/site-packages/virtinst/DistroManager.py”, line 570, in acquireKernel
    progresscb=progresscb, distro=distro, scratchdir=scratchdir)
    File “/usr/lib/python2.4/site-packages/virtinst/DistroManager.py”, line 559, in _storeForDistro
    raise RuntimeError, “Could not find an installable distribution the install location”
    RuntimeError: Could not find an installable distribution the install location

    還有我掛 windows xp 的開機光碟也是一樣有錯誤

  5. 請問一下大大,我不小心把Domain-0給刪除了,現在變成無法新增vm了,有辦法可把原始的Domain-0給建出來嗎?謝謝了

  6. 我看了一下 Domain-0,預設好像沒有辦法刪除的,如果你真的弄丟了的話,如果是我,我會用原來的kernel版本開機,開完機後再裝一次Xen你先試看看。

  7. 站大,新年快樂,

    可以請教你一下嗎?
    你那個base的系統,是怎分配空間的嗎?

    因為一般我在裝centos時,
    swap給2倍ram的大小、var和usr都設定5G、boot給100mb、其他給home.

    想問說像要裝vm,
    這樣base是要怎麼分配比較好呢?

    謝謝你囉

  8. 請問一下有辦法直接mount已經create好的image file嗎?
    我現在有一個 ooxx.img 這樣的檔案
    可以直接放入硬碟中然後使用xen來執行嗎?

  9. 請問一下,我在debian lenny 5.04上安裝xen之後,再安裝windows xp,但是當我下了
    xm create -c winxp
    之後,就一直停留在
    started domain winxp
    使用xm list可看到,winxp這個domain u是有在執行的
    這是怎麼回事呢?

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *