RHEL Linux6.3下的vnc安裝和多用戶怎么配置,相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。
VNC (Virtual Network Computer)是虛擬網絡計算機的縮寫。VNC 是一款優秀的遠程控制工具軟件,由著名的 AT&T 的歐洲研究實驗室開發的。VNC 是在基于 UNIX 和 Linux 操作系統的免費的開源軟件,遠程控制能力強大,高效實用,其性能可以和 Windows 和 MAC 中的任何遠程控制軟件媲美。 在 Linux 中,VNC 包括以下四個命令:vncserver,vncviewer,vncpasswd,和vncconnect。大多數情況下用戶只需要其中的兩個命令:vncserver 和 vncviewer。下面我們講一下在RHEL Linux6.3下的vnc安裝和多用戶配置。
一、安裝VNC
RHEL6.3中有關VNC的rpm包是:
客戶端:tigervnc-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm
服務端:tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm
1、yum安裝:(配置本地YUM源)
[root@localhost]#mkdir /rhel6
[root@localhost]#mount -o loop -t iso9660 rhel-server-6.3-x86_64-dvd.iso /rhel6
[root@localhost yum.repos.d]# cat rhel6.repo
[rhel6]
name=Red Hat Enterprise Linux6.3
baseurl=file:///rhel6
enabled=1
gpgcheck=0
[root@localhost]#yum makecache
[root@rac1 oracle]# yum -y install tigervnc-server
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Installing : tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64 1/1
Installed products updated.
Verifying : tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64 1/1
Installed:
tigervnc-server.x86_64 0:1.0.90-0.17.20110314svn4359.el6
Complete!
2、啟動vnc服務
#service vncserver start
3、添加系統啟動
#chkconfig vncserver on
4、啟動VNC桌面
[root@rac1 oracle]# vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /root/.Xauthority
New 'rac1.localdomain:1 (root)' desktop is rac1.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/rac1.localdomain:1.log
注: 第一次啟動時系統會提示設置連接VNC時的登錄密碼,這個和ROOT設置的認證密碼是可以不同的。
二、配置VNC
查看vnc桌面配置文件
[root@bogon ~]# vi /root/.vnc/xstartup
#######################################################################
1 #!/bin/sh
2
3 [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
4 export LANG
5 export SYSFONT
6 vncconfig -iconic &
7 unset SESSION_MANAGER
8 unset DBUS_SESSION_BUS_ADDRESS
9 OS=`uname -s`
10 if [ $OS = 'Linux' ]; then
11 case "$WINDOWMANAGER" in
12 *gnome*)
13 if [ -e /etc/SuSE-release ]; then
14 PATH=$PATH:/opt/gnome/bin
15 export PATH
16 fi
17 ;;
18 esac
19 fi
20 if [ -x /etc/X11/xinit/xinitrc ]; then
21 exec /etc/X11/xinit/xinitrc
22 fi
23 if [ -f /etc/X11/xinit/xinitrc ]; then
24 exec sh /etc/X11/xinit/xinitrc
25 fi
26 [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
27 xsetroot -solid grey
28 xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
29 twm &
######################################################################################
注: 左邊的1-29是VIM顯示的行號,便于編輯。
第7行和第21或24行在紅帽5版本中默認是被注釋掉的,是要啟用的,RHEL6.3是默認是啟用的。
只需要把最后一句twm &改為gnome-session &即可。
然后vncserver -kill :1
再vncserver :1啟用一下,就可以使用客戶端正常連接了。(注:需關閉防火墻或放行相應端口)
三、多用戶配置
修改vncserver配置文件
[root@bogon ~]# vi /etc/sysconfig/vncservers
#####################################################################################
1 # The VNCSERVERS variable is a list of display:user pairs.
2 #
3 # Uncomment the lines below to start a VNC server on display :2
4 # as my 'myusername' (adjust this to your own). You will also
5 # need to set a VNC password; run 'man vncpasswd' to see how
6 # to do that.
7 #
8 # DO NOT RUN THIS SERVICE if your local area network is
9 # untrusted! For a secure way of using VNC, see this URL:
10 # http://kbase.redhat.com/faq/docs/DOC-7028
11
12 # Use "-nolisten tcp" to prevent X connections to your VNC server via TC P.
13
14 # Use "-localhost" to prevent remote VNC clients connecting except when
15 # doing so through a secure tunnel. See the "-via" option in the
16 # `man vncviewer' manual page.
17
18 #VNCSERVERS="2:myusername"
19 #VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
##########################################################################################
注:把18、19行復制一下,做如下修改
VNCSERVERS="1:root 2:test"
VNCSERVERARGS[3]="-geometry 800x600 -nolisten tcp -localhost"
如果啟用更多用戶,則可以直接空格再繼續同格式添加用戶,例,VNCSERVERS="1:root 2:test 3:user" 但是第19行的[3],一定要改成第18行啟用的用戶數加上1,比如上面兩個用戶,就要寫成3,那么3個用戶就寫成4。不然的話,vncserver重啟后,最后一個用戶的vnc桌面不可用,但是如果以上用戶又啟用了其他桌面號但沒寫進這個文件,不受影響。另外在TEST用戶下也需要啟用VNCSERVER服務并設置密碼,修改相應的配置文件。
重啟VNC服務
# service vncserver restart
# xhost +
關閉防火墻
#service iptables stop
#chkconfig iptables off
多用戶測試:
WINDOWS系統環境下使用vnc客戶端連接時,輸入IP地址時一定要跟上桌面號,例:“192.168.199.109:1”“192.168.199.109:2”。這樣就可以分別登陸到ROOT桌面和TEST用戶桌面。
補充:
遠程連入UNIX、Linux進行圖形化操作的還有流行的Xmanager軟件,VNC與之相比——兩者工作原理不一樣,前者(VNC)是遠程連入操作系統,所有操作在UNIX、Linux主機服務端進行,即使操作過程中“本地電腦與操作主機網絡斷開”,也不影響操作的順利進行;而后者(Xmanager)是通過端口將主機服務器的UI界面引導到本地電腦進行展現,如操作過程出現“本地電腦與操作主機網絡斷開”,操作將中斷失??!如果操作中進行的工作任務非常重要,不能中斷,如ORACLE RAC實施,結果是災難性的!更重要的是,VNC是免費的、開源的,Xmanager你可能用的是破解注冊版的。
看完上述內容,你們掌握RHEL Linux6.3下的vnc安裝和多用戶怎么配置的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。