我一直對vnc不了解,並且有點想試試看遠端進入機房中的 CentOS主機(雖然我對ssh以及命令行管理並不陌生),於是利用週末找了一些資料,試著遠端進入linux主機,先看看最終的結果圖示吧。
好,現在來看看要怎麼設定:
先檢查是否有vnc
rpm -q vnc vnc-server
有的話,就會出現vnc的版本號:vnc-server-4.0-8.1
好,再來,編輯 /etc/sysconfig/vncservers
# 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=”2:james”
VNCSERVERARGS[2]=”-geometry 800×600″
成功的話就會在你的瀏覽器看到這個遠端的linux畫面
這是我在遠端安裝firefox
都弄好之後,可能是我不正常的離開,所以過幾天我要在進去時登入之後看到空白的桌面,怎麼辦呢?只好ssh進去主機重新啟動 vncserver ,執行以下指令:
service vncserver restart
但是又出現狀況:
Warning: nana.hostname.com:2 is taken because of /tmp/.X2-lock
Remove this file if there is no X server nana.hostname.com:2
這是一個暫存擋,將他刪除之後再執行一次即可成功啟動!
另外,如果不想使用瀏覽器觀看,可以使用 VNCviewer, 這裡有一個免費的 for Mac OSX的叫做 Chicken of VNC
可以參考以下的reference:
http://blog.weithenn.org/2009/04/centoscentos-5x.html
http://linux.vbird.org/linux_server/0310telnetssh.php
http://pulipuli.blogspot.com/2008/07/vncserver.html
http://blog.csdn.net/hbcui1984/archive/2008/01/22/2060226.aspx