当前位置:首页 » 操作系统 » kvmlinux

kvmlinux

发布时间: 2022-01-08 20:22:01

1. linux里的KVM

http://sourceforge.net/projects/kvm/files/qemu-kvm/0.14.0/qemu-kvm-0.14.0.tar.gz/download?_test=goal

2. LINUX的XEN和KVM到底区别在什么地方

目前为止,虚拟技术的老大仍然是VMware,虽然被EMC收购,名义上是EMC的老二,但事实上由于技术的牛X,老二不是很摆老大,当然这只是聊天的话,不做为事实依据。

一、KVM简介

KVM是一个全虚拟化的解决方案。可以在x86架构的计算机上实现虚拟化功能。但KVM需要CPU中虚拟化功能的支持,只可在具有虚拟化支持的CPU上运行,即具有VT功能的Intel CPU和具有AMD-V功能的AMD CPU。

Xen与KVM的比较

Xen是Linux下的一个虚拟化解决方案,但由于被Citrix收购后,变成了和红帽企业版一样了,卖服务收取费用,Redhat从rhel6.0开始已经从内核中把XEN踢出去了,全心投入开发免费的KVM,虽然市场上老用户还在用Xen,但相信kvm会逐步占领大面积的市场,必竟有redhat做为强大支持源。

Xen的实现方法是运行支持Xen功能的kernel,这个kernel是工作在Xen的控制之下,叫做Domain0,使用这个kernel启动机器后,你可以在这个机器上使用qemu软件,虚拟出多个系统。Xen的缺点是如果你需要更新Xen的版本,你需要重新编译整个内核,而且,稍有设置不慎,系统就无法启动。

相比较,KVM就简化的多了。它不需要重新编译内核,也不需要对当前kernel做任何修改,它只是几个可以动态加载的.ko模块。它结构更加精简、代码量更小。所以,出错的可能性更小。并且在某些方面,性能比Xen更胜一筹。

二、KVM的使用

现在以Turbolinux 11版本为基础,介绍KVM的使用方法。

在安装之前,你需要先确认,你的CPU是否支持虚拟化技术,执行:

# egrep '^flags.*(vmx|svm)' /proc/cpuinfo

如果有输出返回,则表示你的CPU支持虚拟化技术。

1.KVM的安装

从官方网站下载KVM源码包:http://kvm.qumranet.com
我们使用KVM-33版本

# tar zxf kvm-33.tar.gz
# cd kvm-33
# ./configure --prefix=/usr/local/kvm-33
# make
# make install

make install后,kvm的模块会安装到/lib/moles/$KernelVersion/extra/目录下。其他相关文件会安装到/usr/local/kvm-33/目录下。

将kvm相关目录连接到系统目录中

# ln -s /usr/local/kvm-33/bin/* /usr/bin/
# ln -s /usr/local/kvm-33/lib/* /usr/lib/
(若为x86_64系统,则执行: ln -s /usr/local/kvm-33/lib64/* /usr/lib64/)
# ln -s /usr/local/kvm-33/include/kvmctl.h /usr/include/
# ln -s /usr/local/kvm-33/include/linux/* /usr/include/linux/
# ln -s /usr/local/kvm-33/share/qemu /usr/share/

2.KVM的使用

a.你需要先建立一个映像文件作为虚拟系统的硬盘

# mkdir /images
# cd /images
# /usr/bin/qemu-img -f qcow gtes11.img 20G

b.创建网络配置脚本

# echo ’/sbin/ifconfig $1 10.0.1.1 netmask 255.255.255.0’ > /etc/qemu-ifup

c.加载KVM模块

Intel CPU使用:
# modprobe kvm-intel
AMD CPU使用:
# modprobe kvm-amd

d.安装虚拟系统

# /usr/bin/qemu-i386 -m 512 -k en-us -M pc -hda /images/gtes11.img -cdrom /iso/zuma-SP3-rc3-6-\
disc1-20061031.iso -net nic,vlan=1,model=rtl8139,macaddr=00:00:00:00:99:01 -net tap,vlan=1,ifname=tap0,\
script=/etc/qemu-ifup -vnc localhost:1 -boot d

在另一个终端执行:

# vncviewer localhost:1

参数分析:

我们为虚拟系统分配512MB内存。使用gtes11.img作为它的第一块硬盘,使用Turbolinux10.5的disc1作为它的光盘。
并从光盘引导。它有一块rtl8139的网卡,MAC地址为:00:00:00:00:99:01,并把这个网卡与主机的tap0接口连接。
tap0接口使用/etc/qemu-ifup脚本进行初始化。虚拟系统的输出作为一个vnc服务器,绑定在主机的localhost:1上。

注:

1.若为x86_64系统,则使用/usr/bin/qemu-system-x86_64代替qemu-i386

2.在64位系统上,可以安装32位和64位的虚拟系统。但在32位系统上,只能安装32位的虚拟系统。

qemu参数介绍:

-da 映像文件:使用映像文件作为虚拟系统的第一块硬盘。同样还可以使用hdb、hdc、hdd指定第2、3、4块硬盘。
-drom 光盘映像文件:使用光盘映像文件作为虚拟系统的光盘。
-oot [a|c|d|n]:设置虚拟系统的引导顺序。a为软驱、c为硬盘、d为光驱、n为网络。
- 内存大小:设置虚拟系统使用的内存大小,单位为MB。
- 语言:设置虚拟系统键盘类型。
-et nic[,vlan=n][,macaddr=addr][,model=type]
建立一个虚拟网卡,并把它连接到VLAN的n端口上。
-net tap[,vlan=n][,fd=h][,ifname=name][,script=file]

把主机的TAP网络接口连接到VLAN的n端口上,并使用script指定的脚本进行初始化。

3. linux系统中一个kvm的虚拟机也哪种方式运行

kvm就是个软件,可以在命令行执行,也可以在桌面环境找到位置双击打开。

4. linux 如何卸载kvm虚拟机。

找到该虚机的文件位置,删除映像文件和配置文件就可以了

5. VMware和kvm哪个作为linux的虚拟机更好

这个不可能吧 程序正在运行 修改参数恐怕是不能成功的这就像程序还在运行 你要删除这个程序 必须得结束这个程序的进程 否则程序不能被删除

6. Linux上虚拟机Xen和KVM哪个更强

KVM需要首先检查下你的cpu是否支持intel的VT虚拟化,或者amd的SVM 虚拟化技术
XEN则不需要, 从技术上来讲 KVM比较先进 也更强 不过XEN已经行之多年, 解决方案等比较成熟
安装kvm方面 首先
cat /proc/cupinfo 如果在flags现有显示vt 或者svm.下面的步骤就没有继续下去的意义了,否则就是浪费时间

下面的以amd的cpu为例
1,准备你的系统里必须有以下这些包
gcc-3.4 libsdl1.2-dev zlib1g-dev libasound2-dev linux-kernel-headers pkg-config libgnutls-dev(这事debian的包机制,只供其他的发行版参考)
2,切换gcc版本(如果你的gcc版本已经是gcc3.x 就没有必要继续了)
cd /usr/bin
sudo mv gcc gcc.bak
sudo ln -s gcc-3.4 gcc
3.下载kvm-realease.tar.gz包
wget http://nchc.dl.sourceforge.net/sourceforge/kvm/kvm-59.tar.gz
4,安装
tar xzf kvm-59.tar.gz
cd kvm-release
./configure --prefix=/usr/local/kvm
make
sudo make install

sudo /sbin/modprobe kvm-amd

ok 这就装好了, 用qemu或者virtualbox玩玩吧

7. linux怎样启动远程kvm图形界面

使用VNC软件:

Linux下VNC配置详解,以下配置为配置VNC详细介绍。并解决了用VNC View登入发现画面是灰色的问题
1. Linux下VNC的配置
首先在Linux的add/remove applications中的system tools下面安装VNC-server服务安装完成后直接输入vncserver 会出现以下内容:
passwd: //只有这个帐号是第一次运行vncserver,才会要求你输入连接的密码。
verify:
New 'server1.linux:4 (demo)' desktop is server1.linux:1
Starting applications specified in /home/.vnc/xstartup
Log file is /home/.vnc/server1.linux:1.log
上面这段话表示起动了一个图形终端,编号为1,要记住这个编号,等下登录时需要提供这个编号。第一次启动VNC一定要先直接输入vncserver。如果你要停止这个进程,使用命令
vncserver -kill :1
启动后就可以在客户端上面输入IP加刚才提到的那个编号即可登陆机器(xxx.xxx.xxx.xxx:1) 看到一个灰色的Xwindow桌面但上面什么也没有
运行过一次VNSERVER后会在HOME目录下面生成一个.VNC文件夹(在开始启动的时候可看到该文件夹的位置)注:该目录为隐藏,可直接输入路径进入。修改xstartup文件,去掉unset SESSION_MANAGER 和exec /etc/X11/xinit/xinitrc 前面的注释符号,将最后一行twm & 改成 gnome-session &
vi /root/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER //此行注释去掉
# exec /etc/X11/xinit/xinitrc //此行注释去掉
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm & //改成 gnome-session &
重新启动VNCSERVER即可
2、VNC的启动/停止/重启
#service vncserver start/stop/restart
关闭具体的vncserver命令:
vncserver -kill :1
vncserver -kill :2
3、设置密码
#vncpasswd
4、客户端登陆
在vnc客户端中输入:服务器端IP:1或服务器端IP:2
5、设置登陆到KDE桌面
注:很多情况下,提示VNC无法连接,或者提示10086错误都是没有修改vncservers文件的问题,所以编辑该文件修改
# VNCSERVERS="1:myusername"
# VNCSERVERARGS[1]="-geometry 800x600"
这两行问题一般都可以解决。
a.
[root@CentOS ~]# vi /etc/sysconfig/vncservers
# # Uncomment the line below to start a VNC server on display :1 # as my 'myusername' (adjust this to your own). You will also # need to set a VNC password; run 'man vncpasswd' to see how # to do that. # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, see # <URL:>.http://www.uk.research.att.com/vnc/sshvnc.html
# VNCSERVERS="1:myusername"
VNCSERVERS="1:root"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[1]=”-geometry 800×600 -alwaysshared -depth 24″
-alwaysshared代表允许多用户同时登录 -depth代为色深,参数有8,16,24,32。
注:红色部分就是被修改或增加的部分
b.
[root@centos .vnc]$ vi /root/.vnc/xstartup #!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #gnome-session & #set starting GNOME desktop startkde &#kde desktop
#twm &
#Text interface
注:红色部分就是被修改或增加的部分
c.
重启VNC即可。
vnc安装 Oracle:
出现错误提示:“Xlib: connection to ":1.0" refused by server”
如下处理:
实用技巧:在Linux下设置xhost方法步骤
source:http://www.knowsky.com/397544.html
第一步:用root登陆linux,启动vnc服务;
第二步:根据vnc起来的端口,设置export DISPLAY=localhost:1(1表示vnc在第一个tty上启动的),vnc的启动信息见附件1;
第三步:执行xhost +,并且提示“access control disabled, clients can connect from any host”才正确。
Linux下的操作日志如下:
[root@localhost ~]# vncserverNew 'localhost:1 (root)' desktop is localhost:1Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost:1.log[root@localhost ~]# export DISPLAY=localhost:1 [root@localhost ~]# xhost +access control disabled, clients can connect from any host
在设置xhost时,出现了unable的问题。
使用上诉方法就可以搞定。
一下为我以root身份登录的配置文件
[root@PC-223-CE ~]# vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/vnc/sshvnc.html>.
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600"
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600 -alwaysshared -depth 24"
~
[root@PC-223-CE ~]# vi /root/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
xrdb $HOME/.Xresources
# [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
# [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
# vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# twm &
gnome-session &
~
更改完后保存,重新启动VNC即可
3.多个用户登录
linux的VNC可以实现多个用户同时链接.方法如下
su 用户名
vncserver (这里就是第二个用户了)
第三个用户是
su 用户名
vncserver
添加完后需要在/etc/sysconfig/vncserver里面添加这个用户,不然就会出现登录后都是灰色的
另外还需要 修改用户目录下的.vnc/xstartup文件
例:我的电脑上已经有一个root用户,此时我还需要ocmSUSEr这个用户可以VNC登录
[root@linuxidc~]# su ocmsuser
[ocmsuser@linuxidcroot]$ vncserver
You will require a password to access your desktops.
Password:
Verify:
New 'ywei:2 (ocmsuser)' desktop is ywei:2
Creating default startup script /home/ocmsuser/.vnc/xstartup
Starting applications specified in /home/ocmsuser/.vnc/xstartup
Log file is /home/ocmsuser/.vnc/ywei:2.log
[ocmsuser@linuxidcroot]$ su - root
Password:
[root@linuxidc~]# vi /etc/sysconfig/vncservers
The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1280x800 -alwaysshared -depth 24"
VNCSERVERS="2:ocmsuser"
VNCSERVERARGS[2]="-geometry 1280x800 -alwaysshared -depth 24"
~
[root@linuxidc~]# cat /root/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
[root@linuxidc~]# cat /home/ocmsuser/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
[root@linuxidc~]# cp /home/ocmsuser/.vnc/xstartup /home/ocmsuser/.vnc/xstartup.bak
[root@linuxidc~]# cp /root/.vnc/xstartup /home/ocmsuser/.vnc/xstartup
cp: overwrite `/home/ocmsuser/.vnc/xstartup'? yes
[root@linuxidc~]# service vncserver restart
Shutting down VNC server: 2:ocmsuser [ OK ]
Starting VNC server: 2:ocmsuser
New 'ywei:2 (ocmsuser)' desktop is ywei:2
Starting applications specified in /home/ocmsuser/.vnc/xstartup
Log file is /home/ocmsuser/.vnc/ywei:2.log
[ OK ]

8. kvm 所在的宿主必须是linux桌面环境么

是的,kvm只能运行在linux宿主机上面。他是linux核心的一部分。

9. Linux中如何加载kvm模块

KVM需要支持VT的CPU,看看你的CPU支持。方法:cat
/proc/cpuinfo
|grep
flags
看看里面有没有
VT
(intel的cpu)
AMD的标志我忘了。你找找

热点内容
socket编程php 发布:2024-05-03 20:12:50 浏览:207
坦洲邮政局可以解压吗 发布:2024-05-03 20:09:55 浏览:731
二级程序编译答案 发布:2024-05-03 18:41:35 浏览:654
领动自动精英版是哪个配置 发布:2024-05-03 18:37:30 浏览:151
java编译器中cd什么意思 发布:2024-05-03 18:36:00 浏览:390
传奇服务器如何刷钱 发布:2024-05-03 18:36:00 浏览:978
安卓版twitter怎么注册 发布:2024-05-03 18:28:05 浏览:894
Python逻辑优先级 发布:2024-05-03 18:26:14 浏览:268
linux查看svn密码 发布:2024-05-03 18:12:47 浏览:805
地铁逃生怎么进入游戏安卓 发布:2024-05-03 17:49:35 浏览:993