---
title: "linux 下VNC的配置(转载)"
author: "8366"
date: "2010-10-29T11:02:30Z"
tags: []
categories: ["操作系统"]
slug: "linux-vnc"
draft: false
lastmod: "2010-11-09T12:40:35Z"
id: 797391
url: "https://8366.iteye.com/blog/797391"
---

**1，查看是否有装VNCserver**  
**\[root@mylab ~]# rpm -qa|grep vnc**  
**vnc-4.1.2-14.el5                              #客户端软件**  
**vnc-server-4.1.2-14.el5                   #服务器端软件**  
**如果没有，采用rpm或者yum安装**

**2，开启vncserver服务**  
**\[root@mylab ~]# service vncserver start**  
**Starting VNC server: no displays configured                \[ OK ]**

**3，开启第一个session**  
**\[root@mylab ~]# vncserver :1              #第二个就是vncserver :2,依次类推**

**New 'mylab:1 (root)' desktop is mylab:1**  
**Starting applications specified in /root/.vnc/xstartup**  
**Log file is /root/.vnc/mylab:1.log**

**4，windows访问在地址栏里输入** [**http://ip:5801**](http://ip:5801/)    **然后输入root密码就可以访问了**  
**windows客户端一定要装JRE，如果不装是无法访问的**  
**没有装JRE的显示**  
**![](http://hiphotos.baidu.com/955796/pic/item/41f0a94dda93b6ddd72afcaf.jpg)**

**安装了JRE之后的显示**  
**![](http://hiphotos.baidu.com/955796/pic/item/f3e68e6c265adddf431694b4.jpg)**

**![](http://hiphotos.baidu.com/955796/pic/item/6088d639ab72fe0797ddd8b0.jpg)**

**5，这时候虽然连接上了但是无法看到完整的linux桌面，还是个空白背景，看不到桌面**

**![](http://hiphotos.baidu.com/955796/pic/item/a933e8b45c467aea36d3cabf.jpg)**

**如果用的是gnome客户端，编辑/root/.vnc/xstartup，按照提示将红字那两行的注释符去掉**  
**# Uncomment the following two lines for normal desktop:**  
**# unset SESSION\_MANAGER**  
**# exec /etc/X11/xinit/xinitrc**

**( 某些系统版本是更改.vnc/xstartup文件,将twm更改为gnome-session )**

**杀掉启动的VNC第一个session**  
**\[root@mylab ~]# vncserver -kill :1           不要尝试用service vncserver restart来重启vncsrever服务**  
**Killing Xvnc process ID 2913**  
**\[root@mylab ~]# vncserver :1               #再次启动第一个session，这次登录效果就不一样了吧。**

 

 

参考

http://hi.baidu.com/955796/blog/item/4af62a243442e36834a80fe2.html