VNCServer 配置
1、首先要配置的是服務(wù)端
A 確認(rèn)服務(wù)器端是否安裝了vncserver
使用rpm –qa vnc命令如果收到如下信息說明已經(jīng)安裝了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從光盤找到安裝包進(jìn)行安裝
首先將光盤掛載(也叫解壓)到某個(gè)目錄這里是在/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 接下來就是最重要的配置步驟了:
服務(wù)器端配置如下:
1)第一次啟動(dòng)vncserver
會(huì)提示輸入密碼:
管理員帳戶:
[root@localhost /]# vncserver
You will require a password to access your desktops.
Password:?輸入vnc 連接密碼
Verify:?確認(rèn)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:?確認(rèn)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
* 注意到每個(gè)用戶都可以啟動(dòng)自己的 vncserver,每個(gè)用戶可以啟動(dòng)多個(gè) vncserver,
用ip加端口號(hào) ip:1,ip:2,ip:3 來標(biāo)識(shí)。vncserver的大部分配置文件及日志文件都在用戶home目錄下.vnc目錄下
用戶可以自定義啟動(dòng)號(hào)碼如:
[huilin@localhost /]$ vncserver :2
A VNC server is already running as :2
2)配置vnc的配置文件xstartup文件
如果用的是gnome 桌面環(huán)境還需要修改
[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
添加連接時(shí)使用 gnome 桌面環(huán)境
twm &
3)在vncserver設(shè)置登錄用戶的信息
[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
設(shè)置vncserver的分辨率
#vncserver -geometry 640x480
設(shè)置vncserver的分辨率
#vncserver -depth 8
設(shè)置vncserver的色深
#vncserver -depth 16
設(shè)置vncserver的色深
4)客戶端的連接
a、在linux下,運(yùn)行vncviewer命令即可,服務(wù)器地址的寫法形如192.168.3.119:1
b、在windows下,運(yùn)行windows版本的vncviewer即可,用法與linux下相近。
c、用瀏覽器(平臺(tái)無關(guān)),作為java applet來實(shí)現(xiàn),以形如http://192.168.3.119:5801的方式來啟動(dòng)
(vnc 端口從5800 開始依次類推,一般會(huì)是5800,5900)
5)修改密碼
運(yùn)行vncpasswd即可
6)停止vncserver
#vncserver -kill :1
#vncserver -kill :2
注意到vncserver只能由啟動(dòng)它的用戶來關(guān)閉,即時(shí)是root也不能關(guān)閉其它用戶開啟的vncserver,
除非用kill命令暴力殺死進(jìn)程。
7)穩(wěn)定性設(shè)置
vncserver默認(rèn)在多個(gè)客戶機(jī)連接同一個(gè)vncserver的顯示端口時(shí),vncserver端口舊連接,而為新連接服務(wù),可通過-dontdisconnect拒絕新連接請(qǐng)求而保持舊的連接。
8)同一個(gè)顯示器可以連接多個(gè)客戶
轉(zhuǎn)載于:https://blog.51cto.com/343067/1723454
總結(jié)
以上是生活随笔為你收集整理的VNCServer 配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ssl certificate 验证
- 下一篇: 关于产品推荐的10个问题