1.确认是否已经安装了vncserver
[root@localhost ~]# rpm -qa | grep vnc
tigervnc-server-1.0.1-3.fc12.i686
tigervnc-1.0.1-3.fc12.i686
gtk-vnc-0.3.10-1.fc12.i686
VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下
桌面号为“1” ---- 端口号为5901
桌面号为“2” ---- 端口号为5902
桌面号为“3” ---- 端口号为5903
如果没有安装,一般安装tightvnc-server和tightvnc
[root@localhost ~]# yum install tightvnc-server
[root@localhost ~]# yum install tightvnc
2.启动vnc服务
首先配置vnc password
[root@localhost ~]# vncpasswd
需要输入2遍确认
接下来启动vnc sever
[root@localhost ~]# vncserver :1
VNC服务使用的端口号与桌面号的关系
VNC服务使用的端口号与桌面号相关,VNC使用TCP端口从5900开始,对应关系如下
桌面号为“1” ---- 端口号为5901
桌面号为“2” ---- 端口号为5902
桌面号为“3” ---- 端口号为5903
如果Linux开启了防火墙功能,就需要手工开启相应的端口,以开启桌面号为“1”相应的端口为例,命令如下
[root@localhost ~]# iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
可以使用 vncserver -kill :1 杀死桌面
接下来可以在windows里面使用vnc viewer 测试了
上面的方法在重启我们的linux机器后,创建的vnc桌面就需要重新再启动一次,因此可以将vnc server放到开机启动项里面来做
1.修改vnc配置文件
[root@localhost
~]# vi /etc/sysconfig/vncservers
在文件最后加入要启动的vnc参数信息,比如我的是:
VNCSERVERS="1:jw
2:root"
VNCSERVERARGS[1]="-geometry
1280x720"
VNCSERVERARGS[2]="-geometry
1280x720"
2.设置vnc服务随系统自动加载
chkconfig vncserver on
chkconfig --list vncserver