Linux下安装VNC Server

Linux VNCServer安装配置
VNC Server 是一个为了满足分布式用户共享服务器上面的资源,而在服务器上开启的一项服务,对应的客户端软件为VNC Viewer;它也可以是不同的操作系统,比如利用Windows远程访问linux系统资源的一种远程访问方式。 VNC Server 是一般 Linux 发行版都会附带的 VNC 服务器软件。
 
一、 确认及安装VNC Server
1、 确认是否安装了VNC Server
[root@localhost ~]# rpm -q vnc-server
vnc-server-4.1.2-14.el5_3.1     // 说明已经安装了VNC Server
2、 如果没有安装VNC Server,那么执行下面命令进行安装
[root@localhost ~]# yum install -y vnc-server
二、 配置VNC Server
1、  启动VNC Server,第一次启动VNC Server会提示输入密码
[root@localhost ~]# vncserver
 
You will require a password to access your desktops.
 
Password: redhat      // 输入VNC连接密码
Verify: redhat        // 确认VNC连接密码
 
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
 
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
三、 相关桌面配置
1、  设置用户信息及分辨率
[root@localhost ~]# vim /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:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
 
# 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="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
VNCSERVERS="1:root"
VNCSERVERARGS[3000]="-geometry 800x600 -nolisten tcp  -nohttpd -localhost
2、  如果在生产环境里面需要设置iptables策略
/etc/sysconfig/iptables里添加如下字段
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport  端口号 -j ACCEPT
四、 VNC Server 服务的启动
1、  执行下面启动命令并添加到开启自启动
[root@localhost ~]# service vncserver restart
[root@localhost ~]# chkconfig vncserver on
     2 、设置自定义的连接端口并启动
[root@localhost ~]# x0vncserver passwordfile=/root/.vnc/passwd -rfbport 3000
//此方法如果有人连接的时候没有加--Viewonly 那么他拥有操作权限会导致所有用户断开链接
五、 VNC 客户端的使用
1、  Linux VNC客户端的使用
[root@localhost ~]# vncviewer --shared  192.168.0.1:3000  // 可以对主机进行操作
[root@localhost ~]# vncviewer --shared --viewonly 192.168.0.1:3000 // 不能操作(只读)
弹出对话框要求输入密码
2、  Windows VNC客户端的使用
a)    首先需要安装VNC客户端工具(推荐使用VNC Viewer
b)    运行VNC Viewer.exe
测试效果图
 
 
 

你可能感兴趣的:(linux,server,职场,vnc,休闲)