网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

linuxkvm命令 linux comm命令详解

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:.

# 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:

第一步:用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:;.

# 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:;.

# 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 ]

linux kvm怎么改镜像文件

制作镜像文件有三种方法,cp, cat, dd 和其它专用工具。cp ,cat 和 dd都可以从设备复制文件来创建镜像。而 dd 命令更为强大,可以通过指定块大小,块多少来直接创建镜像。

IMG 文件:

因为cp, cat 只能从设备来制作镜像,但又没有专用工具来做 IMG 文件,故这里用 dd 命令来制作 IMG 文件。

1,制作

dd if=/dev/zero of=fdimage.img count=2880

or

dd if=/dev/zero of=fdimage.img bs=1024 count=1440

2,格式化

mkfs.msdos fdimage.img

3,修改

可以用下面的命令 mount 后,可直接修改

mount -o loop *.img /mnt

4,可启动

因为制作可启动镜像一定会用到虚拟机,推荐用 Virtualbox,先到网上下个 DOS 启动盘来引导。用 DOS 的 sys 命令传递系统。推荐使用 FreeDOS,属自由软件。也可用 dd 命令 来传递引导引导信息,并复制启动启动时所需文件来做启动盘。以 FreeDOS 为例,传递启动信息用以下命令,其中下载的启动盘为 balder10.img 文件

dd if=balder10.img of=fdimage.img bs=512 count=1 conv=notrunc

多系统用 grub4dos,

1),用 grub.exe 引导多系统

2),安装 grub 到MBR,用 grldr 来引导多系统。当然也可用同上面一样的办法用 dd 直接写入引导信息。

bootlace.com --floppy --chs 0x00

注:才发现用 dd 命令只能从逻辑扇区开始 copy,先前我想可否用 dd 来将 grldr.mbr 写入 u 盘,我用自己的 U 盘试了,结果不能打开了。因为我的 U 盘为 fat16 格式,逻辑扇区开始是OBR,接着是FAT表,结果把 FAT1 表给盖了,那时还没有想到还有 FAT2 呢,就格了,现在想起来郁闷啊,好多东西都没有了。

为什么软盘可以呢,因为它就没有前面的63个扇区,直接从逻辑0扇区开始的。

ISO 文件:

因为文件系统的关系,就不能用 dd 来直接做 ISO 镜像了(当然,它还是可以从设备制作 ISO 镜像)。 ISO 文件的制作有专用工具,

1,制作

mkisofs -r -o cdimage.iso /home/XXX/cddir

2,格式化

用mkiso制作的 iso 已有文件系统 iso9660

3,可启动

无论是引导单系统还是引导多系统都还是用 mkisofs 这个工具,只是加载到光盘的 boot loader 不一样而已。当然也可以将 DOS 的引导器 (也就是它的引导扇区) 或 windows 的引导器 ( XP 系统的是 ntldr ) 放入让光盘引导。下面只讨论 grub4dos 的使用

1),用 grub.exe 引导多系统

用 DOS 加载 grub.exe 引导多系统

2),将 grub 安装到光盘 MBR

在制作时可用下面的命令直接生成可启动镜像,其中 grldr, menu.lst 要放在 cddir 目录下,也就是在 cd 根目录。

mkisofs -R -b grldr -no-emul-boot -boot-load-seg 0x1000 -o cdimage.iso cddir

mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o cdimage.iso cddir

PS,下面给出 dd 命令和 mkisofs 参数说明

dd (convert and copy files)

dd 是 Linux/UNIX 下的一个非常有用的命令,作用是用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换。

dd 的主要选项:

指定数字的地方若以下列字符结尾乘以相应的数字:

b=512, c=1, k=1024, w=2, xm=number m

if=file

输入文件名,缺省为标准输入。

of=file

输出文件名,缺省为标准输出。

ibs=bytes

一次读入 bytes 个字节(即一个块大小为 bytes 个字节)。

obs=bytes

一次写 bytes 个字节(即一个块大小为 bytes 个字节)。

bs=bytes

同时设置读写块的大小为 bytes ,可代替 ibs 和 obs 。

cbs=bytes

一次转换 bytes 个字节,即转换缓冲区大小。

skip=blocks

从输入文件开头跳过 blocks 个块后再开始复制。

KVM之一: linux如何配置console

The /usr/lib/systemd/system/getty@.service file is responsible for the virtual terminals (/dev/tty[X]). /usr/lib/systemd/system/serial-getty@.service is responsible for all other terminals, such as a serial terminal on /dev/ttyS0 .

Systemd provides a template unit file for serial getty. Template file can be found here /lib/systemd/system/serial-getty@.service

 There are many cloud platforms which are working in Linux virtualisation on back-end. In terms of connectivity we have better option in KVM, which connect it through serial console.

 In this post we would see how we could connect Ubuntu17.04 KVM Virtual machine through serial console. I remember in earlier version and distributions, it need to configure serial console in grub file, but in Ubuntu its very easy and reliable as most of configurations and settings are already configured in OS.

let’s see how things happened here …

 For this post, we are using Ubuntu-17.04 Guest Machine on Ubuntu-16.04 Host machine.

 How to setup serial console, for same we have to connect machine and login on as root user.

 We could connect on KVM Guest machine through SSH from Host Machine.

 We could connect Guest machine through VNC Viewer and could setup Serial console from there. Configuring and connecting VNC viewer posted here . This could be best option to connect Guest machine in any troubleshooting because it could configure without any network connectivity, this also make it same control which we have in serial console with Graphical User Interface from remote host.

 This is Graphical User interface on Host Machine. For this we should have access to Host Machine or Graphical desktop from remote through SSH or VNC.

 Above package should installed for this command. Like in below image we could connect KVM Guest machine.

 Configure a serial console in the Ubuntu guest

 After getting login console we need to start serial console and enable it with below two commands.

 Now we could connect serial console in easy way with virsh console command.

以下方法: 在centos6.5也适用


分享题目:linuxkvm命令 linux comm命令详解
本文路径:http://bjjierui.cn/article/docsdhp.html

其他资讯