歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 5 下安裝配置VNC

CentOS 5 下安裝配置VNC

日期:2017/2/28 15:30:43   编辑:Linux教程

1. 檢查vnc客戶端和服務器是否已經安裝
[root@CentOS ~]$ rpm -q vnc vnc-server
package vnc is not installed
vnc-server-4.0-8.1

cent os 5已包含vnc的安裝包

2. 將用戶名稱加入到配置文件
(注:這裡的“用戶名”是指linux系統用戶的名稱)
[root@centos ~]# vi /etc/sysconfig/vncservers
#
# Uncomment the line below to start a VNC server on display :1
# 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/vnc/sshvnc.html>.

# VNCSERVERS="1:myusername"

# VNCSERVERS="1:root 2:user" # use the method for more user
VNCSERVERS="1:root 2:user"

# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[1]="-geometry 1024x768"

VNCSERVERARGS[2]="-geometry 1024x768"

3. 設置用戶的密碼
[user@centos ~]$ vncpasswd
Password:
Verify:

4. 啟動VNC服務
[user@centos ~]# /sbin/service vncserver start
Starting VNC server: 1:user                [ OK ] 

5. 編寫xstartup腳本
[user@centos ~]$ cd ~/.vnc/
[user@centos .vnc]$ vi xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#e xec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop"

& gnome-session &

#set starting GNOME desktop
#startkde &

#kde desktop
#twm &

#Text interface

6. 重啟vncserver
[root@centos ~]# /sbin/service vncserver restart

Shutting down VNC server: 1:root [ OK ]
Starting VNC server: 1:root                [ OK ] 

7. Windows登陸到VNC Server
啟動:vnc-E4_2_8-x86_win32_viewer.exe
輸入:
server:192.168.1.13:1 (這裡,我的VNC服務器在192.168.1.13上,用的是Display1(對應gavin帳號))
Encryption:Let Server Choose(Default)

注:紅色標注部分是更改的配置。

Copyright © Linux教程網 All Rights Reserved