码迷,mamicode.com
首页 > 其他好文 > 详细

vnc服务器配置实例

时间:2015-06-09 09:44:27      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

系统环境为CentOS、RHEL、
一、安装、启动
1、安装tigervnc-server服务器端软件
      # rpm -ivh tigervnc-server             只要这一个就行
      # yum -y install tigervnc-server
2、启动服务:
[root@vn ~]# vncserver
Password:                                             设置用户的VNC登陆密码
Verify:
xauth: (stdin):1:  bad display name "vn:1" in "add" command

New vn:1 (root) desktop is vn:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/vn:1.log
3、查看进程
# ps -ef|grep Xvnc
root       2003      1  0 06:16 pts/1    00:00:00 /usr/bin/Xvnc :1 -desktop vn:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
root       2156   1937  0 06:20 pts/1    00:00:00 grep Xvnc
5901为虚拟进程号
 
# cd /root/.vnc/
# ls
passwd  vn:1.log  vn:1.pid  xstartup   访问密码文件、访问日志文件、第一个虚拟桌面的PID文件,保存一个进程号、启动脚本文件、
# cat vn\:1.pid 
2003                                   进程号为2003
 
4、查看端口号
使用下面的命令查看端口,5901为第一个虚拟桌面的端口号,第二个为5902,以此类推
[root@vn .vnc]# netstat -antu|grep 5901
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      
 
5、创建或更改VNC密码
[root@vn ~]# vncpasswd
Password:
Verify:
二、使用:连接VNC服务器
首先,关闭防火墙   service  iptables  stop
1、Linux客户端连接
a、安装tigervnc软件包
b、连接VNC服务器:在图形界面用客户端软件进行登录操作,在右上侧面板中可以找到,如192.168.121.171:1(第一个虚拟桌面)
c、使用vncviewer命令连接VNC服务器
# vncviewer 192.168.121.171:1              两种方式
# vncviewer 192.168.121.171:5901
2、windows客户端软件连接
下载并安装vncviewer
 具体操作过程和Linux上的相同
三、配置用户使用固定虚拟桌面
如tom使用固定虚拟桌面号码为2
1、编辑
# vim /etc/sysconfig/vncservers
 VNCSERVERS="2:tom"
 VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp "
2、为tom 设置登陆密码
[root@vn ~]# su - tom
[tom@vn ~]$ vncpasswd
Password:
3、启动vncserver服务
# service vncserver start
正在启动 VNC 服务器:2:tom xauth:  creating new authority file /home/tom/.Xauthority
xauth: (stdin):1:  bad display name "vn:2" in "add" command
 
New ‘vn:2 (tom)‘ desktop is vn:2
 
Creating default startup script /home/tom/.vnc/xstartup
Starting applications specified in /home/tom/.vnc/xstartup
Log file is /home/tom/.vnc/vn:2.log
4、查看进程
# ps -ef | grep Xvnc
root       2003      1  0 06:16 pts/1    00:00:00 /usr/bin/Xvnc :1 -desktop vn:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
tom        2391      1  1 07:40 ?        00:00:00 /usr/bin/Xvnc :2 -desktop vn:2 (tom) -auth /home/tom/.Xauthority -geometry 800x600 -rfbwait 30000 -rfbauth /home/tom/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn -nolisten tcp
root       2786   2353  0 07:41 pts/2    00:00:00 grep X       vnc 进程号2391,虚拟桌面号2,端口号5902
5、连接VNC服务器
四、控制vncserver服务
只有设置了固定虚拟桌面后才能使用service 和 chkconfig命令控制vncserver服务的状态
# service vncserver start                restart启动、重启stop 关闭
#service vncserver status              查看状态
#chkconfig vncserver on      开机启动
#chkconfig --list vncserver  

 

 
 
 
 
 

vnc服务器配置实例

标签:

原文地址:http://www.cnblogs.com/chinas/p/4562533.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!