侧边栏壁纸
博主头像
★街角晚灯★博主等级

博观而约取 厚积而薄发

  • 累计撰写 438 篇文章
  • 累计创建 181 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

TightVNC Windows下远程连接Linux桌面

WinJay
2013-08-06 / 0 评论 / 0 点赞 / 134 阅读 / 3718 字 / 正在检测是否收录...
温馨提示:
文章发布较早,内容可能过时,阅读注意甄别。。。。

title: 'TightVNC Windows下远程连接Linux桌面' date: '2013-08-06T17:06:45+08:00'


引言:

必须明白:

vncserver在调用的时候,会根据你的配置来启用server端的监听端口,

端口默认是从5900开始,再加上你的桌面号。

比如你的桌面号为1,则vnc的连接端口号为5900+1=5901

比如你的桌面号为10000,则vnc的连接端口号为5900+10000=15900

======================================================================

下面配置VNC服务器,使用户(root)能够通过vnc客户端远程连接到linux系统的图形界面(前提是你的服务器要安装桌面)

1、检查linux系统是否安装VNC

在终端窗口输入命令:

[root@CentOS]# rpm -q vnc-server</span>

返回信息如下

package vnc-server is not installed

说明vnc服务器没有安装

2、运行以下命令进行安装:

[root@CentOS]# yum -y install vnc vnc-server</span>

3、启动VNC服务

[root@CentOS]# vncserver </span>
> You will require a password to access your desktops. 
> Password: 
> Verify:

会提示输入密码,这个密码是远程登录时所需要输入的密码,输入密码,回车

4、切换到root账号:su root然后输入root账号的密码

[root@CentOS]# vi /etc/sysconfig/vncservers #vnc配置文件
VNCSERVERS="1:root" # 把前面的#取消了 10000:root (桌面号:用户) 
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

最后保存退出

5、配置防火墙,允许1+5900=5901端口通过防火墙(否则远程连不上VNC服务器)

<span style="color: #ff0000;">[root@CentOS]# vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT</span>(允许5901端口通过防火墙)

这步我直接关了防火墙了 - -, <wbr></wbr> 
<span style="color: #ff0000;">[root@CentOS]# service iptables stop</span>

保存退出

6、重启vnc服务器

<span style="color: #ff0000;">[root@CentOS]# /etc/init.d/vncserver restart </span>

或者 
<span style="color: #ff0000;">[root@CentOS]# service vncserver restart</span>

7、重启防火墙,使刚才的端口配置生效

<span style="color: #ff0000;">[root@CentOS]# /etc/sysconfig/iptables restart </span>

或者使用
<span style="color: #ff0000;">[root@CentOS]# service iptables restart
<b><span style="color: #ff0000;"><span style="color: #ff0000;">====</span>===========<span style="color: #ff0000;">以下步骤未做操作================</span></span></b>
</span>

8、 设置vnc服务器开机自动启动

第一种方法:使用“ntsysv”命令启动图形化服务配置程序,在vncserver服务前加上星号,点击确定,配置完成。

第二种方法:使用“chkconfig”在命令行模式下进行操作,命令使用如下

chkconfig vncserver on chkconfig --list vncserver vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off

9、更改vnc连接密码的命令:

vncpasswd

到此,VNC服务端设置完成,用VNC客户端可以连接了

vnc服务器:你的ip:15900

注意:如果在连接上之后,出现灰屏,可以按照下面的方法设置

进入用户的home目录, cd /home/user

如果是用root账号登录的,那么当前目录就是用户根目录

cd ~/.vnc vi xstartup #编辑 #twm & #注释掉这一行 gnome-session & #添加这一行

保存退出即可正常连接!

做到这里,总算是大功告成了,接下来你可以用http://IP:port的方式来WEB登录比如说

http://IP:5801,也可以在vncviewer里用IP:1这种来登录。

======================================测试是否成功===================================

1.在网上找了VNC的windwos客户端工具,进行安装。。。。

2.安装完成后启动连接测试。。

TightVNC Windows下远程连接Linux桌面

测试成功。。

0
  1. qrcode alipay
  2. qrcode weixin

评论区