动手构建云计算(2)--xen 的安装使用 (在slc5.5 上)

slc5.5是cern基于scientific linux 和 rhel5X开发的。

在lxc002,lxc003上安装xen作为虚拟机的hypervisor

1.安装xen:

 

yum install xen
yum install virt-manager
yum install virt-viewer

#编辑grub,设置default=0

vi /boot/grub/menu.lst

reboot

#重启后查看内核,应该是2.6.*xen

 

uname -a

 

2.安装虚拟机

#创建虚拟机文件

 

dd if=/dev/zero of=/vm/vm-slc6x.img bs=1 count=1 seek=15G
#通过http方式安装slc6操作系统

 

 

virt-install --paravirt --name=vm-slc6x --ram=4096 --vcpus=1 --file=/vm/vm-slc6x.img -l http://mirror.****.ac.cn/slc/slc6X/i386


3. 管理虚拟机

 

Common 'xm' commands:

 console              Attach to <Domain>'s console.                     
 create               Create a domain based on <ConfigFile>.            
 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.                                  
 restore              Restore a domain from a saved state.              
 save                 Save a domain state to restore later.             
 shutdown             Shutdown a domain.                                
 trigger              Send a trigger to a domain.                       
 top                  Monitor a host and the domains in real time.      
 unpause              Unpause a paused domain.                          
 uptime               Print uptime for a domain.                        
 vcpu-set             Set the number of active VCPUs for allowed for the domain.

 

#xm list 查看虚拟机

Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0     7035    16 r-----   1229.6
vm-slc6x                                   7     4096     1 -b----     13.6

#xm console vm-slc6x 登陆虚拟机

#xm shutdown vm-slc6x 关闭虚拟机

 

#xm create vm-slc6x 启动虚拟机

 

 

posted @ 2011-02-15 11:54  Donal  阅读(433)  评论(0编辑  收藏  举报