葉潤安
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags: `1062`, `lsa` Kernel-based Virtual Machine === 參考資料: 1. [KVM 安裝步驟](https://blog.csdn.net/c80486/article/details/42836169) 2. [關於虛擬化](https://huangwei.me/wiki/tech_cloud_kvm_qemu_libvirt_openstack.html ) 3. [五分钟搞懂Xen、KVM、Qemu间的关系和区别](https://blog.csdn.net/YSBJ123/article/details/51166343) ## KVM的由来 - 最初是由以色列的公司Qumranet开发的 - 在2007年2月正式合并Linux2.6.20核心中,成为内核源代码的一部分 - 2008年9月4日,RedHat公司收购了Qumranet,开始在RHEL中用kvm取代Xen,第一包kvm的版本的是RHEL5.4。从RHEL6开始,kvm成为默认的虚拟化引擎。Kvm必须在具备IntelT或AMD-V功能的X86平台上运行 - 它也被移植到S/390、PowerPC与IA-64平台上 - 在Linux内核3.9版中,加入了对ARM架构的支持。 ### xen 和 kvm 比較 ||xen|kvm ---|---|--- 問世時間|2003|2007 支持架構|x86、IA64和AMD、Fujitsu、IBM、Sun等公司的ARM,以及x86/64 CPU商家和Intel嵌入式的支持|支持虛擬化的cpu 支持的虛擬化技術|全虛擬化,半虛擬化|全虛擬化 內核支持|需對內核打補丁|內置在內核中 特點|穩定,效能高|易使用 更新|重新編譯內核,易出錯|不需編譯及修改 ### 什麼是virtual machine? - 在一部主機上模擬出多部獨立的系統 ### 什麼是kernel-based virtual machine? - 當使用kvm時,系統會把kvm.ko掛載kernel上, - 具備kernel same-page merging(ksm)技術 - 只能對電腦主要元件 CPU、memory進行控制 virtualbox,vmware 類的虛擬機架構 ![](https://i.imgur.com/Kkat9Jh.png) kvm 架構 ![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Kernel-based_Virtual_Machine.svg/400px-Kernel-based_Virtual_Machine.svg.png) ## Why KVM ? - 比起virtualbox類的軟體,更加有效率([來比比看阿,不服跑分](https://github.com/LCTT/TranslateProject/blob/master/published/201312/Intel%20Haswell%20Linux%20Virtualization-%20KVM%20vs.%20Xen%20vs.%20VirtualBox.md)) - linux kernel 集成好了啊(高度整合) - 很贊的ksm - 掛模組的方式存在於系統中,不要的時候就卸載掉 ## [KVM 安裝步驟](https://blog.csdn.net/c80486/article/details/42836169) 1. 首先需要確認bios裡的intel virtualization 要打開才能用 (確認cpu支持硬體虛擬化) `egrep -o '(vmx|svm)' /proc/cpuinfo` 2. 安裝管理kvm的工具 `sudo apt-get install qemu-kvm qemu-system libvirt-bin` ### libvirt-bin 提供libvirtd套件使用libvirt管理qemu和kvm實例 ### qemu - 獨立的虛擬軟體,用来模拟CPU(IBM power,Intel pentium series),和其他電腦主要元件 - kvm只能提供核心功能,所以需要qemu來完善其他io,使他能夠成爲一個具備完整功能的虛擬機 - qemu例子 `qemu -m 512 -net nic,model=ne2k_pci -net nic,model=pcnet -soundhw ac97,pcspk -usb -parallel none -serial none -hda winxp.img -hdb h: -fda fdboot.img -cdrom bootcd.iso -rtc base=2009-01-01T16:00:21 -vnc 127.0.0.1:0 -net user,hostfwd=tcp::5555-:23 -boot menu=on` 3. 安裝virt-manager(虚拟机管理程序) `sudo apt-get install virt-manager python-spice-client-gtk` 4. 是否安裝成功 `kvm-ok` 5. 查看內核模塊是否掛載 `sudo lsmod | grep kvm` 若無則嘗試掛載一下 `sudo modprobe kvm` 6. 若出現virtual machine manager connection failure - 請確保libvirt有安裝 - 確認有的話,請重開機 8. 下載iso系統檔, 以ubuntu server爲例 `sudo iptables -t nat -I PREROUTING -p tcp -d 10.105.22.234 --dport 5555 -j DNAT --to 192.168.122.25:22` `sudo iptables -A FORWARD -p tcp -d 192.168.122.25 --dport 22 -j ACCEPT`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully