0
点赞
收藏
分享

微信扫一扫

linux安装Vnc


安装Vnc**********************************************

删除VNC(系统一般自带了VNC所以可以先删除)

yum remove vnc-server

确认是否安装VNC

rpm -qa|grep “vnc-server”

查看vnc开了多少个

ps -ef | grep vnc

安装VNC(–nodeps --force参数加上后可以防止弹出VNC的依赖包错误提示,但需要安装xterm先)

将VNC-Server-5.0.5-Linux-x64.rpm拷贝到服务器上
执行:
yum install xterm
rpm --nodeps --force -ivh VNC-Server-5.0.5-Linux-x64.rpm

注册VNC(不注册就使用不了)

vnclicense -add -RR36V-7V29A-EVGJA-AYNEC-3DZYA

添加防火墙端口支持(一定得添加这个,否则客户端连接不上)

vim /etc/sysconfig/iptables # 打开防火墙配置
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5910 -j ACCEPT # 添加VNC支持的5900-5910端口
service iptables restart # 重启防火墙

配置Hosts文件写一个如:

vim /etc/hosts
192.168.1.122 localhost.ice www.ice.com的例子

启动和关闭VncServer服务

/etc/init.d/vncserver-x11-serviced stop
/etc/init.d/vncserver-x11-serviced start
/etc/init.d/vncserver-x11-serviced restart

修改文件vi /root/.vnc/xstartup(可能这个文件不存在,wq保存即可):

#!/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 KaTeX parse error: Expected 'EOF', got '&' at position 57: …config -iconic &̲ xterm -geometr…VNCDESKTOP Desktop" &
gnome-session &

修改文件vi /etc/sysconfig/vncservers(可能这个文件不存在,wq保存即可):

VNCSERVERS=“1:root 2:ice”
VNCSERVERARGS[1]=“-geometry 1024x768”
VNCSERVERARGS[2]=“-geometry 1024x768”

客户端连接VNCServer

本地若为Windows,可使用Window版本的VNC-Viewer来链接,若vncserver有开启序号,则链接地址填写如:220.231.198.13:1,其实这个地址可以在linux端当执行vncserver :1后下面会生成一句话New desktop is localhost.tao:1 (220.231.198.13:1)通过这句话也可以看出

常见错误************************************************************************************************

sh: xauth: command not found

这是因为:未安装xauth,解决:yum install xauth

vnc xauth: localhost.ice:1: bad display name

这是因为你未写Hosts,现在需要将localhost.ice写入vim /etc/hosts与指定IP对应的一行

启动一个VNCServer

vncserver :1 # 开启一个VNC指定序号为1(可以理解为是端口)

关闭一个VNCServer

vncserver -kill :1 # 关闭一个vnc,其中1代表vnc序号

error while loading shared libraries: libXtst.so.6

这是因为没有安装libXtst解决:yum install libXtst

突然连不通服务端

重启network即可
service network restart


举报

相关推荐

0 条评论