VNCServer 配置
1、首先要配置的是服務端
A 確認服務器端是否安裝了vncserver
使用rpm –qa vnc命令如果收到如下信息說明已經安裝了vncserver,
[root@localhost: ~]#rpm -qa |grep vnc
gtk-vnc-python-0.3.2-3.el5
vnc-server-4.1.2-14.el5
gtk-vnc-0.3.2-3.el5
vnc-4.1.2-14.el5
B從光盤找到安裝包進行安裝
首先將光盤掛載(也叫解壓)到某個目錄這里是在/var/ftp/pub/下面建立了rhel5-64目錄
mount –o loop rhel-server-5.3-x86_64-dvd.iso
/var/ftp/pub/rhel5-64/
然后在/var/ftp/pub/rhel5-64/Server目錄下找到 vnc-server-4.1.2-14.el5.x86_64.rpm安裝包,使用rpm –ivh vnc-server-4.1.2-14.el5.x86_64.rpm命令直接安裝;
C 接下來就是最重要的配置步驟了:
服務器端配置如下:
1)第一次啟動vncserver
會提示輸入密碼:
管理員帳戶:
[root@localhost /]# vncserver
You will require a password to access your desktops.
Password:?輸入vnc 連接密碼
Verify:?確認vnc密碼
xauth:?creating new authority file /root/.Xauthority
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
普通用戶:
[root@localhost /]#su huilin
[huilin@localhost /]$ vncserver
You will require a password to access your desktops.
Password:?輸入vnc 連接密碼
Verify:?確認vnc密碼
xauth:?creating new authority file /home/huilin/.Xauthority
New 'localhost.localdomain:2 (huilin)' desktop is localhost.localdomain:2
Creating default startup script /home/huilin/.vnc/xstartup
Starting applications specified in /home/huilin/.vnc/xstartup
Log file is /home/huilin/.vnc/localhost.localdomain:2.log
* 注意到每個用戶都可以啟動自己的 vncserver,每個用戶可以啟動多個 vncserver,
用ip加端口號 ip:1,ip:2,ip:3 來標識。vncserver的大部分配置文件及日志文件都在用戶home目錄下.vnc目錄下
用戶可以自定義啟動號碼如:
[huilin@localhost /]$ vncserver :2
A VNC server is already running as :2
2)配置vnc的配置文件xstartup文件
如果用的是gnome 桌面環境還需要修改
[root@localhost .vnc]# vi xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
將此行的注釋去掉
# exec /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 gnome
添加連接時使用 gnome 桌面環境
twm &
3)在vncserver設置登錄用戶的信息
[root@localhost: ~]#vi /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="1:root 2:demo"
此處添加用戶
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
#vncserver -geometry 800x600
設置vncserver的分辨率
#vncserver -geometry 640x480
設置vncserver的分辨率
#vncserver -depth 8
設置vncserver的色深
#vncserver -depth 16
設置vncserver的色深
4)客戶端的連接
a、在linux下,運行vncviewer命令即可,服務器地址的寫法形如192.168.3.119:1
b、在windows下,運行windows版本的vncviewer即可,用法與linux下相近。
c、用瀏覽器(平臺無關),作為java applet來實現,以形如http://192.168.3.119:5801的方式來啟動
(vnc 端口從5800 開始依次類推,一般會是5800,5900)
5)修改密碼
運行vncpasswd即可
6)停止vncserver
#vncserver -kill :1
#vncserver -kill :2
注意到vncserver只能由啟動它的用戶來關閉,即時是root也不能關閉其它用戶開啟的vncserver,
除非用kill命令暴力殺死進程。
7)穩定性設置
vncserver默認在多個客戶機連接同一個vncserver的顯示端口時,vncserver端口舊連接,而為新連接服務,可通過-dontdisconnect拒絕新連接請求而保持舊的連接。
8)同一個顯示器可以連接多個客戶
轉載于:https://blog.51cto.com/343067/1723454
總結
以上是生活随笔為你收集整理的VNCServer 配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ssl certificate 验证
- 下一篇: 基于Redis的MQ中间件实现-目录