labunix の ラボゆにっくす このページをアンテナに追加 RSSフィード Twitter

labunix の ラボゆにっくす
labunix の ラボUnix(はてなブログ)

2013/07/02 vmplayer内のWheezyにXenを導入 このエントリーを含むブックマーク このエントリーのブックマークコメント



$ echo "xen-linux-system-`uname -r` xen-utils-common xen-tools libvirt-bin uuid-runtime qemu-kvm" | \
  for list in `xargs`;do echo -n "$list,";apt-cache show "$list" | grep ^Descript | awk -F\: '{print $2}' | head -1;done
xen-linux-system-3.2.0-4-amd64, Xen system with Linux 3.2 on 64-bit PCs (meta-package)
xen-utils-common, Xen administrative tools - common files
xen-tools, Tools to manage Xen virtual servers
libvirt-bin, libvirt ライブラリ用のプログラム
uuid-runtime, runtime components for the Universally Unique ID library
qemu-kvm, x86 ハードウェアの完全仮想化


$ echo "xen-linux-system-`uname -r` xen-utils-common xen-tools libvirt-bin uuid-runtime qemu-kvm" | \
  sudo apt-get install -y `xargs`


$ echo "xen-linux-system-`uname -r` xen-utils-common xen-tools libvirt-bin uuid-runtime qemu-kvm" | \
  for list in `xargs`;do echo "[ $list ]";dpkg -L "$list" | grep bin/ | grep -v doc/;done
[ xen-linux-system-3.2.0-4-amd64 ]
[ xen-utils-common ]
[ xen-tools ]
[ libvirt-bin ]
[ uuid-runtime ]
[ qemu-kvm ]


$ grep "menuentry" /boot/grub/grub.cfg | nl -w2 -v0 | sed s/"--"/"\n\t&"/g
 0      menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64'
        --class debian
        --class gnu-linux
        --class gnu
        --class os {
 1      menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64 (recovery mode)'
        --class debian
        --class gnu-linux
        --class gnu
        --class os {
 2      menuentry 'Debian GNU/Linux, with Xen 4.1-amd64 and Linux 3.2.0-4-amd64'
        --class debian
        --class gnu-linux
        --class gnu
        --class os
        --class xen {
 3      menuentry 'Debian GNU/Linux, with Xen 4.1-amd64 and Linux 3.2.0-4-amd64 (recovery mode)'
        --class debian
        --class gnu-linux
        --class gnu
        --class os
        --class xen {

■「with Xen 4.1-amd64」を選択するように起動順序を変更。

$ uname -a
Linux vmdebian2 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux

$ ls /etc/grub.d/
00_header        10_linux      30_os-prober  41_custom
05_debian_theme  20_linux_xen  40_custom     README

$ sudo mv /etc/grub.d/10_linux /etc/grub.d/25_linux
$ sudo update-grub2
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
  No volume groups found

$ grep "menuentry\|linux.*boot\|multiboot" /boot/grub/grub.cfg | head -2 | sed s/"--"/"\n\t&"/g
menuentry 'Debian GNU/Linux, with Xen 4.1-amd64 and Linux 3.2.0-4-amd64'
        --class debian
        --class gnu-linux
        --class gnu
        --class os
        --class xen {
        multiboot       /boot/xen-4.1-amd64.gz placeholder

$ sudo shutdown -r now && exit


$ sudo grep -i "boot.*xen" /var/log/syslog
Jul  1 23:01:03 vmdebian1 kernel: [    0.000000] Booting paravirtualized kernel on Xen

$ lsmod | grep xen
xen_gntdev             13021  0
xen_evtchn             13012  1
xenfs                  17724  1

$ sudo xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   468     2     r-----     29.7


$ sudo /etc/xen/scripts/network-bridge status | grep ^bridge
bridge name     bridge id               STP enabled     interfaces
can't get info Operation not supported

$ grep "^(" /etc/xen/xend-config.sxp
(network-script network-bridge)
(vif-script vif-bridge)
(dom0-min-mem 196)
(enable-dom0-ballooning yes)
(total_available_memory 0)
(dom0-cpus 0)
(vncpasswd '')

$ sudo /etc/init.d/xen restart
[ ok ] Restarting Xen daemons: xend xend xenconsoled.


$ grep -v "^#\|^\$" /etc/xen-tools/xen-tools.conf
install-method = debootstrap
size   = 4Gb      # Disk image size.
memory = 128Mb    # Memory size
swap   = 128Mb    # Swap size
fs     = ext3     # use the EXT3 filesystem for the disk image.
dist   = `xt-guess-suite-and-mirror --suite` # Default distribution to install.
image  = sparse   # Specify sparse vs. full disk images.
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
mirror = `xt-guess-suite-and-mirror --mirror`
ext3_options     = noatime,nodiratime,errors=remount-ro
ext2_options     = noatime,nodiratime,errors=remount-ro
xfs_options      = defaults
reiserfs_options = defaults
btrfs_options    = defaults


$ grep wget /usr/sbin/debootstrap
      --verbose              don't turn off the output of wget

$ grep ^[hf].*_proxy /etc/wgetrc | sed s/"[0-9]"/"X"/g
https_proxy = http://XXX.XX.XX.XX:XXXX/
http_proxy = http://XXX.XX.XX.XX:XXXX/
ftp_proxy = http://XXX.XX.XX.XX:XXXX/


$ sudo xen-create-image --hostname vmvm2 \
  --ip --netmask --gateway \
  --passwd --dir /var/local

General Information
Hostname       :  vmvm2
Distribution   :  wheezy
Mirror         :  http://ftp.jp.debian.org/debian/
Partitions     :  swap            128Mb (swap)
                  /               4Gb   (ext3)
Image type     :  sparse
Memory size    :  128Mb
Kernel path    :  /boot/vmlinuz-3.2.0-4-amd64
Initrd path    :  /boot/initrd.img-3.2.0-4-amd64

Networking Information
IP Address 1   : [MAC: 00:16:3E:CB:CE:DB]
Netmask        :
Gateway        :

Creating partition image: /var/local/domains/vmvm2/swap.img

Creating swap on /var/local/domains/vmvm2/swap.img

Creating partition image: /var/local/domains/vmvm2/disk.img

Creating ext3 filesystem on /var/local/domains/vmvm2/disk.img
Installation method: debootstrap

Running hooks
No role scripts were specified.  Skipping
Setting up root password
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
All done

Logfile produced at:

Installation Summary
Hostname        :  vmvm2
Distribution    :  wheezy
IP-Address(es)  :
Root Password   :  N/A


$ sudo wc -l /var/log/xen-tools/vmvm2.log
1048 /var/log/xen-tools/vmvm2.log

$ find /var/local/domains/

$ ls -l /etc/xen/vmvm2.cfg
-rw-r--r-- 1 root root 733  71 23:52 /etc/xen/vmvm2.cfg

$ grep -v "^#\|^\$" /etc/xen/vmvm2.cfg
kernel      = '/boot/vmlinuz-3.2.0-4-amd64'
ramdisk     = '/boot/initrd.img-3.2.0-4-amd64'
vcpus       = '1'
memory      = '128'
root        = '/dev/xvda2 ro'
disk        = [
name        = 'vmvm2'
vif         = [ 'ip= ,mac00:16:3E:XX:XX:XX' ]
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'


$ sudo grep ^vif /etc/xen/vmvm2.cfg
vif         = [ 'ip= ,mac=00:16:3E:XX:XX:XX' ]
$ sudo sed -i s/"^vif.*[A-F0-9]"/"& ,bridge=eth0"/ /etc/xen/vmvm2.cfg
$ sudo sed -i s/"^vif.*"/"# &"/ /etc/xen/vmvm2.cfg
$ sudo grep vif /etc/xen/vmvm2.cfg
# vif         = [ 'ip= ,mac=00:16:3E:XX:XX:XX ,bridge=eth0' ]


$ sudo xm create /etc/xen/vmvm2.cfg -c
Using config file "/etc/xen/vmvm2.cfg".

Debian GNU/Linux 7 vmvm2 hvc0

vmvm2 login: root
Linux vmvm2 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.


$ sudo xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   372     2     r-----    372.3
vmvm2                                        6   128     1     -b----      5.9

 ネットワークが無いので、「xm shutdown」で落とす。

$ sudo xm shutdown vmvm2


$ sudo xm
Usage: xm <subcommand> [args]

Control, list, and manipulate Xen guest instances.

Common 'xm' commands:

 console              Attach to <Domain>'s console.
 vncviewer            Attach to <Domain>'s VNC server.
 create               Create a domain based on <ConfigFile>.
 new                  Adds a domain to Xend domain management
 delete               Remove a domain from Xend domain management.
 destroy              Terminate a domain immediately.
 dump-core            Dump core for a specific domain.
 help                 Display this message.
 list                 List information about all/some domains.
 mem-set              Set the current memory usage for a domain.
 migrate              Migrate a domain to another machine.
 pause                Pause execution of a domain.
 reboot               Reboot a domain.
 reset                Reset a domain.
 restore              Restore a domain from a saved state.
 resume               Resume a Xend managed domain
 save                 Save a domain state to restore later.
 shell                Launch an interactive shell.
 shutdown             Shutdown a domain.
 start                Start a Xend managed domain
 suspend              Suspend a Xend managed domain
 top                  Monitor a host and the domains in real time.
 unpause              Unpause a paused domain.
 uptime               Print uptime for all/some domains.
 usb-add              Add the usb device to FV VM.
 usb-del              Delete the usb device to FV VM.
 domstate             get the state of a domain
 vcpu-set             Set the number of active VCPUs for allowed for
                      the domain.

<Domain> can either be the Domain Name or Id.
For more help on 'xm' see the xm(1) man page.
For more help on 'xm create' see the xmdomain.cfg(5)  man page.

For a complete list of subcommands run 'xm help'.

labunix のラボゆにっくす <過去記事一覧> 閲覧回数:1429663



labunix の ラボゆにっくす

labunix のブックマーク

1. 【 awk 】コマンド(応用編その3)――テキストの加工とパターン処理、配列の活用:Linux基本コマンドTips(209) - @IT
2. 2018年5月第4週 アプリ開発を加速する「Android Jetpack」を発表:Android Weekly Topics|gihyo.jp … 技術評論社
3. セキュリティに特化したLinuxディストリビューション「Parrot 4.0」リリース | Think IT(シンクイット)
4. ASCII.jp:マカフィー、McAfee CWS最新バージョンでコンテナ対応を開始
5. F5ネットワークス、ボット対策などを強化した「Advanced WAF」 | ニコニコニュース
6. テラデータ、アナリティクスのクラウド移行に関する企業調査(結果発表):時事ドットコム
7. マカフィー、クラウドアプリへの一貫したセキュリティを徹底できるプログラムを発表:EnterpriseZine(エンタープライズジン)
8. デジタル変革で、メインフレームふたたび (1/2):EnterpriseZine(エンタープライズジン)
9. rsa-labs
10. JASDAQ平均は続落、下落率トップはソルガムHD/JASDAQ市況 | 市況 - 株探ニュース
11. (首相官邸)23日  :日本経済新聞
12. 「KPMGグローバルCEO調査2018」について - SankeiBiz(サンケイビズ)
13. 23日の安倍首相の動静  :日本経済新聞
14. GDPRの衝撃(2)施行によって何が変わるのか? 投稿日時: 2018/05/24 15:53[フィスコ] - みんなの株式 (みんかぶ)
15. 安全なパスワード作成は? 日本語をローマ字に:暮らし:中日新聞(CHUNICHI Web)
16. GDPRの衝撃(1)10年に一度訪れるかどうかの大きなオポチュニティ 投稿日時: 2018/05/24 09:43[フィスコ] - みんなの株式 (みんかぶ)
17. サイバーセキュリティクラウド、ウィルビーが提供する人材業界向けサイト構築パッケージ「Jobmaker」に製品協業開始 - SecurityInsight | セキュリティインサイト
18. 加計疑惑、改めて否定 5月23日(水)  :日本経済新聞
19. ネットワークベースのAIセキュリティを展開--ダークトレースが新体制 - ZDNet Japan
20. テラドローン、ドローン運行管理システムアプリと自動付帯保険サービスを提供 - 保険市場TIMES