wiki:jazz/ClassCloud_LiveCD

Version 79 (modified by jazz, 12 years ago) (diff)

--

Building ClassCloud Live CD

ClassCloud-LiveCD : 基於 DRBL 的雲端教學環境

緣起

  • [緣起] 昨晚(2010-05-16)想了很久,或許開始動手寫 code 比規劃半天有用。本想用 Chromium OS 來改,因為它也是基於 Ubuntu / Debian 系列,不過看了 penk 的 xPUD 火力展示:全世界最小的 Chromium OS (58MB),並考量可能會需要一些 base system 跟 firefox 中鑲嵌 terminal 的需求,決定還是用 xPUDmkxpud 來作好了。

2010-05-17

xPUD

  • 測試環境:Debian GNU/Linux 5.0.4 (lenny)
    jazz@Wdebian:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 5.0.4 (lenny)
    Release:        5.0.4
    Codename:       lenny
    
  • 取得 xPUD mkxpud 原始碼 - (1) 先安裝 git (注意套件名稱是 git-core 不是 git 喔!!) (2) 從 github 下載原始碼
    jazz@Wdebian:~$ sudo apt-get install git-core
    jazz@Wdebian:~$ git clone git://github.com/penk/mkxpud.git
    
  • 由於會使用到 mksqushfs 跟 mkiofs 指令,因此就必須安裝 squashfs-tools 與 mkisofs 兩個套件。另外,因為會用到 ttf-droid 套件,只有 Ubuntu 有包,Debian 沒有,所以就只好從 Ubuntu 借了。
    jazz@Wdebian:~$ http://mirrors.kernel.org/ubuntu/pool/universe/t/ttf-droid/ttf-droid_1.00~b112+dfsg+1-0ubuntu1_all.deb
    jazz@Wdebian:~$ dpkg -i ttf-droid_1.00~b112+dfsg+1-0ubuntu1_all.deb
    jazz@Wdebian:~$ sudo apt-get install squashfs-tools mkisofs
    jazz@Wdebian:~$ cd mkxpud/
    jazz@Wdebian:~/mkxpud$ sudo ./tools/mkxpud all
    
  • [結果] 失敗!!! 看樣子 xPUD 的 mkxpud 一定得在 Ubuntu 系列執行才可以 :( - 沒仔細看文件的下場 ....
    To generate a xPUD image, you will need:
    
       1. a working Ubuntu 9.10 installation  <---------------- ㄜ!!!! 2.6.28.cookbook jaunty.cookbook xpud089.cookbook default.cookbook lucid.cookbook 都是 ubuntu 系列
       2. sudo permission to install packages on the host and testing
       3. Internet access to download packages (if required)
       4. at least 500MB of hard disk free space
    
  • 改到 Ubuntu 9.04 試試看~因為從 xpud.org 下載 xpud-2.6.31.2-mod.tgz 很慢,所以嘗試從 mirror site下載,並解開至 /lib/modules/2.6.31.2 這樣 mkxpud 的 script 才不會又下載一次。安裝 squshfs-tools 跟 genisoimage (mkisofs) 供產生 Live CD ROOTFS 與 ISO 檔用,安裝 qemu 供 mkxpud test 用,安裝 nsis 好像是為了產生 windows exe 安裝執行檔。
    jazz@jazzbook:~/mkxpud$ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 9.04
    Release:	9.04
    Codename:	jaunty
    jazz@jazzbook:~/mkxpud$ sudo apt-get install qemu squashfs-tools genisoimage nsis
    jazz@jazzbook:~/mkxpud$ sudo wget http://mesrss.free.fr/xpud/archive/xpud-2.6.31.2-mod.tgz -P skeleton/archive/
    jazz@jazzbook:~/mkxpud$ sudo tar xzf skeleton/archive/xpud-2.6.31.2-mod.tgz -C /
    jazz@jazzbook:~/mkxpud$ sudo ./tools/mkxpud all
    

DRBL-Live

  • 好吧,那改試一下先前搞不定的 create-drbl-live 好了,今天總算看清楚文件,有幾個小細節要注意:
    • 要先裝 live helper 與 cdebootstrap (這兩個都要使用 DRBL patch 過的版本)才能使用
    • 下載 clonezilla live 1.2.2-31 (用 1.2.3-x 的版本還不能適用)
    • 也難怪以前老是弄不出來了 :(
  • 開始動作 - [參考] 2009-08-03 的紀錄 跟 進階課程的說明 『從無到有製作DRBL live
    ~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 5.0.4 (lenny)
    Release:        5.0.4
    Codename:       lenny
    ~$ echo "deb http://free.nchc.org.tw/drbl-core drbl live-unstable live-testing live-experimental live-stable stable testing unstable" > drbl.list
    ~$ sudo mv drbl.list /etc/apt/sources.list.d/
    ~$ sudo apt-get update
    ~$ wget http://drbl.nchc.org.tw/GPG-KEY-DRBL
    ~$ sudo apt-key add GPG-KEY-DRBL
    ~$ sudo apt-get update
    ~$ sudo apt-get -y install drbl clonezilla live-helper cdebootstrap zip
    ~$ sudo /opt/drbl/sbin/drblsrv -i
    ~$ sudo /opt/drbl/sbin/drblpush -i
    ~$ sudo /opt/drbl/sbin/create-drbl-live-by-pkg -m http://free.nchc.org.tw/debian -s http://free.nchc.org.tw/debian-security -e unstable
    
    • 根據 編譯時的錯誤訊息 可以知道最好還是跑過 drblsrv -i 跟 drblpush -i 之後再來產生 DRBL Live CD 才會正確。

2010-05-18

2010-05-19

  • 修正作法, 再試一次 create-drbl-live-by-pkg :
    ~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 5.0.4 (lenny)
    Release:        5.0.4
    Codename:       lenny
    ~$ echo "deb http://free.nchc.org.tw/drbl-core drbl stable" > drbl.list
    ~$ sudo mv drbl.list /etc/apt/sources.list.d/
    ~$ wget http://drbl.nchc.org.tw/GPG-KEY-DRBL
    ~$ sudo apt-key add GPG-KEY-DRBL
    ~$ sudo apt-get update
    ~$ sudo apt-get -y install drbl
    ~$ sudo /opt/drbl/sbin/drblsrv -i -c n -n n -m n -g n -k 2 -o 1
    ~$ echo "deb http://free.nchc.org.tw/drbl-core drbl live-unstable" > drbl-live.list
    ~$ sudo mv drbl-live.list /etc/apt/sources.list.d/
    ~$ sudo apt-get update
    ~$ sudo apt-get -y install live-helper cdebootstrap zip
    ~$ sudo /opt/drbl/sbin/create-drbl-live-by-pkg -m http://free.nchc.org.tw/debian -s http://free.nchc.org.tw/debian-security -e unstable
    
  • Yeah!! 成功了!!
    jazz@lenny:~$ ls
    drbl-live-xfce-20100519.iso  drbl-live-xfce-stage1-20100519.iso
    drbl-live-xfce-20100519.zip  GPG-KEY-DRBL
    

2010-05-21

  • 基於 create-drbl-live-by-pkg 開始嘗試加入 jdk, hadoop, xen hypervisor 套件....[失敗]
  • [原因] sun-java6-jdk 等套件必須選擇同意授權才能繼續安裝。(2010-05-30 解決)

2010-05-23

  • [文件] drbl-live 是用 live-helper 做的,所以相關語法可以參考 Debian Live Manual
  • 研究 live-helper 跟 create-drbl-live
    • lh_build 指令會執行三個 Stage,依序為 lh_bootstrap、lh_chroot 與 lh_binary
             lh_bootstrap - create the first stage by bootstrapping a basic debian system
             lh_chroot - create the second stage by customizing the chroot
             lh_binary - create the third stage by generating a binary image
      
    • 如果要用 live-helper 產生 live cd 並且用更多 apt 來源,可在 config/chroot_sources/ 加入 live.chroot 、 live.binary 跟對應的 gpg key 在 live.chroot.gpg 、live.binary.gpg
    • 要額外裝的套件,可以參考 /usr/share/live-helper/lists/ 底下的檔案。然後用 lh config --bootstrap-config FILE 來指定。預設是使用 /usr/share/live-helper/lists/standard
      LH_PACKAGES_LISTS="standard"
      
    • 要額外拷貝進 Live CD 的檔案,可放在 config/chroot_local-includes
    • 必須注意的是若跑過 lh_build 之後才更動 config/chroot_local-includes 的內容,必須下 lh_clean --chroot 把 chroot 目錄清除才能成功地更新檔案內容。當然最乾淨的做法是 lh_clean --purge 會全部清掉(除了 config 目錄外)
  • 撰寫 drbl-hadoop-live 測試程式 test-live-helper.sh [147][148]

2010-05-30

  • 解決 2010-05-21 的問題 - Debian / Ubuntu 如何在 shell script 裡面安裝 sun-java6-jdk 又不用選 yes 呢?!
    • [參考] Installing java non-interactively
    • 這裡提到用 debconf-set-selections 來設定一些參數,讓 sun-java*-* 不問授權的 yes,方法包括有寫檔跟沒寫檔的做法,個人覺得留言裡面的那個做法最帥了!!
      cat << EOF | /usr/bin/debconf-set-selections
      sun-java6-bin   shared/accepted-sun-dlj-v1-1    select true
      sun-java6-jdk   shared/accepted-sun-dlj-v1-1    select true
      sun-java6-jre   shared/accepted-sun-dlj-v1-1    select true
      EOF
      
    • 那麼如果以後遇到別的套件也有類似的問題該怎麼找參數呢?? 答案是用 debconf-get-selections 這個指令,首先必須安裝 debconf-utils 套件,然後執行 debconf-get-selections 再用 grep 用套件名稱找出可以改的參數。
      ~$ sudo debconf-get-selections | grep sun-java6
      sun-java6-jre	sun-java6-jre/stopthread	boolean	true
      sun-java6-bin	shared/accepted-sun-dlj-v1-1	boolean	true
      sun-java6-jre	shared/accepted-sun-dlj-v1-1	boolean	true
      sun-java6-jre	sun-java6-jre/jcepolicy	note	
      sun-java6-bin	shared/error-sun-dlj-v1-1	error	
      sun-java6-jre	shared/error-sun-dlj-v1-1	error	
      sun-java6-bin	shared/present-sun-dlj-v1-1	note	
      sun-java6-jre	shared/present-sun-dlj-v1-1	note	
      
    • 須注意的是原本參數是 boolean 格式,若要下給 debconf-set-selections 必須置換成 select 關鍵字喔!!
      ~$ sudo debconf-get-selections | grep sun-java6 | grep boolean | sed 's#boolean#select#g'
      sun-java6-bin   shared/accepted-sun-dlj-v1-1    select  true
      sun-java6-jdk   shared/accepted-sun-dlj-v1-1    select  true
      sun-java6-jre   shared/accepted-sun-dlj-v1-1    select  true
      sun-java6-jre   sun-java6-jre/stopthread        select  true
      

2010-06-25

  • 更新 drbl-hadoop-live 測試程式 test-live-helper.sh [149]
  • [備忘] lh config 的 --categories 參數只有在 1.0.3-2 有,2.0~a11-1drbl1 反而沒有
    jazz@lenny:~/drbl-hadoop-live$ dpkg -l live-helper
    要求=U:未知/I:安裝/R:刪除/P:清除/H:保留
    | 狀態=N:尚未/I:已安裝/C:設定檔/U:已解開/F:設定失敗/H:半安裝/W:待處理/T:未處理
    |/ 錯誤?=(無)/H:保留/R:須重新安裝/X:兩者兼有(狀態,錯誤:大寫=有問題)
    ||/ 名稱           版本           簡介
    +++-================-================-================================================
    ii  live-helper      1.0.3-2          Debian Live build scripts
    
    
    jazz@lenny:~/drbl-hadoop-live$ sudo lh config --help | grep "cat"
                [--iso-application NAME]
                [--categories CATEGORY|"CATEGORIES"]
    
    jazz@Wdebian:~$ dpkg -l live-helper
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ 名稱           版本           簡介
    +++-================-================-================================================
    ii  live-helper      2.0~a11-1drbl1   Debian Live build scripts
    
    jazz@Wdebian:~$ sudo lh config --help | grep "cat"
    [sudo] password for jazz:
                [--iso-application NAME]
    
  • 由於 live-helper 會產生 .stage 的檔案,所以可以用時間戳記來了解 live-helper 的大致工作流程(workflow)
    jazz@lenny:~/drbl-hadoop-live/.stage$ ls --full-time * | sort -n
    -rw-r--r-- 1 root root 0 2010-06-26 09:40:34.000000000 +0800 config
    -rw-r--r-- 1 root root 0 2010-06-26 09:42:44.000000000 +0800 bootstrap
    -rw-r--r-- 1 root root 0 2010-06-26 09:42:45.000000000 +0800 bootstrap_cache.save
    -rw-r--r-- 1 root root 0 2010-06-26 09:43:05.000000000 +0800 chroot_packageslists
    -rw-r--r-- 1 root root 0 2010-06-26 09:43:06.000000000 +0800 chroot_packages
    -rw-r--r-- 1 root root 0 2010-06-26 09:45:58.000000000 +0800 chroot_install-packages
    -rw-r--r-- 1 root root 0 2010-06-26 09:46:02.000000000 +0800 chroot_localization
    -rw-r--r-- 1 root root 0 2010-06-26 09:46:05.000000000 +0800 chroot_hacks
    -rw-r--r-- 1 root root 0 2010-06-26 09:46:30.000000000 +0800 binary_chroot
    -rw-r--r-- 1 root root 0 2010-06-26 09:46:41.000000000 +0800 chroot_apt
    -rw-r--r-- 1 root root 0 2010-06-26 09:48:51.000000000 +0800 binary_rootfs
    -rw-r--r-- 1 root root 0 2010-06-26 09:48:52.000000000 +0800 binary_manifest
    -rw-r--r-- 1 root root 0 2010-06-26 09:48:53.000000000 +0800 binary_linux-image
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:00.000000000 +0800 binary_memtest
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:07.000000000 +0800 binary_syslinux
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:08.000000000 +0800 binary_disk
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:08.000000000 +0800 binary_win32-loader
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:09.000000000 +0800 binary_includes
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:11.000000000 +0800 binary_md5sum
    -rw-r--r-- 1 root root 0 2010-06-26 09:49:17.000000000 +0800 binary_iso
    

2010-06-28

  • 整理 live-helper stage 產生順序,以釐清各階段怎麼執行。 GraphViz image
  • 更新 drbl-hadoop-live 測試程式 test-live-helper.sh [150]
  • lenny 5.0.5 測試
    jazz@lenny:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 5.0.5 (lenny)
    Release:        5.0.5
    Codename:       lenny
    jazz@lenny:~$ sudo apt-get update; sudo apt-get upgrade
    jazz@lenny:~$ sudo apt-get install live-helper subversion make
    jazz@lenny:~$ svn co https://trac.nchc.org.tw/svn/grid/drbl-hadoop-live
    jazz@lenny:~$ svn co http://trac.nchc.org.tw/pub/grid/drbl-hadoop-live
    jazz@lenny:~$ cd drbl-hadoop-live/
    jazz@lenny:~/drbl-hadoop-live$ make
    

2010-06-29

  • 測試 chroot-hook 與 binary-hook 的差異
  • 嘗試將安裝 java 的步驟加進 create-drbl-live-by-pkg

2010-06-30

2010-07-13

2010-07-16

  • 一直測不出來,原來 Makefile 順序寫錯 :(
  • 更新 create-hadoop-liveMakefile [154]
  • 終於成功地在 DRBL Live CD 加入 JDK 與 CDH2 了....有圖有真相!!
  • 下一步:模仿 drbl-live.sh 寫一隻 hadoop-live.sh 來佈署多台 DRBL Client as Hadoop tasktracker 跟 datanode

2010-07-19

2010-07-20

  • 加入預設單機執行(Single Node)的 hadoop 相關 service, 可是卻出現啟動時的錯誤訊息
  • 縱使是在 VM 裡面直接裝 CDH2 也一樣會有這樣的錯誤訊息,因此應該是 script 本身的問題(不該用相對路徑).

2010-07-31

  • 仔細去追原因應該是出在 hadoop-config.sh 的第 36 行
    jazz@lenny:~$ sudo /etc/rc2.d/S20hadoop-0.20-namenode start
    /usr/lib/hadoop-0.20/bin/hadoop-config.sh: line 36: cd: ../init.d: No such file or directory
    
    • hadoop-config.sh

      old new  
      2121
      2222this="$0"
      2323while [ -h "$this" ]; do
      24   ls=`ls -ld "$this"`
      25   link=`expr "$ls" : '.*-> \(.*\)$'`
      26   if expr "$link" : '.*/.*' > /dev/null; then
      27     this="$link"
      28   else
      29     this=`dirname "$this"`/"$link"
      30   fi
       24    this=`readlink -f $this`
      3125done
      3226
      3327# convert relative path to absolute path

2011-05-12

  • <TODO> 整合 DRBL-Virt 與 DRBL-ONE 的 Script 到 OpenNebula Access Driver
  • 從 OpenNebula 的 Libvirt API 1.4 文件 可以看到 libvirt 與 openneula 兩者的關聯性。所以 drbl-virt 與 drbl-one 如果後續要整合,應該是要了解 libvirt 的 opennebula driver 怎麼寫,或許 drbl-virt 必須能讓 libvirt opennebula driver 可以產生正確的無碟 VM configuration 檔。 (2011-05-12)
  • http://opennebula.org/_media/documentation:rel1.4:arch.jpg

2011-05-13

  • <TODO> 參考 Hadoop Cluster Setup on Debian Lenny 這篇文章,把 Hadoop 的 NameNode High Availability (HA) 實作一次。(加入 DRBD、Hearbeat等)
  • <註> 這篇文章居然連 Rack-aware 也寫了!!真是強者!!
    ~$ cat > /usr/local/bin/rack.py << “EOF”
    #!/usr/bin/env python
    
    ”’
    This script used by hadoop to determine network/rack topology.  It  
    should be specified in hadoop-site.xml via topology.script.file.name
    Property.
    
    topology.script.file.name
    /home/hadoop/topology.py
    
    ”’
    
    import sys 
    from string import join
    
    DEFAULT_RACK = ‘/default/rack0′;
    
    RACK_MAP = { ’10.4.0.1′ : ‘/datacenter1/rack1′,
    
    ’10.4.0.2′ : ‘/datacenter1/rack1′,
    
    ’10.4.0.3′ : ‘/datacenter1/rack1′,
    
    ’10.4.0.4′ : ‘/datacenter1/rack1′,
    ’10.4.0.5′ : ‘/datacenter1/rack1′,
    ’10.4.0.6′ : ‘/datacenter1/rack1′,
    
    ’10.4.0.250′ : ‘/datacenter1/rack1′,
    }
    
    if len(sys.argv)==1:
    print DEFAULT_RACK
    else:
    print join([RACK_MAP.get(i, DEFAULT_RACK) for i in sys.argv[1:]],” “)
    
    EOF
    
  • oVirt - https://fedorahosted.org/ovirt/wiki/Architecture
    • https://fedorahosted.org/ovirt/attachment/wiki/Architecture/Ovirt-node.png
    • https://fedorahosted.org/ovirt/attachment/wiki/Architecture/Ovirt-admin.png
    • https://fedorahosted.org/ovirt/attachment/wiki/Architecture/Ovirt-arch-logical-backend.png
    • https://fedorahosted.org/ovirt/attachment/wiki/Architecture/Ovirt-arch-logical-ipa.png
  • OpenStack Feature Matrix
  • IaaS 雲端服務的基礎架構,大致上具備的模組:(1) 儲存層(檔案系統、映像檔格式 Image)、(2) 網路層(Virtual Switch)、(3) 作業系統虛擬化(OS Virtualization)、(4)顯示虛擬化(類似 VDI,或至少 VNC)、(5) 身份認證(AAA)、(6) 狀態監控(Monitoring)

2011-06-16

  • 關於 DRBL Live 的參數 ocs_prerun
    Read and respond to this message at:
    https://sourceforge.net/projects/drbl/forums/forum/675794/topic/3655102
    By: steven_shiau
    
    If you assign "fake" IP addresses to other network cards, then when you click
    on the "Clonezilla server" icon, it should not ask you. Therefore you can make
    it by adding these in the boot parameters:
    ocs_prerun1="dhclient eth0" ocs_prerun2="ifconfig eth1 192.168.101.254"
    ocs_prerun3="ifconfig eth2 192.168.102.254"...
    
    Steven.
    

2012-09-28

  • Squeeze 6.0.5 測試
    jazz@squeeze:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Debian
    Description:	Debian GNU/Linux 6.0.5 (squeeze)
    Release:	6.0.5
    Codename:	squeeze
    jazz@squeeze:~$ sudo apt-get update; sudo apt-get upgrade
    jazz@squeeze:~$ sudo apt-get install live-helper subversion make
    jazz@squeeze:~$ svn co https://trac.nchc.org.tw/svn/grid/drbl-hadoop-live
    jazz@squeeze:~$ svn co http://trac.nchc.org.tw/pub/grid/drbl-hadoop-live
    jazz@squeeze:~$ cd drbl-hadoop-live/
    jazz@squeeze:~/drbl-hadoop-live$ make
    

2012-10-27

  • mksquashfs 的環境變數 MKSQUASHFS_OPTIONS - 參考資料
    2012-10-25 02:08:15
    
    Before running mksquashfs, you can assign some environment variables:
    export MKSQUASHFS_OPTIONS="-b 1024k -comp xz -Xbcj x86 -e boot"
    Then your mksquashfs will honor that.
    This was the parameters used when creating GParted live.
    
    Steven.
    

Attachments (10)