星期六, 10月 29, 2011

20111029 VMware 研讀小記 -- vCenter


vCenter
  • 集中管理 ESXi 伺服器
  • 連線方式
    • vCenter Server 新增 Host 的時候, 會在 ESX Server 上安裝 vCenter Agent ( why need root auth )
      vCenter Agent 會建立 vpxa 的服務(port 902/903), 以及建立vpxuser 並設定相關權限
      透過 vpxa 與 hostd 溝通

      vSphere Client    ---- port 80 / 443 ---->  vCenter Server   --- 902 /903 ----> ESX Server (daemon: vpxa --> hostd ) 
  • Windows
    • vCenter Server 4.1 以後只支援 64位元的Windows OS
    • 在 VMware-VIMSetup-all-5.0.0-456005.iso 內
      • 與vCenter 4.1 差異, 會有FQDN 輸入選項
    • 資料庫
      • 支援 Microsoft SQL
      • Oracle 10g 11g
    • Port
      • default vCenter Server
        • HTTP:   80
          HTTPS: 443
          Heartbeat  (UDP):  902
          Web Service HTTP:   8080
          Web Service HTTPS:  8443
          Web Service Change Service Notification:60099
          LDAP:  389
          SSL:  636
      • default Inventory Service
        • HTTPS:  10443
          Service Managemant: 10109
          Linked Mode Communication: 10111
  • Linux
    • 有SLES 11 x86_64 for vCenter
      預設記憶體 8G, 但是實測至少要 3G 在測試database 才會正常
      https://主機IP:5480
      將這個三個檔案下載放在同一個目錄, 並開啟 ovf 檔案匯入VMware
      VMware-vCenter-Server-Appliance-5.0.0.3324-472350-data.vmdk
      VMware-vCenter-Server-Appliance-5.0.0.3324-472350-system.vmdk
      VMware-vCenter-Server-Appliance-5.0.0.3324-472350_OVF10.ovf
      預設帳號 root
      密碼 vmware
      database
      • embedded
        *Use the embedded database. This option is available only for a small inventory size, with fewer than 5 hosts and 50 virtual machines.
        oracle
        *Use an external Oracle database.
      Quick Start Guide
  • 單一vCenter 就使用standalone, 多vCenter 就使用 linked mode
  • Trouble Shotting
    • Cannot login
      • Check Windows Service
        • 檢查VMware VirtualCenter Management Webservices
          及 VMware VirtualCenter Service 是否已經啟動
  • DataCenter
    • 以地區或是WAN來劃分
      • 勿將不同樓層的機房分成=不同的datacenter
      • 不建議將跨WAN的ESX Server 歸在同一個datacenter 底下
  • 檢視模式
    • Hosts and Clusters View
    • VMs and Templates View
      • 專門檢視VM 及範本
      • 可以將不同ESX上的VM歸納與管理
    • Datastores and Datastores Clusters View
    • Networking View
    • tips
      • 可以在空白處按滑鼠右鍵切換
  • Documentation

星期五, 10月 28, 2011

20111028 wordnet 學習小記


wordnet
  • GUI of wordnet
    • artha
      Education/openSUSE_11.4

      Artha is a free cross-platform English thesaurus that works completely off-line and is based on WordNet. Stable releases for download are currently available for GNU/Linux and Microsoft Windows; it is tested on major Desktop Environments like GNOME, KDE, Xfce, etc and on Microsoft Windows XP, Vista and 7. Artha is released under the GNU General Public Licence version 2.
  • wordnet
    • openSUSE 可以藉由 one-click install 安裝
      http://software.opensuse.org/search?q=wordnet&baseproject=openSUSE%3A11.4&lang=zh_TW&exclude_debug=true
      可以藉由指令執行
      • 範例
        • # wn motorcar

          Information available for noun motorcar
          -hypen Hypernyms
          -hypon, -treen Hyponyms & Hyponym Tree
          -synsn Synonyms (ordered by estimated frequency)
          -partn Has Part Meronyms
          -meron All Meronyms
          -domtn Domain Terms
          -famln Familiarity & Polysemy Count
          -coorn Coordinate Terms (sisters)
          -hmern Hierarchical Meronyms
          -grepn List of Compound Words
          -over Overview of Senses

          No information available for verb motorcar

          No information available for adj motorcar

          No information available for adv motorcar

          • 會列出不同詞性有沒有相關
          #wn motorcar -hypen

          Synonyms/Hypernyms (Ordered by Estimated Frequency) of noun motorcar

          1 sense of motorcar                                                   

          Sense 1
          car, auto, automobile, machine, motorcar
                 => motor vehicle, automotive vehicle
                     => self-propelled vehicle
                         => wheeled vehicle
                             => vehicle
                                 => conveyance, transport
                                     => instrumentality, instrumentation
                                         => artifact, artefact
                                             => whole, unit
                                                 => object, physical object
                                                     => physical entity
                                                         => entity
                             => container
                                 => instrumentality, instrumentation
                                     => artifact, artefact
                                         => whole, unit
                                             => object, physical object
                                                 => physical entity
                                                     => entity
      • hypernyms 上位詞
        • -hypen
      • hyponyms 下位詞
        • -hypon
      • synonyms 同義詞
  • 透過瀏覽器執行
    • 在python內

      >>> import  nltk
      >>> nltk.app.wordnet()
      • 會呼叫瀏覽器, 在 localhost:8000 上面執行

星期四, 10月 27, 2011

20111027 python-nltk 學習小記


phthon-nltk
  • NLTK -- the Natural Language Toolkit -- is a suite of open source Python modules, data sets and tutorials supporting research and development in Natural Language Processing.
    官方網站
    http://www.nltk.org/

    工程計算要先from math import *

    Getting Started with NLTK
    • >>>from __future__ import division
      • 使用浮點數的用法
      >>> import nltk
      >>> nltk.download()

      • 下載 Collection 標籤內 Book 的套件
      • 會下載到 ~/nltk_data
      NLTK Book with Oreilly
      http://www.nltk.org/book

      >>> from nltk.book import *
      This says "from NLTK's book module, load all items.
      • 當結束完 python
        啟動新的 python 都要
        import nltk
        from  nltk.book  import  *
      找字
      • .concordance()
        • text1.concordance("monstrous")
      計算句子(或文章)的字(或token)數
      • len()
        • >>> stt=['I', 'want', 'to', 'go', 'home', '.']
          >>> len(stt)
          6

      顯示不同token
      • set()
        • >>> stt=['I', 'want', 'to', 'go', 'to','school']
          >>> set(stt)
          set(['I', 'to', 'school', 'go', 'want'])
      計算token出現頻率
      • >>> len(stt)/len(set(stt))
        1.2
      排序
      • sorted()
        • >>> sorted(set(stt))
          ['I', 'go', 'school', 'to', 'want']
      計算某token發生次數
      • .count()
        • >>> st='I want to go home.'
          >>> st
          'I want to go home.'
          >>> st.count('t')
          2

          >>> stt
          ['I', 'want', 'to', 'go', 'to', 'school']
          >>> stt.count('to')
          2
      找出token在list的位置
      • .index()
        • >>> stt
          ['I', 'want', 'to', 'go', 'to', 'school']
          >>> stt.index('to')
          2
          >>> stt.index('I')
          0
      取出在list特定位置的token
      • >>> stt
        ['I', 'want', 'to', 'go', 'to', 'school']
        >>> stt[1]
        'want'
        >>> stt[1:3]
        ['want', 'to']
        >>> stt[1:]
        ['want', 'to', 'go', 'to', 'school']
        >>> stt[:3]
        ['I', 'want', 'to']

        • 1:3 只取出 1,2
          1: 從 1 取到最後
          :3 從0 取到2
      string轉成list
      • .split()
        • >>> st='I want to go home.'
          >>> st
          'I want to go home.'
          >>> st.split()
          ['I', 'want', 'to', 'go', 'home.']
      list 轉成 string
      • .join()
        • >>> stt
          ['I', 'want', 'to', 'go', 'to', 'school']
          >>> ''.join(stt)
          'Iwanttogotoschool'
          >>> ' '.join(stt)
          'I want to go to school'
          >>> ','.join(stt)
          'I,want,to,go,to,school'

          • 可以指定轉接符號

星期二, 10月 25, 2011

SLES 10 Samba Server with Windows Server 驗證小記

之前本來就想找個時間來 Lab 一下 Samba with Windows AD 驗證
但是沒有充足的時間

這兩天撥一點時間出來Lab
如果是 SUSE Linux Enterprise Server 沒有套件升級的版本
那建議使用 SUSE Linux Enterprise Server SP4 ( 這個在VMware 內也支援 easy install, 但是安裝出來的內容太陽春)

要讓 SUSE 簡單的加入網域, 只要安裝 yast2 samba-client 套件即可

在安裝的過程當中會要求兩個套件
samba-winbind
krb5-client

(前提是 DNS 的指向最好指向 Windows AD)

在 YaST 控制台內, 選取 網路服務 --> 選取 --> Windows 領域成員

輸入 網域名稱
勾選 Use SMB Information for Linux Authentication ( 也可以考慮勾選相關次選項)
點選確定 -->  輸入 Windows 相關帳號 ( Administrator ) 以及密碼, 就可以加入 Domain


這個時候重新開機就會出現, Local 或是 網域的選項

Samba Server 的部份
由於已經加入網域認証
這個時候會發現 Windows Client 已經可以使用 Domain User account 登入 samba

但是當Client 要使用 檔案總管編輯 NTFS Permission ( 安全性 標籤)的時候, 卻沒有辦法編輯

這個時候 file system 上面必須支援 acl 的mount option
然後 該 samba share 的分享選項內有
nt acl support = yes


這樣就可以支援 以檔案總管的方式修改相關權限


現記下來


Enjoy it~


Reference:


SUSE Linux Enterprise Server 10 Doc
http://www.novell.com/documentation/sles10/book_sle_reference/?page=/documentation/sles10/book_sle_reference/data/part_services.html

Junji’s Blog Site
http://aisalen.wordpress.com/2007/08/10/acls-on-samba/


Benjr.tw

http://benjr.tw/node/151






星期六, 10月 15, 2011

20111015 VMware 研讀小記



虛擬化
  • Ring 0 要交給 VMM (Virtual Machine Monitor)
  • 全虛擬化 (Full Virutalizaion)
    • VMware 採用 Binary Translation
      • 透過 VMM攔截OS中不能被虛擬化的指令, 作二進位轉譯的替換動作, OS認為自己可以直接掌控硬體
    • OS 不用做任何的修改,直接安裝就可以使用
  • 半虛擬化(Para Virtualization)
    • Citrix XenServer
    • Microsoft 的 Hyper-V
    • 修改 OS 的核心, 植入 Hyper call
      • 讓不能被虛擬化的指令(nonvirtualizable instructions),藉由Hyper call interface 直接對硬體提出請求
    • 優點是 CPU  I/O 耗損到最低
  • CPU 硬體輔助虛擬化 (Hardware Assisted Virtualizaion)
    • AMD / Intel CPU 著手 建立 Root mode 等級(有人稱為 Ring -1)
      VMM 放置在 Ring -1
      這樣 OS 就可以放在 Ring 0
      • Intel VT-x  /  AMD-V
      不需要以前的 Binary Translation, 或是 Para Virtualizaion
  • Why Server Virtualizaion?
    • 伺服器統合 (Server consolidation)
      • 實體伺服器使用率偏低
      • 整併老舊低使用率實體伺服器 ( via P2V)
    • 靈活的資源調派
      • 動態調配資源給VM
        • vMotion
          • 在不同實體機器進行移轉
        • DRS
          • 自動尋找閒置有足夠資源的實體機器
    • 快速大量佈署
      • 透過 Template 來建立 VM
    • 增加可用度與備份回復
      • 較不需考慮硬體相容性問題
  • + VMware 硬體支援清單
  • Hypervisor
    • 掌控硬體資源的微核心(Micro Kernel)
    • Type 1
      • Bare-metal
        • 直接於實雞佈署Hypervisor, 又稱為Native VM
        • VMware ESX
        • Citrix XenServer
        • Micorsoft Hyper-V
    • Type 2
      • 以應用程式的方式呈現虛擬化, 要安裝在OS上面,又稱為Hosted VM
      • VMware Workstaition / VMware Server
      • Microsoft Virtual Server

星期五, 10月 14, 2011

VMware 啟動失敗小記

今天要啟動 VMware 的時候出現下面的錯誤訊息

process 5284: Attempt to remove filter function 0xb7485fb0 user data 0x823a2e8, but no such filter has been added
  D-Bus not built with -rdynamic so unable to print a backtrace

查了一下網路是 HAL daemon沒有啟動的問題
解決方法 啟動  haldaemon

#/etc/init.d/haldaemon   start


查了一下不知道為何預設沒有啟動

將他設定開機啟動應該就 oK
# ls -l    `which rchal` lrwxrwxrwx 1 root root 21 Oct  9 22:24 /usr/sbin/rchal -> /etc/init.d/haldaemon

# chkconfig   haldaemon   --list  
haldaemon                 0:off  1:off  2:off  3:off  4:off  5:off  6:off

# chkconfig   haldaemon    on


先記下來




星期四, 10月 13, 2011

20111012 Perl 學習小記



Perl
  • 觀察perl 版本
    • #perl  -v
    擅長
    • 三分鐘內寫出急就章( quick-and-dirty ) 程式)
    • 處理 90%與文字處理有關, 10%與其他事務有關
    不適合
    • 封閉式的二元執行檔 ( opaque binary )
      • 取得或是購得程式的人不知道原始碼的內容
    編輯器
    • Unix
      • emacs
      • vi
    • Windows
      • UltraEdit
      • PFE (Programmer's Favorite Edit)
    • Mac
      • BBEdit
      • TextMate
    本身是溯寫字,先有 Perl 這個字才有全文,
    不是縮寫字, 這也是不需要全部大寫的原因
    • 實用析取與報告語言 Practical Extraction and Report Language
    • 病態折衷式廢話製表器 Pathologically Eclectic Rubbish Lister
    CPAN
    • 綜合典藏網 Comprehensive Perl Archive Network
    • 非常方便的Perl賣場
    相關文件/資源
    tips
    • 使用 use 5.010 告訴 Perl 想要使用新功能
      • 版本編號一定要3位數, 且存在
    • 註解
      • 使用 #
      • 沒有註解區塊
    • 程式內不需要有變數宣告區段
    • #perl-doc 指令 需要安裝 perl-doc 套件


星期三, 10月 12, 2011

VMware ESXi 新增 具有管理權限的使用者


在VMware  ESXi 內 預設的權限有
  • Administrator
  • Read-Only
    • 至少要有 Read-Only 才能登入 ESXi Server
  • No Access
    • 如果都不指派權限, 等於是 No Access

所以如果要指派一個使用者給予管理者 root 的權限

建立一個帳號給予administrator 權限
  • 作法1
    • 建立一個使用者 
      • 於 Local Users and Groups 標籤 --> 按滑鼠右鍵 Add
      • 輸入使用者的帳號/密碼 --> 點選 OK
    • 給予administrator 權限 
      • 於 Permissions 標籤 --> 按滑鼠右鍵 Add Permission
      • 點選 Add
      • 輸入或是選取使用者  --> 點選 Add  --> 點選 OK
      • 選取該使用者, 下拉右方 Assigned Role 選單 --> 選取 Administrator
      • 點選 OK

  • 作法2
    • 建立一個群組
      • 於 Local Users and Groups 標籤 --> 點選 View 上面的 Groups (預設是 Users)
      • 按滑鼠右鍵 Add
      • 輸入 群組名稱
      • 將使用者加入到該群組
      • 點選 OK
    • 給予administrator 權限
      • 於 Permissions 標籤 --> 按滑鼠右鍵 Add Permission
      • 點選 Add
      • 輸入或是選取群組  --> 點選 Add  --> 點選 OK 
      • 選取該使用者, 下拉右方 Assigned Role 選單 --> 選取 Administrator
      • 點選 OK
    • 注意事項
      • 被納入群組的使用者不能有被設定其他的權限 ( Read-Only or No Access)
        • 權限是取其嚴
        • 所以如果有設定該使用者權限為 Read-only 或是 No Access就算該群組有 administrator 權限, 也是 Read-Only

    enjoy it ~

    星期二, 10月 04, 2011

    extundelete -- a utility that can recover deleted files from an ext3 or ext4 partition.

    在  ext3 或是 ext4 上面復原的軟體
    雖然不見得能夠 100 % 還原, 但是可以當成是一種解法

    extundelete 是參考 ext3grep 的一個專案, 來還原已經被刪除的檔案

    官方網站

    http://extundelete.sourceforge.net/


    extundelete is a utility that can recover deleted files from an ext3 or ext4 partition. The ext3 file system is the most common file system when using Linux, and ext4 is its successor. extundelete uses the information stored in the partition's journal to attempt to recover a file that has been deleted from the partition. There is no guarantee that any particular file will be able to be undeleted, so always try to have a good backup system in place, or at least put one in place after recovering your files!

    安裝

    可以從官方網站下載  source code 安裝
    http://sourceforge.net/projects/extundelete/files/extundelete/0.2.0/extundelete-0.2.0.tar.bz2/download


    當然也可以透過 openSUSE one click install 來進行單鍵安裝

    http://software.opensuse.org/search?q=extundelete&baseproject=openSUSE%3A11.4&lang=zh_TW&include_home=true



    作法

    假設要還原的資料在 /data
    可以嘗試 刪除測試用的檔案

    先 umount 該磁區 例如資料在  /dev/sdb1 掛載於  /data

    簡單的方式 可以使用 --restore-all 的方式來進行
    這個時候 extundelete 會在目前的目錄下建立一個 RECOVERED_FILES 目錄

    #extundelete   /dev/sdb1   --restore-all

    再到 RECOVERED_FILES 目錄尋找相關檔案即可

    如果不想還原全部, 也可以使用   --restor-file 指定 某個檔案

    #extundelete /dev/sdb1 --restore-file ineshome.tar.gz


    再到 RECOVERED_FILES 目錄尋找相關檔案即可


    enjoy it ~